Quick question regarding asvalue/asstring, maybe a bug?

Okay, already posted this in a different thread months ago, but my v4 vocabulary wasn’t good enough to bring my point across, so…

i may have found a bug, maybe it’s a feature, i don’t know.

The thing is:
When you have a (really big) String and want to convert it to a (really big) value, the IO Box automatically displays a small float number with it’s exponents. When you convert that back to string you get a different string because of that.

(IOBoxString (i.E: 12345678901234567890) -> AsValue -> AsString (String is now: 1.234567890123457E0019)

I think the patch explains it better than I did :-)

so my question is: is this working as intended? If so, is there a workaround?


asvalue_asstring.v4p (6.1 kB)

The notation is correct I guess and I would say that it might be annoying to work with if you want all the digits as a string, but more worrying is that it has been rounded wrongly as far as I can tell:

on my screen it shows:


being turned into:


shouldn’t it be turned into (Compare the last digit before E):


if I remember the rules of rounding numbers correctly.

this is a problem of number spaces. all vvvv numbers are double values. what you put into the IOBox is an integer, which btw is bigger then the maximum integer with 32-bit that is 2,147,483,647. i think a 64-bit integer is capable of holding the value: 9,223,372,036,854,775,807

the vvvv numbers however are double precision floating point numbers and have a different way to store a value (with an exponent). the max values is 1.7976931348623157E308 which is super high but the difference is the precision. its usually around 14-16 significant digits. so as soon as your number was converted to a double some digits got lost. its then only the nearest possible value, which is the one you see.

most high integer values have no exact representation in the floating point number system of computers.