Bit stuck on something I thought was small but am now begining to think is very big (reading this http://cycling74.com/forums/topic.php?id=24639 has simply confused me). I’m download some GPS coordinates from a txt file online, storing in jit.textfile and then pulling out via jit.str.tosymbol. Nothing complex so far but my numbers get chopped after 6 decimal places. How do I get around this as obviously the end of the GPS coordinates are important for precision?

Thanks in advance

Garrett

– Pasted Max Patch, click to expand. –

]]>
32-bit floating point means a mantissa of effectively 24 bits, or about six digits accuracy. Period.

How to get around this? Well, if you need to work with numerical values, you don’t. If you don’t need arithmetic calculations, you can probably whip something up with jit.str.regexp that will convert the individual GPS coordinates into Max symbols.

It’s hard to say more without knowing what you’re trying to achieve.

]]>Thanks for clarifying that in max directly its just not possible and giving ways forward. I’m using the coordinates to move something in a 3d space so I’ll be mapped the GPS to that. I’m not working quite with -1.0 to 1.0 coordinate system it’s more like -100 to 100 but the suggestion in that other thread of multipling it up (it looks like I’ll need 100000 but I need to check the GPS spec to see how far after the decimal place is something like tens of metres) is possible.

so something like:

51.48642623333333 * 100000 = 5148642.623333333

everything left of 42 can be dumped

anyway javascript seems like a quick way forward so I’m going to attempt that. Can a js object take the number straight from the jit.textfile?

Garrett

]]>might be useful. I had a tough time dealing with this in a project for astronomical positioning where more than 6 places was needed (storing them in [text] and/or [coll]). This took some experimenting to get to…

I think you’ll need to utilize [tosymbol] and [fromsymbol] somewhere. I can’t recall whether this approach actually worked in the end. Possibly it was just to format for another program like Excel, in which case it wouldn’t help (32-bit limit as mentioned…)

Aren’t there 64-bit externals for high precision available? Or maybe you can use a float64 matrix for storing and manipulation.

]]>