CI: Fix test_json failure on single-precision (float32)#2257
Merged
bettio merged 1 commit intoatomvm:release-0.7from Apr 4, 2026
Merged
CI: Fix test_json failure on single-precision (float32)#2257bettio merged 1 commit intoatomvm:release-0.7from
bettio merged 1 commit intoatomvm:release-0.7from
Conversation
bettio
approved these changes
Apr 4, 2026
Three JSON test suite cases (y_number, y_number_real_exponent, y_number_real_fraction_exponent) contain float values that exceed the IEEE 754 float32 range (~3.4e38), e.g. 1.23e67, 1.23e47, 1.23456e80. On AVM_USE_SINGLE_PRECISION builds, binary_to_float/1 calls strtof() which returns inf for these values, failing the isfinite() check and raising badarg. Skip these three test cases on single-precision builds by checking erlang:system_info(avm_floatsize) at runtime, following the existing pattern used in floatext.erl and other float-sensitive tests. And: Fix test_json encode test for single-precision float32 On float32 builds, 3.14 is stored as 3.1400001 (nearest IEEE 754 single-precision representation), so float_to_binary produces <<"3.1400001">> rather than <<"3.14">>. Use is_single_precision() to expect the correct output for each precision. Signed-off-by: Peter M <petermm@gmail.com>
bbf60d7 to
8e22ba5
Compare
bettio
approved these changes
Apr 4, 2026
bettio
added a commit
that referenced
this pull request
Apr 4, 2026
Merge fixes, features, and optimizations from release-0.7, including: - Add json module for estdlib and exavmlib (#2247) - Add timer:send_after/2,3 and apply_after/4 (#2228) - Add erlang:display_string/1,2 (#2251) - Add trim and list patterns to binary:split/2,3 (#2253) - Implement code:get_object_code/1 (#1864) - Add SPI support to RP2 platform (#2120) - JIT: add ARM32 backend (#2248) - JIT: add Thumb-2 variant for ARMv6-M backend (#2250) - Fix erlang:raise/3 assert with built stacktrace (#2252) - Fix test_json failure on single-precision float32 (#2257) - ESP32: Increase Erlang boot.avm partition to 512KB (#2254) - CI: Bump to OTP 28 and rebar3 3.25.1 (#2255)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three JSON test suite cases (y_number, y_number_real_exponent, y_number_real_fraction_exponent) contain float values that exceed the IEEE 754 float32 range (~3.4e38), e.g. 1.23e67, 1.23e47, 1.23456e80.
On AVM_USE_SINGLE_PRECISION builds, binary_to_float/1 calls strtof() which returns inf for these values, failing the isfinite() check and raising badarg.
Skip these three test cases on single-precision builds by checking erlang:system_info(avm_floatsize) at runtime, following the existing pattern used in floatext.erl and other float-sensitive tests.
These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later