Skip to main content
added 153 characters in body
Source Link
phils
  • 53k
  • 3
  • 84
  • 127

Emacs supports bignums, but presumably libjansson does not, and (and json-parse-buffer is handing off to that C library to do the heavy lifting). There seems to be an upstream issue for that:
https://github.com/akheron/jansson/issues/69

The documentation for the current implementation is:
https://jansson.readthedocs.io/en/latest/conformance.html#numbers

From those docs, you'reyou are limited to either restricted to long or long long integers, depending on the compiler which built the library. A long will be a minimum of 32-bits, and a long long will be a minimum of 64-bits.

I would expect that you're dealing with the latter, and my impression is that a long long tends to be no more than 64-bits, so that's (probably) a maximum of 18446744073709551615 unsigned, or 9223372036854775807 signed (and looking at your data, it's not a coincidence that your example failure is 1 higher than that number).

The older elisp-only (json-read) is happy reading that file, FYI.

(require 'json)
(url-handler-mode 1)
(json-read-file "https://raw.githubusercontent.com/exercism/problem-specifications/f771129746264394c20d3c59ba5053acb9de5f86/exercises/grains/canonical-data.json")

That even works in Emacs 26 (i.e. without bignum support), although in that case numbers larger than most-positive-fixnum are converted to floats.

Emacs supports bignums, but presumably libjansson does not, and json-parse-buffer is handing off to that C library to do the heavy lifting.

https://jansson.readthedocs.io/en/latest/conformance.html#numbers

From those docs, you're either restricted to long or long long integers, depending on the compiler which built the library. A long will be a minimum of 32-bits, and a long long will be a minimum of 64-bits.

I would expect that you're dealing with the latter, and my impression is that a long long tends to be no more than 64-bits, so that's (probably) a maximum of 18446744073709551615 unsigned, or 9223372036854775807 signed (and looking at your data, it's not a coincidence that your example failure is 1 higher than that number).

The older elisp-only (json-read) is happy reading that file, FYI.

(require 'json)
(url-handler-mode 1)
(json-read-file "https://raw.githubusercontent.com/exercism/problem-specifications/f771129746264394c20d3c59ba5053acb9de5f86/exercises/grains/canonical-data.json")

That even works in Emacs 26 (i.e. without bignum support), although in that case numbers larger than most-positive-fixnum are converted to floats.

Emacs supports bignums, but presumably libjansson does not (and json-parse-buffer is handing off to that C library to do the heavy lifting). There seems to be an upstream issue for that:
https://github.com/akheron/jansson/issues/69

The documentation for the current implementation is:
https://jansson.readthedocs.io/en/latest/conformance.html#numbers

From those docs, you are limited to either to long or long long integers, depending on the compiler which built the library. A long will be a minimum of 32-bits, and a long long will be a minimum of 64-bits.

I would expect that you're dealing with the latter, and my impression is that a long long tends to be no more than 64-bits, so that's (probably) a maximum of 18446744073709551615 unsigned, or 9223372036854775807 signed (and looking at your data, it's not a coincidence that your example failure is 1 higher than that number).

The older elisp-only (json-read) is happy reading that file, FYI.

(require 'json)
(url-handler-mode 1)
(json-read-file "https://raw.githubusercontent.com/exercism/problem-specifications/f771129746264394c20d3c59ba5053acb9de5f86/exercises/grains/canonical-data.json")

That even works in Emacs 26 (i.e. without bignum support), although in that case numbers larger than most-positive-fixnum are converted to floats.

added 437 characters in body
Source Link
phils
  • 53k
  • 3
  • 84
  • 127

Emacs supports bignums, but presumably libjansson does not, and json-parse-buffer is handing off to that C library to do the heavy lifting.

https://jansson.readthedocs.io/en/latest/conformance.html#numbers

MyFrom those docs, you're either restricted to long or long long integers, depending on the compiler which built the library. A long will be a minimum of 32-bits, and a long long will be a minimum of 64-bits.

I would expect that you're dealing with the latter, and my impression is that a long long tendstends to be no more than 64-bits, so that's (probably) a maximum of 18446744073709551615 unsigned, or 9223372036854775807 signed (and I imaginelooking at your data, it's not a coincidence that your example failure is 1 higher than that? number).

The older elisp-only (json-read) is happy reading that file, FYI.

(require 'json)
(url-handler-mode 1)
(json-read-file "https://raw.githubusercontent.com/exercism/problem-specifications/f771129746264394c20d3c59ba5053acb9de5f86/exercises/grains/canonical-data.json")

That even works in Emacs 26 (i.e. without bignum support), although in that case numbers larger than most-positive-fixnum are converted to floats.

Emacs supports bignums, but presumably libjansson does not, and json-parse-buffer is handing off to that C library to do the heavy lifting.

https://jansson.readthedocs.io/en/latest/conformance.html#numbers

My impression is that a long long tends to be 64-bits, so that's (probably) a maximum of 18446744073709551615 unsigned, or 9223372036854775807 signed (and I imagine it's not a coincidence that your example failure is 1 higher than that?)

The older elisp-only (json-read) is happy reading that file, FYI.

(url-handler-mode 1)
(json-read-file "https://raw.githubusercontent.com/exercism/problem-specifications/f771129746264394c20d3c59ba5053acb9de5f86/exercises/grains/canonical-data.json")

Emacs supports bignums, but presumably libjansson does not, and json-parse-buffer is handing off to that C library to do the heavy lifting.

https://jansson.readthedocs.io/en/latest/conformance.html#numbers

From those docs, you're either restricted to long or long long integers, depending on the compiler which built the library. A long will be a minimum of 32-bits, and a long long will be a minimum of 64-bits.

I would expect that you're dealing with the latter, and my impression is that a long long tends to be no more than 64-bits, so that's (probably) a maximum of 18446744073709551615 unsigned, or 9223372036854775807 signed (and looking at your data, it's not a coincidence that your example failure is 1 higher than that number).

The older elisp-only (json-read) is happy reading that file, FYI.

(require 'json)
(url-handler-mode 1)
(json-read-file "https://raw.githubusercontent.com/exercism/problem-specifications/f771129746264394c20d3c59ba5053acb9de5f86/exercises/grains/canonical-data.json")

That even works in Emacs 26 (i.e. without bignum support), although in that case numbers larger than most-positive-fixnum are converted to floats.

added 6 characters in body
Source Link
phils
  • 53k
  • 3
  • 84
  • 127

Emacs supports bignums, but presumably libjansson does not, and json-parse-buffer is handing off to that C library to do the heavy lifting.

https://jansson.readthedocs.io/en/latest/conformance.html#numbers

My impression is that a long long tends to be 64-bits, which would beso that's (probably) a maximum of 18446744073709551615 unsigned, or 9223372036854775807 signed (and I imagine it's not a coincidence that your example failure is 1 higher than that?)

The older elisp-only (json-read) is happy reading that file, FYI.

(url-handler-mode 1)
(json-read-file "https://raw.githubusercontent.com/exercism/problem-specifications/f771129746264394c20d3c59ba5053acb9de5f86/exercises/grains/canonical-data.json")

Emacs supports bignums, but presumably libjansson does not, and json-parse-buffer is handing off to that C library to do the heavy lifting.

https://jansson.readthedocs.io/en/latest/conformance.html#numbers

My impression is that a long long tends to be 64-bits, which would be a maximum of 18446744073709551615 unsigned, or 9223372036854775807 signed (and I imagine it's not a coincidence that your example failure is 1 higher than that?)

The older elisp-only (json-read) is happy reading that file, FYI.

(url-handler-mode 1)
(json-read-file "https://raw.githubusercontent.com/exercism/problem-specifications/f771129746264394c20d3c59ba5053acb9de5f86/exercises/grains/canonical-data.json")

Emacs supports bignums, but presumably libjansson does not, and json-parse-buffer is handing off to that C library to do the heavy lifting.

https://jansson.readthedocs.io/en/latest/conformance.html#numbers

My impression is that a long long tends to be 64-bits, so that's (probably) a maximum of 18446744073709551615 unsigned, or 9223372036854775807 signed (and I imagine it's not a coincidence that your example failure is 1 higher than that?)

The older elisp-only (json-read) is happy reading that file, FYI.

(url-handler-mode 1)
(json-read-file "https://raw.githubusercontent.com/exercism/problem-specifications/f771129746264394c20d3c59ba5053acb9de5f86/exercises/grains/canonical-data.json")
deleted 49 characters in body
Source Link
phils
  • 53k
  • 3
  • 84
  • 127
Loading
deleted 49 characters in body
Source Link
phils
  • 53k
  • 3
  • 84
  • 127
Loading
Source Link
phils
  • 53k
  • 3
  • 84
  • 127
Loading