Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
decimal
#1
you can convert float to decimal but you can't divide a decimal by a float.  anyone know why that is?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
Why do you want to divide decimal to float? If you need a precision try gmpy2
https://gmpy2.readthedocs.io/en/latest/mpfr.html
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
just initializing some decimal.Decimal values and one of them needed to be a ratio of another, initially, and that ratio was a float even though its actual value was whole, initially, e,g rat = 5.0, so foo = foobar/rat failed and foo = foobar/decimal.Decimal(rat) got around it.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020