-------- Message transféré --------
Sujet : Re: Strange behavior with RealField(n)
Date : Mon, 22 Feb 2016 10:17:30 +0100
De : paul zimmermann <paul.zimmerm...@inria.fr>
Pour : Thierry Dumont <tdum...@math.univ-lyon1.fr>
Copie à : nbr...@sfu.ca

[please forward to sage-support, I am not allowed to post there]

       Thierry,

I can reproduce the problem as follows (in Sage 6.8):

sage: alarm(10)
sage: R=RealField(10^9)
sage: pii=4*atan(R(1))
sage: R=RealField(10^2)
sage: pii=4*atan(R(1))
sage: pii
NaN

My guess is that the interrupted calculation leaves MPFR in a strange stage
(exponent range, flags, cached values, ...)

Best regards,
Paul

> From: Thierry Dumont <tdum...@math.univ-lyon1.fr>
> Date: Sun, 21 Feb 2016 19:10:04 +0100
> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
>  Thunderbird/38.5.1
> 
> 
> [1:text/plain Hide]
> 
> I have students who want to compute decimals of pi...so, what can we do 
> with RealField(n) ?
> I make the following script (pi.sage):
> 
> ------------------------
> for p in [2..10]:
>      R=RealField(10^p)
>      pii=4*atan(R(1))
>      print p,R,pii
> ------------------------
> 
> Then, using sage 7.0 or 7.1.beta4:
> 
> attach("pi.sage")
> 
> This produces a lot of seemingly correct output, but, as it takes a too 
> long time to finish :-), I interrupt the computation (Ctrl-c).
> 
> So, lets try again; replace 10 by 5 in the for statement (I do not leave 
> sage). I get NaNs:
> 
> 
> 2 Real Field with 100 bits of precision NaN
> 3 Real Field with 1000 bits of precision NaN
> 4 Real Field with 10000 bits of precision NaN
> 5 Real Field with 100000 bits of precision NaN
> .....
> 
> Strange.
> 
> Yours
> t.d.
> 
> 
> 
> [2:text/x-vcard Show Save:tdumont.vcf (390B)]
> 


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

<<attachment: tdumont.vcf>>

Reply via email to