Closed motiejus closed 11 years ago
Hi,
I am playing with a number slightly more than 2^63:
> math:log(9223653511831486465) / math:log(2). 63.00004402688683
Let's try it out:
$ echo "{\"value\":9223372036854841345}" | piqi convert -f json -t piq --type uint64-fixed :uint64-fixed 65537 $ echo "{\"value\":9223372036854841345}" | piqi convert -f json -t piq --type uint64 :uint64 65537
I expect it to return 9223372036854841345. Same problem the other way around (piq -> json).
With google protocol buffers it appears to work (tested from Erlang):
$ cat t1.piqi .alias [ .name gid1 .type uint64-fixed ] .alias [ .name gid2 .type uint64 ]
19> t_piqi:parse_gid2(t_piqi:gen_gid2(9223653511831486465, json), json). 65537 20> t_piqi:parse_gid1(t_piqi:gen_gid1(9223653511831486465, json), json). 1 21> t_piqi:parse_gid1(iolist_to_binary(t_piqi:gen_gid1(9223653511831486465))). 9223653511831486465 22> t_piqi:parse_gid2(iolist_to_binary(t_piqi:gen_gid2(9223653511831486465))). 9223653511831486465
Hey Motiejus, thank you for reporting this! awkward bug... It was in generated code and I was pretty sure I got it right when I first wrote this piece. Will be making a new release soon.
Hi,
I am playing with a number slightly more than 2^63:
Let's try it out:
I expect it to return 9223372036854841345. Same problem the other way around (piq -> json).
With google protocol buffers it appears to work (tested from Erlang):