We describe various issues caused by the lack of round-to-nearest mode in the \textit{gcc} compiler implementation of the fixed-point arithmetic data types and operations. We demonstrate that round-to-nearest is not performed in the conversion of constants, conversion from one numerical type to a less precise type and results of multiplications. Furthermore, we show that mixed-precision operations in fixed-point arithmetic lose precision on arguments, even before carrying out arithmetic operations. The ISO 18037:2008 standard was created to standardize C language extensions, including fixed-point arithmetic, for embedded systems. Embedded systems are usually based on ARM processors, of which approximately 100 billion have been manufactured by now. Therefore, the observations about numerical issues that we discuss in this paper can be rather dangerous and are important to address, given the wide ranging type of applications that these embedded systems are running.
翻译:我们描述了在固定点算数据类型和操作的编译器实施过程中缺乏圆到最接近模式造成的各种问题。我们证明,在转换常数、从一个数字类型转换到一个不太精确的类型和乘法结果时,没有进行圆到最接近的计算方法。此外,我们表明,固定点算术的混合精度操作甚至在进行算术操作之前就失去了对参数的精确度。ISO 18037:2008标准是用来规范嵌入系统的C语言扩展,包括固定点算术的。嵌入式系统通常以ARM处理器为基础,其中大约1,000亿个已经制造出来。因此,我们在本文件中讨论的数字问题观察可能相当危险,并且非常重要,因为这些嵌入系统正在运行的广泛应用类型。