⎕JSON Comparaison Tolerance

General APL language issues

⎕JSON Comparaison Tolerance

Postby PGilbert on Mon Apr 13, 2020 9:16 pm

When I do the following:

Code: Select all
    ⎕JSON 0.04+⍳10
[1.04,2.04,3.04,4.04,5.04,6.04,7.04,8.039999999999999,9.039999999999999,10.04]


I would expect to get a 8.04 and 9.04 in the JSON character representation.

I am using v16. Is this normal ?
User avatar
PGilbert
 
Posts: 436
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Re: ⎕JSON Comparaison Tolerance

Postby petermsiegel on Tue Apr 14, 2020 5:09 am

Hmm.... In 17.1, it works as expected...
Code: Select all
⍝  Dyalog APL/S-64 Version 17.1.36845  (ALSO Dyalog APL/S-64 Version 17.0.36563)
       ⎕JSON 0.04+⍳10
[0.04,1.04,2.04,3.04,4.04,5.04,6.04,7.04,8.04,9.04]
petermsiegel
 
Posts: 142
Joined: Thu Nov 11, 2010 11:04 pm

Re: ⎕JSON Comparaison Tolerance

Postby AndyS|Dyalog on Thu Apr 16, 2020 8:52 am

In 16.0 the code for ⎕xml (and indeed ⎕csv) used the standard c library functions for formatting. In 17.0 and later we changed them so that they now call the same formatting functions as used elsewhere in the interpreter. So yes, it is what I'd expect in 16.0.
User avatar
AndyS|Dyalog
 
Posts: 257
Joined: Tue May 12, 2009 6:06 pm


Return to Language

Who is online

Users browsing this forum: No registered users and 1 guest