Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Conversion between RealField

I found the following behaviour very unintuitive :

R128=RealField(128)
pi_r128=R128.pi()

print pi_r128*2
print pi_r128*2.
print RR(pi)*2

The corresponding output is :

6.2831853071795864769252867665590057684
6.28318530717959
6.28318530717959

The first line was the expected behavior.

The second line was not expected because floating number 2. has the default precision contrary to pi_r128 whose is precision is wider. As the 3rd line shows, the 128 bit precision is completely ignored from pi_r128*2 calculation.

So I was wondering how conversion between RealField numbers was done.