gbranden pushed a commit to branch master
in repository groff.
commit c9cbe4ba3cd3d44b7e1535fd5de987013fd302a6
Author: Dave Kemper <[email protected]>
AuthorDate: Mon Jun 16 05:56:45 2025 +0000
[troff]: Fix Savannah #67219.
* src/roff/troff/env.cpp (distribute_space): Fix expression involving
C++ `static_cast<>` operator to stop permitting integer division
within, leading to undesired loss of precision when reporting the
amount of "spread" applied when performing adjustment, as configured
by the `spreadwarn` request.
Fixes <https://savannah.gnu.org/bugs/?67219>. [Problem introduced by
me in commit 8b6ccbce48, 13 May. --GBR]
---
ChangeLog | 11 +++++++++++
src/roff/troff/env.cpp | 4 ++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3af55211c..a69f5d51f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2025-06-16 Dave Kemper <[email protected]>
+
+ * src/roff/troff/env.cpp (distribute_space): Fix expression
+ involving C++ `static_cast<>` operator to stop permitting
+ integer division within, leading to undesired loss of precision
+ when reporting the amount of "spread" applied when performing
+ adjustment, as configured by the `spreadwarn` request.
+
+ Fixes <https://savannah.gnu.org/bugs/?67219>. [Problem
+ introduced by me in commit 8b6ccbce48, 13 May. --GBR]
+
2025-06-19 G. Branden Robinson <[email protected]>
* tmac/tests/an-ext_SY-and-YS-work.sh: Use printf(1), not
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 5f607c6aa..f74d8ba98 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2239,8 +2239,8 @@ static bool distribute_space(node *nd, int nspaces,
if (!force_reverse_node_list && spread_limit >= 0
&& desired_space.to_units() > 0) {
hunits em = curenv->get_size();
- double Ems = static_cast<double>(desired_space.to_units() / nspaces
- / (em.is_zero() ? hresolution : em.to_units()));
+ double Ems = static_cast<double>(desired_space.to_units()) / nspaces
+ / (em.is_zero() ? hresolution : em.to_units());
if (Ems > spread_limit)
output_warning(WARN_BREAK, "spreading %1m per space", Ems);
}
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit