[Rd] formatting issue with gcc 9.3.0 on Ubuntu on WSL2

Bill Dunlap w||||@mwdun|@p @end|ng |rom gm@||@com
Tue Nov 17 21:34:59 CET 2020


I just got a new Windows laptop (i7, 10th generation CPU), installed
'Windows Subsystem for Linux 2' and then installed Ubuntu 20.04 and
used 'apt-get install' to install packages that the R build seems
to require.  In particular, I am using gcc version 9.3.0.   The
build went without a hitch but the tests showed that deparse(1e-16)
produced "1.00000000000000e-16" instead of the expected "1e-16".

It looks like the problem is in src/main/format.c:scientific().  The
lowest two+ bytes in the fractional part of the long double (80-bit)
return value of powl(10.0L, -30L), seem to be corrupted.  I made a
standalong program to test powl and saw no problem - it gives the
same results for the fractional part as bc does.

        bc: A2425FF7 5E14FC31 A125...
standalone: 22425FF7 5E14FC32
         R: 22425FF7 5E151800

There are lots of other small numbers with the same problem:


                             > grep(value=TRUE, "0e",
vapply((1+(0:10000)/1000)*1e-15, deparse, ""))
[1] "8.56000000000000e-15" "8.71700000000000e-15" "8.77800000000000e-15"
[4] "8.93500000000000e-15" "9.50800000000000e-15" "9.83800000000000e-15"
[7] "9.89900000000000e-15" "9.93400000000000e-15" "9.99500000000000e-15"
> str(grep(value=TRUE, "0e", vapply((1+(0:10000)/1000)*1e-14, deparse, "")))
 chr [1:295] "8.00200000000000e-14" "8.00500000000000e-14" ...

Has anyone else seen this?  I am wondering if this is an oddity in WSL2

                             or Ubuntu's gcc-9.3.0.




           -Bill

	[[alternative HTML version deleted]]



More information about the R-devel mailing list