Erik Bray wrote:
> On Wed, Aug 10, 2016 at 2:45 PM, Thierry Dumont
> <tdum...@math.univ-lyon1.fr> wrote:
>> Le 10/08/2016 à 13:38, Erik Bray a écrit :
>>> Hi all,
>>>
>>> Sorry if this has been discussed ad-infinitum before--I looked around
>>> a bit but didn't find a definitive answer.
>>>
>>> I have one (well at least one) test that's failing on Cygwin due to
>>> tiny difference in the last digit of the result of log(3).
>>>
>>> This leads to to several questions:
>>>
>>> 1) Is it worth investigating the reason for the difference?
>>> 2) Is it worth trying to provide a workaround for the difference?
>>> 3) Or should the test just be updated to ignore the last couple digits
>>> of the result, and if so how (ellipses?)
>>>
>>> Thanks,
>>> Erik
>>>
>> Hello,
>>
>> What do you mean by log(3) ?
>>
>> Is it log(3.) or log(RDF(3)) ?
> 
> Really what I meant was `float(log(3))` which I guess in Sage ends up
> being same as `log(RDF(3))`
> 
>> With log(RDF(3)), this is classical; changing the library version, or
>> the compiler version often changes the way some expressions and
>> functions are computed. As floating point arithmetic is not associative,
>> this is classical. With log(3.) (RealField()), I don't know.
>> When we wrote the book "Calcul Mathématique avec Sage", we had this
>> problem: after some release (some months) some  doctests of the chapter
>> on numerical algebra and floating point numbers failed. The only work
>> around we found was to truncate the last digit in the output, to try to
>> test what should remain constant.
> 
> I have:
> 
> sage: R = RealField(100)
> sage: log(R(3))
> 1.0986122886681096913952452369
> 
> Okay.  With Cygwin's libm:
> 
> sage: float(log(3))
> 1.0986122886681096
> 
> While on Linux I get:
> 
> sage: float(log(3))
> 1.0986122886681098
> 
> It looks like the latter result is properly rounded up (with an error
> of 1ulp) while my result on Cygwin is just truncated.


FWIW, on Cygwin we used to use the Cephes library for a while.  (No idea
whether it now replaced libm or parts of it got merged into libm
upstream, or none of that.)

But the result you get presumably also depends on whether libm was
compiled with -mfpmath=sse or -mfpmath=387 etc.


-leif



-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to