Le 20/09/2015 20:28, rjf a écrit :
If the original program has constants that are good for ordinary
floating precision,
then increasing the precision without increasing the accuracy may not do
what
you want.
For example, converting 3.1415926  (etc) by extending with decimal or
  binary 0's might
not do the right thing.
In fact, converting 0.1, which is a binary float not equal to 1/10
exactly, might change
the situation enough so that
f(a,b,c)  in single-float
f(a,b,c)  in 100 bits


I know that... but, my constants are defined by values of elementary functions.
The solution proposed by William is perfect for me, and very consistent:

sage: atan(1.0)
0.785398163397448
sage: RealNumber=RealField(300)
sage: atan(1.0)
0.785398163397448309615660845819875721049292349843776455243736148076954101571552249657008706
age: RealNumber=RealField()
sage: atan(1.0)
0.785398163397448
sage: ComplexNumber=ComplexField(200)
sage: x=ComplexNumber(1,1)
sage: cos(x)
0.83373002513114904888388539433509447980987478520962931227072 - 0.98889770576286509638212954089268618864214969503314760753682*I

great...

differ not because the second is more accurate, but because something rather
different is being computed.   e.g. if a= 0.1.

Also, if someone is automatically translating C to python, then
automatically
inserting  MyChosenPrecisionReal('   ')   around every float should be easy.

While it is tempting to add every possible tool to Sage, thinking out of the
box can be productive.

(one answer:  there is a bootstrapping problem if you have to have a working
Sage in order to build a working Sage.)


On Sunday, September 20, 2015 at 9:20:35 AM UTC-7, Volker Braun wrote:

    Yes, a more complete regex can be found easily with google or by
    using the one from src/sage/repl/preparse.py

    On Sunday, September 20, 2015 at 6:11:25 PM UTC+2, vdelecroix wrote:

        Would not work with 'x=.8' (can be fixed with replacing the
        first \+

        with a \*) nor 'x=2e3' (this is more annoying).

--
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
<mailto:sage-devel+unsubscr...@googlegroups.com>.
To post to this group, send email to sage-devel@googlegroups.com
<mailto:sage-devel@googlegroups.com>.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

--
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 http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

<<attachment: tdumont.vcf>>

Reply via email to