Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sagemath returns a very small number instead of 0 (sometimes)

Hello,

I am new to Sagemath. Today I used it as a calculator and found the following:

Input [1]: 14*1.2-16.8 Out [1]: 0.000000000000000

Input [2]: 12*1.4-16.8 Out [2]: -3.55271367880050e-15

Why is it that for 2 very similar calculations it returns once 0 (which is correct) and then an approximate version of 0? How can I avoid this approximate result to receive a more precise answer? Did I do something wrong, meaning should I specify something extra?

Note: I wanted to include a screen capture of this calculus but since I am a new user I was not yet allowed to include pictures.

Per advance thank you for your answer(s).

Kind Regards

Sagemath returns a very small number instead of 0 (sometimes)

Hello,

I am new to Sagemath. SageMath. Today I used it as a calculator and found the following:

Input

In  [1]: 14*1.2-16.8
14 * 1.2 - 16.8
Out [1]: 0.000000000000000

0.000000000000000

Input In [2]: 12*1.4-16.8 12 * 1.4 - 16.8 Out [2]: -3.55271367880050e-15

-3.55271367880050e-15

Why is it that for 2 two very similar calculations it returns once 0 0 (which is correct) and then an approximate version of 0? How How can I avoid this approximate result to receive a more precise precise answer? Did I do something wrong, meaning should I specify specify something extra?

Note: I wanted to include a screen capture of this calculus calculus but since I am a new user I was not yet allowed to include include pictures.

Per advance thank you for your answer(s).

Kind Regards

Sagemath returns a very small number instead of 0 (sometimes)

I am new to SageMath. Today I used it as a calculator and found the following:

In  [1]: 14 * 1.2 - 16.8
Out [1]: 0.000000000000000

In  [2]: 12 * 1.4 - 16.8
Out [2]: -3.55271367880050e-15

Why is it that for two very similar calculations it returns once 0 (which is correct) and then an approximate version of 0? How can I avoid this approximate result to receive a more precise answer? Did I do something wrong, meaning should I specify something extra?

Note: I wanted to include a screen capture of this calculus but since I am a new user I was not yet allowed to include pictures.