-2

In python why result become zero when i multiply anyother value with 5.55375797812e+28 .
But we all Know Python accept a very big range value.

Ravi Singh
  • 93
  • 2
  • 12

1 Answers1

3

You can use the built-in decimal library.

import decimal

decimal.getcontext().prec = 46 # Change 46 to the precision you want.
result = decimal.Decimal(1.6) / decimal.Decimal(7)

print(result)
Decimal('0.2285714285714285841168345671446461762700762068')

Keep in mind that when you have to use the set precision you always need to enclose the number in decimal.Decimal() and you will always get Decimal() returned.

Ciprum
  • 734
  • 1
  • 11
  • 18