Skip to content

Commit 41eb938

Browse files
authored
Fix equal check in AOT XIP float cmp intrinsic (#1847)
1 parent 6c7ca90 commit 41eb938

2 files changed

Lines changed: 2 additions & 7 deletions

File tree

core/iwasm/aot/aot_intrinsic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ aot_intrinsic_f32_cmp(AOTFloatCond cond, float32 lhs, float32 rhs)
442442
{
443443
switch (cond) {
444444
case FLOAT_EQ:
445-
return (float32)fabs(lhs - rhs) <= WA_FLT_EPSILON ? 1 : 0;
445+
return lhs == rhs ? 1 : 0;
446446

447447
case FLOAT_LT:
448448
return lhs < rhs ? 1 : 0;
@@ -473,7 +473,7 @@ aot_intrinsic_f64_cmp(AOTFloatCond cond, float64 lhs, float64 rhs)
473473
{
474474
switch (cond) {
475475
case FLOAT_EQ:
476-
return fabs(lhs - rhs) <= WA_DBL_EPSILON ? 1 : 0;
476+
return lhs == rhs ? 1 : 0;
477477

478478
case FLOAT_LT:
479479
return lhs < rhs ? 1 : 0;

core/shared/utils/bh_platform.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,4 @@
3535
#define WA_FREE wasm_runtime_free
3636
#endif
3737

38-
/* The epsilon value is from https://www.cplusplus.com/reference/cfloat/ */
39-
40-
#define WA_FLT_EPSILON 1e-5f
41-
#define WA_DBL_EPSILON 1e-9
42-
4338
#endif /* #ifndef _BH_PLATFORM_H */

0 commit comments

Comments
 (0)