| 1 | initial version |
To get the binary representation just add a .str(base=2) to the approximated value.
sage: a = pi + sqrt(2)
sage: a.n(digits=60).str(base=2)
'100.1000111001001001010100001111000010'
| 2 | No.2 Revision |
To get the binary representation just add a .str(base=2) to the approximated value.
sage: a = pi + sqrt(2)
sage: a.n(digits=60).str(base=2)
'100.1000111001001001010100001111000010'
For the other direction the method RR is useful. Given as first Argument the string and as second the base.
sage: s= a.n(digits=60).str(base=2)
sage: RR(s,2)
4.55580621596289
| 3 | No.3 Revision |
To get the binary representation just add a .str(base=2) to the approximated value.
sage: a = pi + sqrt(2)
sage: a.n(digits=60).str(base=2)
'100.1000111001001001010100001111000010'
For the other direction the method RR is useful. Given as first Argument argument the string and as second the base.
sage: s= a.n(digits=60).str(base=2)
sage: RR(s,2)
4.55580621596289
| 4 | No.4 Revision |
To get the binary representation just add a .str(base=2) to the approximated value.
sage: a = pi + sqrt(2)
sage: a.n(digits=60).str(base=2)
a.n(digits=10).str(base=2)
'100.1000111001001001010100001111000010'
For the other direction the method RR is useful. Given as first argument the string and as second the base.
sage: s= a.n(digits=60).str(base=2)
sage: RR(s,2)
4.55580621596289
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.