[LTP] [PATCH] float_exp_log: Fix ldexp exponents written by genldexp
Jan Stancek
jstancek@redhat.com
Mon Oct 19 14:34:21 CEST 2026
genldexp stores the ldexp() exponents in a double array but writes
only sizeof(int) bytes of each element to ildexp_inp.ref. For a double
holding a small integer the low 32 bits of the IEEE-754 encoding are
zero, so on little-endian every exponent read back by the test is 0 and
ldexp(x, 0) == x is the only thing float_exp_log ever checks. On
big-endian the exponents are garbage from the high word instead.
Declare the exponent array as int so the intended 20000..1 exponents
are written and the ldexp threads exercise real scaling. Large exponents
overflow to inf for both the generated and computed value, which
check_error() already treats as equal.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
testcases/misc/math/float/exp_log/genldexp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/testcases/misc/math/float/exp_log/genldexp.c b/testcases/misc/math/float/exp_log/genldexp.c
index fc81c9efa648..98a28edec3e7 100644
--- a/testcases/misc/math/float/exp_log/genldexp.c
+++ b/testcases/misc/math/float/exp_log/genldexp.c
@@ -102,8 +102,8 @@ static int create_Result_file(void)
static int create_Data_file(void)
{
- int i, nbVal;
- double tabDD[20000], tabDI[20000], Inc;
+ int i, nbVal, tabDI[20000];
+ double tabDD[20000], Inc;
char *F_named, *F_namei;
int fp, fpi;
--
2.56.0
More information about the ltp
mailing list