Ask Your Question

Revision history [back]

Problem with numpy integers and floats

1) 1st problem sage: a = np.int64(4343678784233766587) sage: b = np.int64(149) sage: a*b 1572096270996914903

the answer is wrong; it should be 647208138850831221463

1) 2nd problem And also: sage: a = np.int64(3344773437777732743) sage: b = np.int64(181) sage: a*b -3338562194645576845
the answer is negative, How Come ???

1) 3rd problem sage: a = np.float64(3344773437777732743) sage: b = np.float64(181) sage: a*b 6.0540399223776962e+20 #the exact answer is 605403992237769626483

Why doesn't it give me all the numbers instead of this e*20 ???

Thank you in advance.

Problem with numpy integers and floats

1) 1st problem sage: import numpy as np sage: a = np.int64(4343678784233766587) sage: b = np.int64(149) sage: a*b 1572096270996914903

the answer is wrong; it should be 647208138850831221463

1) 2nd problem And also: sage: a = np.int64(3344773437777732743) sage: b = np.int64(181) sage: a*b -3338562194645576845
the answer is negative, How Come ???

1) 3rd problem sage: a = np.float64(3344773437777732743) sage: b = np.float64(181) sage: a*b 6.0540399223776962e+20 #the exact answer is 605403992237769626483

Why doesn't it give me all the numbers instead of this e*20 ???

Moreover, i just used normal int of sage (<type 'sage.rings.integer.integer'=""> ) without using numpy and it works fine !!! Thank you in advance.

Problem with numpy integers and floats

1) 1st problem problem

sage: import numpy as np
sage: a = np.int64(4343678784233766587)
sage: b = np.int64(149)
sage: a*b
1572096270996914903

1572096270996914903

the answer is wrong; it should be 647208138850831221463

1) 2nd problem And also: problem

sage: a = np.int64(3344773437777732743)
sage: b = np.int64(181)
sage: a*b
-3338562194645576845 
-3338562194645576845

the answer is negative, How Come ???

1) 3rd problem problem

sage: a = np.float64(3344773437777732743)
sage: b = np.float64(181)
sage: a*b
6.0540399223776962e+20  #the exact answer is 605403992237769626483 

605403992237769626483

Why doesn't it give me all the numbers instead of this e*20 ???

Moreover, i just used normal int of sage (<type 'sage.rings.integer.integer'=""> (<type 'sage.rings.integer.Integer'> ) without using numpy and it works fine !!! Thank you in advance.