From e5abc35f2a4b4070759867ceeeb13c66890107cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Fank=20Thom=C3=A9?= Date: Sun, 4 Aug 2024 18:48:21 -0300 Subject: [PATCH] Try reduce min OTP version --- .github/workflows/ci.yml | 2 +- rebar.config | 2 +- src/euneus_encoder.erl | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf32e1d..907ca2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: strategy: matrix: - otp-version: [25, 26, 27] + otp-version: [24, 25, 26, 27] os: [ubuntu-24.04] steps: diff --git a/rebar.config b/rebar.config index b964aa2..930fdad 100644 --- a/rebar.config +++ b/rebar.config @@ -1,4 +1,4 @@ -{minimum_otp_vsn, "25"}. +%{minimum_otp_vsn, "25"}. {erl_opts, [ debug_info, diff --git a/src/euneus_encoder.erl b/src/euneus_encoder.erl index 8bee8d8..dc186f2 100644 --- a/src/euneus_encoder.erl +++ b/src/euneus_encoder.erl @@ -493,8 +493,13 @@ encode_term(Term, Encode, State) -> encode_integer(Int, _Encode, _State) -> erlang:integer_to_binary(Int, 10). +-if(?OTP_RELEASE >= 25). encode_float(Float, _Encode, _State) -> erlang:float_to_binary(Float, [short]). +-else. +encode_float(Float, _Encode, _State) -> + iolist_to_binary(io_lib_format:fwrite_g(Float)). +-endif. encode_atom(true, _Encode, _State) -> <<"true">>;