Aug-05-2018, 01:37 AM
i have a floating point number that is a power (whole, perhaps negative, but not too extreme) of 2 and therefore can be represented in floating point exactly. an example of such a number is 2 to the -2 power which is 0.25. i might have other numbers, but the issue i am seeing is with those that are powers of 2. i also have a very large power of 10 such 10**32. typically i will have much larger but i picked 10**32 so the numbers i will show are not too long. if i have 0.125 and 10**32 and multiply them and convert back to int i am wanting to get 12500000000000000000000000000000 but the value i actually get is 12500000000000000670770275549184. the issue appears to be the int() conversion is working with a reduced number resolution that is unable to represent 1.25e-31 exactly (double in C on x86 can, even on 32 bit platforms), or is unable to represent a conversion temporary value exactly.
what i am looking for is a way to carry out the multiplication of a very large int to get a very large int by a float value that has an exact representation and get a "clean" result. one complication is that the original int number and expected result int number do not have exact representations in float (so doing it all in float isn't usable).
what i am looking for is a way to carry out the multiplication of a very large int to get a very large int by a float value that has an exact representation and get a "clean" result. one complication is that the original int number and expected result int number do not have exact representations in float (so doing it all in float isn't usable).
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.