Domanda

I have a routine that converts base10 to bas32 and what is interesting that when I double check some numbers using online conversion tools there seems to be an issue. Here are some numbers and the results of my conversion:

9990330227991015 = 8RU4S26R8F7
9990330227991016 = 8RU4S26R8F8
9990330227991017 = 8RU4S26R8F9

However, all 3 numbers using several online tools (such as http://www.unitconversion.org/numbers/base-10-to-base-32-conversion.html and http://www.kaagaard.dk/service/convert.htm) return 8RU4S26R8F8. I thought it might be the numbers length but the conversions do change if you go higher or lower.

Any ideas why this should be?

È stato utile?

Soluzione 2

It seems that the general consensus is that the online tools that I looked at are probably using real numbers rather than Int64. Using floating point numbers gives the incorrect results illustrated above.

Altri suggerimenti

It is funny that I have just found this post as I have just investigated this issue with the exact same numbers for our software developed in Delphi as a client was receiving the below after using our conversion tool:-

9990330227991015 = 8RU4S26R8F8
9990330227991016 = 8RU4S26R8F8
9990330227991017 = 8RU4S26R8F8

The online tools you refer to are incorrect for the same reason as our tool is incorrect, basically don't use a floating point, use a 64bit integer to handle large numbers more accurately..

A fix is about to be delivered to our Client...

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top