Re: Value of floating in JSONValue

2014-08-22 Thread nrgyzer via Digitalmars-d-learn
On Thursday, 21 August 2014 at 23:29:56 UTC, Idan Arye wrote: On Thursday, 21 August 2014 at 23:05:48 UTC, Ali Çehreli wrote: I don't think it is a concern as JSON does not encode types. It is up to the receiver how to interpret the data. Here is the output of the program above:

Re: Value of floating in JSONValue

2014-08-22 Thread Nobody via Digitalmars-d-learn
On Thursday, 21 August 2014 at 18:53:08 UTC, nrgyzer wrote: Hi everyone, I'm facing a problem with the JSON functions. I've to communicate with another PC using JSON. Here's a simple snipped which shows my problem: import std.json; import std.stdio; void main() { double d =

Value of floating in JSONValue

2014-08-21 Thread nrgyzer via Digitalmars-d-learn
Hi everyone, I'm facing a problem with the JSON functions. I've to communicate with another PC using JSON. Here's a simple snipped which shows my problem: import std.json; import std.stdio; void main() { double d = 1.23456789; JSONValue j = d; sendToRemote(toJSON(j)); }

Re: Value of floating in JSONValue

2014-08-21 Thread Ali Çehreli via Digitalmars-d-learn
On 08/21/2014 11:53 AM, nrgyzer wrote: double d = 1.23456789; JSONValue j = d; sendToRemote(toJSON(j)); } My problem is that the remote PC receives 1.23457 instead of 1.23456789. I think it is due to the following code simply calling to!string in std/phobos/json.d:

Re: Value of floating in JSONValue

2014-08-21 Thread Idan Arye via Digitalmars-d-learn
On Thursday, 21 August 2014 at 23:05:48 UTC, Ali Çehreli wrote: I don't think it is a concern as JSON does not encode types. It is up to the receiver how to interpret the data. Here is the output of the program above: {value:1.234567889998901} Ali JSON may not encode the very specific