Monte Goulding's day off? ; -) mergJSON - Documented Bug or Feature?

Mike Kerner MikeKerner at roadrunner.com
Wed Jun 29 08:20:29 EDT 2016


What makes you think the problem is in the library and not in LC, itself?

On Wed, Jun 29, 2016 at 7:22 AM, Lagi Pittas <iphonelagi at gmail.com> wrote:

> Hi,
>
> I used the mergJSON in version 8 DP1 today for the first time.
> I loaded my CSV file into the program and build my arrays then exported the
> array as JSON.
>
> what do I find?
>
> prices that were 1.40 showing up as 1.3999999999999999,  2.30 showing as
> 2.2999999999999998 etc
>
> Now I know this is documented as anything that looks like a real number is
> stored as an IEEE 754 double.
>
>
> Can someone please explain the logic that says that a textual
> representation of information (CSV, XML a text file even) is translated to
> a IEEE number for us to round as we see fit?
>
> Please explain any cases where this makes any sense at all.
>
> if I wanted the number to be 1.399999 thats what I would put in there.
>
> Now the documentation says round it to the precision you want - it already
> is otherwise it wouldn't be in the CSV/JSON file if it was wrong in the
> first place.
>
> Anyone got any thoughts on this?
>
> Monte as much as I respect your programming prowess I respectfully think
> you are wrong on this one - it has to be more coding to do it this way than
> to leave it as text - or am I missing something.
>
> Shouldn't there be a parameter that asks if we want this (with false as the
> default?) as per the pretty print which works brilliantly by the way -
> perfect in fact.
>
> I wrote a JSON library for Visual foxpro a couple of years ago and the only
> change it made was if there was an integer of say 1 or 2 it would change it
> to 1.0 or 2.0 because Foxpro itself reads any numbers from a file as Real
> rather than integer but the actual value is still the same 1.0 is 1. I
> could have coded against that but it would have been a bit convoluted and
> would have slowed the system down so I left it as is.
>
> KIndest Regards Lagi
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."



More information about the use-livecode mailing list