Hi!

----

This is basically a spin-off of
http://bugs.opensolaris.org/view_bug.do?bug_id=6773712 ("1-digit hex fp
base conversion of long double rounds incorrectly").
The bug description for Solaris libc says this:
> The first line of output from this program is correct.  The second line
> is not.
> 
> leviathan% cat a.c
> #include <stdio.h>
> 
> int main()
> {
>       printf("%.0a\n", 1.5);
>       printf("%.0La\n", 1.5L);
>       return 0;
> }
> leviathan% cc -o a a.c
> leviathan% a
> 0x1p+1
> 0x1p+0
> leviathan%

If I compile the testcase with libast on Solaris 11/B84 SPARC (which
matches ast-open.2008-11-04) I get this:
-- snip --
$ cc -xc99=%all -I/usr/include/ast -last a.c -o a &&
./a                                             
0x1p+00
0x1p+00
-- snip --
... which seems to be incorrect per the bugs comment above and should
be:
-- snip --
0x1p+1
0x1p+1
-- snip --

ksh93 has the same problem:
$ ksh93 -c 'float r=1.5 ; printf "%.0a\n" r'
0x1p+00

I'm now trying to dig out more testcases for this issue...

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)

Reply via email to