NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: port-amd64/54000: FP tests failing on amd64 since gcc7 import
The following reply was made to PR port-amd64/54000; it has been noted by GNATS.
From: coypu%sdf.org@localhost
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: port-amd64/54000: FP tests failing on amd64 since gcc7 import
Date: Fri, 22 Feb 2019 16:38:47 +0000
--PNTmBPCT7hxwcZjr
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Attached is a standalone test case (non-netbsd-specific)
--PNTmBPCT7hxwcZjr
Content-Type: application/x-sh
Content-Disposition: attachment; filename="t_fe_round.sh"
Content-Transfer-Encoding: quoted-printable
#!/bin/sh=0A=0Acat << EOF > round.c=0A#include <assert.h>=0A#include <fenv.=
h>=0A#include <math.h>=0A#include <stdio.h>=0A#include <stdlib.h>=0A=0A#def=
ine INT 9223L=0A=0A#define EPSILON 0.001=0A=0Astatic const struct {=0A int =
round_mode;=0A double input;=0A long int expected;=0A} values[] =3D {=0A { =
FE_DOWNWARD, -3.7, -4},=0A};=0A=0A=0Adouble my_nearbyint(double x)=0A{=0A=
double ret;=0A fenv_t env;=0A fegetenv(&env);=0A ret =3D rint(x);=0A feset=
env(&env);=0A return ret;=0A}=0A=0Aint main(void)=0A{=0A double received;=
=0A=0A fesetround(values[0].round_mode);=0A=0A received =3D my_nearbyint(va=
lues[0].input);=0A=0A if (!(fabs(received - values[0].expected) < EPSILON))=
=0A printf("nearbyint rounding wrong, difference too large\n"=0A "inp=
ut: %f (index %d): got %f, expected %ld\n",=0A values[0].input, 0, rec=
eived, values[0].expected);=0A=0A assert((fabs(received - values[0].expecte=
d) < EPSILON));=0A=0A /* Do we get the same rounding mode out? */=0A if (!(=
(fegetround() =3D=3D values[0].round_mode)))=0A printf("Didn't get the sam=
e rounding mode out!\n"=0A "(index %d) fed in %d rounding mode, got %d=
out\n",=0A 0, values[0].round_mode, fegetround());=0A=0A assert((fege=
tround() =3D=3D values[0].round_mode));=0A}=0AEOF=0A=0Agcc -lm round.c -O2 =
-o round=0Aecho "Executing regular -O2 build:"=0A./round=0Aecho "returned "=
$?=0A=0A=0Agcc -lm round.c -O2 -fno-builtin-rint -o round2=0Aecho "Executi=
ng -O2 -fno-builtin-rint build:"=0A./round2=0A=0Aecho "returned " $?=0A
--PNTmBPCT7hxwcZjr--
Home |
Main Index |
Thread Index |
Old Index