emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] float format specifier in ob-C.el


From: Leo Butler
Subject: [PATCH] float format specifier in ob-C.el
Date: Wed, 31 May 2023 15:36:58 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

In ob-C.el, line 339 has the format specifier

            (`floatp '("double" "%f"))

to print literal floats. However, that format specifier rounds, which
can result in errors. I think the correct approach is to print the
float without rounding or padding or trying to guess at the desired
accuracy (and let the compiler do whatever is needed):

           (`floatp '("double" "%s"))

Attached is a patch with a test that illustrates the problem (it fails
on HEAD but passes with the patch).

Leo



Attachment: 0001-On-ltb-ob-max-ob-C-float-format.patch
Description: 0001-On-ltb-ob-max-ob-C-float-format.patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]