+ 2

What is the easiest way to calculate extremely precise?

I would like to compute my calculations as precise as possible, does anyone know a way to get much more preciese answers? Thank you very much.

17th Mar 2019, 1:31 PM
mij
mij - avatar
8 Réponses
+ 6
You can use decimal module from decimal import Decimal, getcontext getcontext().prec = 100 print(Decimal('2') ** Decimal('.5'))
17th Mar 2019, 3:33 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 3
With sympy module, you can use rational numbers, that is you can calculate with 3/7 or 31/32 etc without actually forcing the computer to round to a floating point precision.
17th Mar 2019, 6:38 PM
Tibor Santa
Tibor Santa - avatar
+ 3
Can you post your code? It returns 0.333... for both Decimal(1) / Decimal(3) and Decimal('1') / Decimal('3')
4th Apr 2019, 7:02 PM
Mert Yazıcı
Mert Yazıcı - avatar
0
believe me or not, only way to do this is only practising and more practising maths calculations as much difficult as possible
17th Mar 2019, 2:28 PM
Vintager
Vintager - avatar
0
I mean in python...
17th Mar 2019, 2:29 PM
mij
mij - avatar
0
Thank you so much! I haven't tested it yet becouse of an error (please check connection) but I will try when I can!
17th Mar 2019, 3:35 PM
mij
mij - avatar
0
Thank you so much it is very precise!
17th Mar 2019, 3:37 PM
mij
mij - avatar
0
Mert Yazici, I found that sollution online later but when I try it it says 1/3= 0.333333333333333333336135526153622836388 or something like that, and I would like something more accurate
4th Apr 2019, 6:52 PM
mij
mij - avatar