Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

adding real literal and real number of high precision

When Sage is adding a real literal to a real number of high precision, shouldn't it calculate the sum in the high precision ring? Instead, Sage seems to calculate in double precision:

RF=RealField(150); RF

Real Field with 150 bits of precision

RF(0.9 + RF(1e-18))

0.90000000000000002220446049250313080847263336

RF(1.0+ RF(1e-18))

1.0000000000000000000000000000000000000000000

RF(1+ RF(1e-18))

1.0000000000000000010000000000000000000000000

I'm trying to use high precision arithmetic (2658 bits) in Sage to verify some results produced by the high precision semidefinite program solver sdpa_gmp. Sage's treatment of real literals in these calculations has made me anxious about the possibility that I'm overlooking other ways in which the calculations might be unreliable.

Is there anywhere an explanation of Sage's treatment of real literals in high precision arithmetic?

thanks, Daniel Friedan

thanks for

adding real literal and real number of high precision

When Sage is adding a real literal to a real number of high precision, shouldn't it calculate the sum in the high precision ring? Instead, Sage seems to calculate in double precision:

RF=RealField(150); RF

Real Field with 150 bits of precision

RF(0.9 + RF(1e-18))

0.90000000000000002220446049250313080847263336

RF(1.0+ RF(1e-18))

1.0000000000000000000000000000000000000000000

RF(1+ RF(1e-18))

1.0000000000000000010000000000000000000000000

I'm trying to use high precision arithmetic (2658 bits) in Sage to verify some results produced by the high precision semidefinite program solver sdpa_gmp. Sage's treatment of real literals in these calculations has made me anxious about the possibility that I'm overlooking other ways in which the calculations might be unreliable.

Is there anywhere an explanation of Sage's treatment of real literals in high precision arithmetic?

Added: Immediately after posting this question, the list of Related Questions in the sidebar pointed me to question/327/set-global-precision-for-reals where I learned that 'RealNumber = RF' would make all real literals lie in the high precision ring. Still, I wonder why the default behavior is to discard precision that is present in the original real literal.

thanks, Daniel Friedan

thanks for