Float with higher accuracy in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Float with higher accuracy in python

Hi I have a string which need to be converted to number. I need with proper accuracy as float does not work for me. Which data type has more accuracy than float. https://sololearn.com/compiler-playground/cmJIXfslPnQF/?ref=app

20th Feb 2024, 5:20 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
2 Answers
+ 12
The next level of precision comes by using Decimal. from decimal import Decimal a = Decimal('1.1234567890123456789')
20th Feb 2024, 5:44 PM
Brian
Brian - avatar
+ 3
Thank you 😊
20th Feb 2024, 6:01 PM
Ketan Lalcheta
Ketan Lalcheta - avatar