Juris-M / citeproc-js

A JavaScript implementation of the Citation Style Language (CSL) https://citeproc-js.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Long page number slightly different when rendered through Zotero

wmhorne opened this issue · comments

Summary: When rendered through Zotero, a work's long page number has a different final digit.

Problem

I'm citing a reference that includes a long page number, 23094990211003347. The reference info looks like this in Zotero:

Screen Shot 2021-12-09 at 4 11 47 PM

When looking at the reference that's generated using csl, however, this page number ends up being slightly different.

It's 23094990211003348, as opposed to 23094990211003347:

Screen Shot 2021-12-09 at 4 10 00 PM

This appears to be true across styles:

Screen Shot 2021-12-09 at 4 10 36 PM

Screen Shot 2021-12-09 at 4 15 17 PM

This also appears to be true regardless of the specific final digit:
Screen Shot 2021-12-09 at 4 18 44 PM

Screen Shot 2021-12-09 at 4 19 14 PM

Somewhere in the process the page number is converted to a (double-precision) floating-point number, and this page number is too large to represent accurately. It seems to also happen when the page has a non-numeric prefix (e23094990211003347).

if (num.value.match(/^[1-9][0-9]*$/)) {
blob = new CSL.NumericBlob(state, num.particle, parseInt(num.value, 10), numStyling, itemID);
} else {
blob = new CSL.NumericBlob(state, num.particle, num.value, numStyling, itemID);
}