在 PDF 格式语法中,数字 1.e10 应该写成 10000000000。?

In PDF format syntax should number 1.e10 be written as 10000000000.?

正在查看 PDF Referene ver 1.7 关于 number 类型的对象如何 是根据它通知的有效语法编写的。

Note: PDF does not support the PostScript syntax for numbers with nondecimal radices (such as 16#FFFE ) or in exponential format (such as 6.02E23 ).

然而,它也没有规定数字的最大范围。这似乎表明写

是正确的

1.00E10 作为 10000000000

1.00E-50 作为 0.00000000000000000000000000000000000000000000000001

这个问题有两个方面:

首先,对于 PDF 的规范性信息,您应该参考相应的 ISO 标准,特别是 ISO 32000。是的,第 1 部分(ISO 32000-1)特别是从 PDF 参考 1.7 派生的,没有那么多变化,但也不是没有变化。 (好的,在某些情况下,还必须查阅旧的 PDF 参考资料才能了解其中的一些更改。)

Adobe 已在其网站上发布了一份副本(删除了页眉中的 "ISO"):https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf

现在回答你的问题:

根据 ISO 32000,第 1 部分和第 2 部分:

An integer shall be written as one or more decimal digits optionally preceded by a sign. [...]

A real value shall be written as one or more decimal digits with an optional sign and a leading, trailing, or embedded PERIOD (2Eh) (decimal point).

(第 7.3.3 节 "Numeric Objects")

因此,关于你的问题a)

is the notation correct (as provided in the examples?

是的,10000000000是一个整数值的数值对象,0.00000000000000000000000000000000000000000000000001是一个实数值的数值对象。

关于你的问题 b)

does pdf format expect implementations to use (or at least fall back to some bigint/bigfloat handling) of numbers, as it seems to not provide any range for the numbers?

不,在上面引用的同一部分中,您还可以找到

The range and precision of numbers may be limited by the internal representations used in the computer on which the conforming reader is running; Annex C gives these limits for typical implementations.

并且附件 C 推荐至少以下限制:

integer 2,147,483,647 Largest integer value; equal to 231 − 1.

integer -2,147,483,648 Smallest integer value; equal to −231

real ±3.403 × 1038 Largest and smallest real values (approximate).

real ±1.175 × 10-38 Nonzero real values closest to 0 (approximate). Values closer than these are automatically converted to 0.

real 5 Number of significant decimal digits of precision in fractional part (approximate).

(ISO 32000-1)

Integers Integer values (such as object numbers) can often be expressed within 32 bits.

Real numbers Modern computers often represent and process real numbers using IEEE Standard for Floating-Point Arithmetic (IEEE 754) single or double precision.

(ISO 32000-2)