pdfkit/lib/utils.js
Jake Holland 40a0f383a7
Fix precision rounding issues in LineWrapper (#1583)
Handle JS quirks with large decimal precision checks resulting from the calculations of next lines in the LineWrapper
2025-01-11 13:16:17 +01:00

7 lines
197 B
JavaScript

export function PDFNumber(n) {
// PDF numbers are strictly 32bit
// so convert this number to the nearest 32bit number
// @see ISO 32000-1 Annex C.2 (real numbers)
return Math.fround(n);
}