Mar-18-2019, 07:31 PM

a function i am writing will get a value that originates as a whole value and ONE digit past the decimal point. in this function, which may get the value as float, i need to determine which digit was the original value. direct comparison is unsafe due to the inexact representations most of these values will have (X.0 and X.5 are the values that can be represented exactly). i am looking for a way to convert the fractional value ranging from X.0 to X.9 into 0 to 9 (what the next part of the code will be working with). so i will not be doing comparisons like:

f,w = modf(number) if f == 0.0: n = 0 if f == 0.1: n = 1 if f == 0.2: n = 2 if f == 0.3: n = 3 if f == 0.4: n = 4 if f == 0.5: n = 5 if f == 0.6: n = 6 if f == 0.7: n = 7 if f == 0.8: n = 8 if f == 0.9: n = 9what would be the best way to do this, to get the original digit_after_the_point when it comes in the form of float.

Tradition is peer pressure from dead people

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

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