develooper Front page | perl.perl5.porters | Postings from June 2021

Re: quadmath with 32 bit ints

Thread Previous | Thread Next
Peter John Acklam
June 11, 2021 06:47
Re: quadmath with 32 bit ints
Message ID:
tor. 10. jun. 2021 kl. 16:21 skrev sisyphus <>:
> I also spent some time trying (unsuccessfully) to have the existing logic handle this case.
> Eventually, I decided that, given the rarity of perls with 4-byte IVs and 16-byte NVs, we could
> get away with simply nominating values of $e and $int that work.

I got something working. It stops with $e = 16 and $use_int = 0. Even
with $e = 17, all the values are within the range of what can be
represented exactly with 128 bit floats, but certain things fail. For
instance, I expected the following to return 1

$ perl -wle 'print( (2**113 - 1) % 2)'

I guess it has to do with how the % operator is implemented. I haven't
dug into it. POSIX::fmod() gets it right, though

$ perl -MPOSIX -wle 'print fmod(2**113 - 1, 2)'

but I don't think it's worth requiring the POSIX module just to get $e
= 17 rather than $e = 16.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About