fix: add cpp::min in LdExpTest.h

Signed-off-by: Krishna Pandey <kpandey81930@gmail.com>
This commit is contained in:
Krishna Pandey 2025-08-21 05:22:19 +05:30
parent 49dc65d6fe
commit 2bf7920d79
No known key found for this signature in database
GPG Key ID: 20FD86C0096672D5
2 changed files with 10 additions and 2 deletions

View File

@ -2094,6 +2094,7 @@ add_fp_unittest(
LdExpTest.h
DEPENDS
libc.src.math.ldexp
libc.src.__support.CPP.algorithm
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
@ -2109,6 +2110,7 @@ add_fp_unittest(
LdExpTest.h
DEPENDS
libc.src.math.ldexpf
libc.src.__support.CPP.algorithm
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
@ -2124,6 +2126,7 @@ add_fp_unittest(
LdExpTest.h
DEPENDS
libc.src.math.ldexpl
libc.src.__support.CPP.algorithm
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
@ -2139,6 +2142,7 @@ add_fp_unittest(
LdExpTest.h
DEPENDS
libc.src.math.ldexpf16
libc.src.__support.CPP.algorithm
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
@ -2154,6 +2158,7 @@ add_fp_unittest(
LdExpTest.h
DEPENDS
libc.src.math.ldexpf128
libc.src.__support.CPP.algorithm
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
@ -2169,6 +2174,7 @@ add_fp_unittest(
LdExpTest.h
DEPENDS
libc.src.math.ldexpbf16
libc.src.__support.CPP.algorithm
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.bfloat16
libc.src.__support.FPUtil.fp_bits

View File

@ -10,6 +10,7 @@
#define LLVM_LIBC_TEST_SRC_MATH_LDEXPTEST_H
#include "hdr/stdint_proxy.h"
#include "src/__support/CPP/algorithm.h" // cpp::min
#include "src/__support/CPP/limits.h" // INT_MAX
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/NormalFloat.h"
@ -155,7 +156,8 @@ public:
// Start with a subnormal number but pass a very high number for exponent.
// The result should not be infinity.
x = NormalFloat(Sign::POS, -FPBits::EXP_BIAS + 1,
NormalFloat::ONE >> FPBits::FRACTION_LEN);
NormalFloat::ONE >>
LIBC_NAMESPACE::cpp::min(FPBits::FRACTION_LEN, 10));
exp = FPBits::MAX_BIASED_EXPONENT + 5;
ASSERT_FALSE(FPBits(func(x, exp)).is_inf());
// But if the exp is large enough to oversome than the normalization shift,