NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-mips/57680: printf("%.1f") shows wrong resultsonR3000mipseb



The following reply was made to PR port-mips/57680; it has been noted by GNATS.

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: Izumi Tsutsui <tsutsui%ceres.dti.ne.jp@localhost>
Cc: gnats-bugs%netbsd.org@localhost, tsutsui%ceres.dti.ne.jp@localhost
Subject: Re: port-mips/57680: printf("%.1f") shows wrong resultsonR3000mipseb
Date: Sun, 5 Nov 2023 15:53:15 +0000

 This is a multi-part message in MIME format.
 --=_UO/DuVWULAgwAF6z8mwyycn6j85jhood
 
 Can you please run the attached program on your R3000 system and share
 the output?
 
 --=_UO/DuVWULAgwAF6z8mwyycn6j85jhood
 Content-Type: text/plain; charset="ISO-8859-1"; name="test"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="test.c"
 
 #include <fenv.h>
 #include <float.h>
 #include <ieeefp.h>
 #include <stdio.h>
 
 #pragma STDC FENV_ACCESS ON
 
 static void
 show(const char *name)
 {
 	volatile double x =3D 0x1p-53;
 
 	printf("%10s: FLT_ROUNDS=3D%d fpgetround=3D%-4d fegetround=3D%-4d"
 	    " z=3D%a w=3D%a\n",
 	    name,
 	    FLT_ROUNDS, (int)fpgetround(), fegetround(),
 	    -1 + x/2, 1 + 3*x);
 }
 
 int
 main(void)
 {
 
 	printf("FP_RN=3D%-4d FE_TONEAREST=3D%d\n", FP_RN, FE_TONEAREST);
 	printf("FP_RZ=3D%-4d FE_TOWARDZERO=3D%d\n", FP_RZ, FE_TOWARDZERO);
 	printf("FP_RP=3D%-4d FE_UPWARD=3D%d\n", FP_RP, FE_UPWARD);
 	printf("FP_RM=3D%-4d FE_DOWNWARD=3D%d\n", FP_RM, FE_DOWNWARD);
 
 	fpsetround(FP_RN); show("tonearest");
 	fpsetround(FP_RZ); show("towardzero");
 	fpsetround(FP_RP); show("upward");
 	fpsetround(FP_RM); show("downward");
 	fesetround(FE_TONEAREST); show("tonearest");
 	fesetround(FE_TOWARDZERO); show("towardzero");
 	fesetround(FE_UPWARD); show("upward");
 	fesetround(FE_DOWNWARD); show("downward");
 
 	fflush(stdout);
 	return ferror(stdout);
 }
 
 --=_UO/DuVWULAgwAF6z8mwyycn6j85jhood--
 


Home | Main Index | Thread Index | Old Index