[Libreoffice-bugs] [Bug 44076] =(-8)^(1/3) should return -2

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu Nov 15 15:05:48 UTC 2018


https://bugs.documentfoundation.org/show_bug.cgi?id=44076

--- Comment #11 from mwelinder at gmail.com ---
No accuracy problem either.  You can enter 6004799503160661 in A1 and widen
the column enough that you can see the whole, odd number.  You can then add or
subtract 1 and see ...662 and ...660 as expected.  Scaling by a power of 2
doesn't change that for "double" which is a base-2 representation.


x=6004799503160661/2^54 didn't come out of thin air.  It is what you get if you
round 1/3 to the nearest ieee-854 double number.  Once you have x, you have no
way of knowing whether it came from 1/3 [plus rounding error] or from
6004799503160661/2^54.

Note, that the code you linked to exhibits undefined behaviour if the cast to
"int" overflows.  That will happen for, for example, (-1)^(2^-64).  IIRC, sparc
and x86 produce different results for such a cast.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20181115/c502a517/attachment.html>


More information about the Libreoffice-bugs mailing list