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: Mon, 6 Nov 2023 16:22:38 +0000
This is a multi-part message in MIME format.
--=_QJyEfqlAfncoM8fB56hLDQdX5vxg3caH
> Date: Tue, 7 Nov 2023 00:45:43 +0900
> From: Izumi Tsutsui <tsutsui%ceres.dti.ne.jp@localhost>
>
> > Can you please run the attached program on your R3000 system and share
> > the output?
>
> Here it is:
> ...
> (Expected?)
That output looks correct. The FLT_ROUNDS numbers are prescribed in
the C standard, while the fpgetround/fesetround numbers are not and
may vary from machine to machine, but at least it looks like the
numbers are consistent and the results have the correct rounding.
So the libc/libm functions fpgetround and fegetround seem to agree,
when set with either fpsetround or fesetround. (Amusingly, it appears
fpsetround has been broken on i386 since the introduction of SSE.
Oops! PR port-i386/57684: https://gnats.NetBSD.org/57684)
Can you try the attached program, with and without libm linked?
rm -f test1 && make test1 && ./test1
rm -f test1 && make test1 LDLIBS=-lm && ./test1
The numbers in the output should agree, and the text should be
different to verify that the linking or non-linking made a difference.
--=_QJyEfqlAfncoM8fB56hLDQdX5vxg3caH
Content-Type: text/plain; charset="ISO-8859-1"; name="test1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="test1.c"
#include <fenv.h>
#include <float.h>
#include <stdio.h>
__weakref_visible int fegetround_weak(void) __weak_reference(fegetround);
int
main(void)
{
printf("FLT_ROUNDS=3D%d\n", FLT_ROUNDS);
if (fegetround_weak)
printf("fegetround()=3D%d\n", fegetround_weak());
else
printf("FE_TONEAREST=3D%d\n", FE_TONEAREST);
fflush(stdout);
return ferror(stdout);
}
--=_QJyEfqlAfncoM8fB56hLDQdX5vxg3caH--
Home |
Main Index |
Thread Index |
Old Index