Your question was unclear to me. All numbers are stored in base 2 on a computer. To create a number using base 2 notations you need to use "named arguments" as in

sage: RealNumber("10101e2", base=2)
84.0000000000000

sage: Rational("101/10010", base=2)
5/18

Vincent

On 04/11/2017 19:00, René Mérou wrote:

Hi all,

Can anyone explain how can I operate with floating numbers in base 2?

I want to have (1010-10)/10   and have one 1.010101010101010...  or
1.010101010101*2^0  or  if possible, to have 1.(01) a periodic number.

I know how to have it in base 10 and use str(2) to have the answer but i
would like to continue my work with the result as a number not as a string.

My tentatives:

Integer('1000',2)  goes well but just with integers

Rational('100.1',3)

TypeError: unable to convert '100.1' to a rational

Real('1.1',2)
NameError: name 'Real' is not defined

In a phrase, is there a way to operate directly with floating point or 
scientific numbers in base 2?


--
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.

Reply via email to