diff options
author | Fredrik Gustafsson <[email protected]> | 2013-07-11 14:39:25 +0200 |
---|---|---|
committer | Fredrik Gustafsson <[email protected]> | 2013-07-11 14:39:25 +0200 |
commit | 193639fde33e135cc390f1df13076e5632fdd43c (patch) | |
tree | ff96600d3421002a8754875b9fd1d6b55a25f290 /lib | |
parent | 15874f5848bb4686b1ab1986adc2e8c366492a4d (diff) | |
parent | 9e45648698862905561baa533831afd4dd23a02a (diff) | |
download | otp-193639fde33e135cc390f1df13076e5632fdd43c.tar.gz otp-193639fde33e135cc390f1df13076e5632fdd43c.tar.bz2 otp-193639fde33e135cc390f1df13076e5632fdd43c.zip |
Merge branch 'jw/fix-float-middle-endian/OTP-11201' into maint
* jw/fix-float-middle-endian/OTP-11201:
Fix binary construction on floating point middle-endian machines
Fix binary matching on floating point middle-endian machines
Fix erlang:phash2() on floating point middle-endian machines
Fix external term format BIFs on floating point middle-endian machines
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compiler/test/bs_construct_SUITE.erl | 2 | ||||
-rw-r--r-- | lib/debugger/test/bs_construct_SUITE.erl | 2 | ||||
-rw-r--r-- | lib/debugger/test/bs_match_misc_SUITE.erl | 11 |
3 files changed, 13 insertions, 2 deletions
diff --git a/lib/compiler/test/bs_construct_SUITE.erl b/lib/compiler/test/bs_construct_SUITE.erl index 4ea5235bb6..ce39de2a82 100644 --- a/lib/compiler/test/bs_construct_SUITE.erl +++ b/lib/compiler/test/bs_construct_SUITE.erl @@ -319,6 +319,8 @@ in_guard(Config) when is_list(Config) -> ?line 1 = in_guard_1(<<16#74ad:16>>, 16#e95, 5), ?line 2 = in_guard_1(<<16#3A,16#F7,"hello">>, 16#3AF7, <<"hello">>), ?line 3 = in_guard_1(<<16#FBCD:14,3.1415/float,3:2>>, 16#FBCD, 3.1415), + ?line 3 = in_guard_1(<<16#FBCD:14,3/float,3:2>>, 16#FBCD, 3), + ?line 3 = in_guard_1(<<16#FBCD:14,(2 bsl 226)/float,3:2>>, 16#FBCD, 2 bsl 226), ?line nope = in_guard_1(<<1>>, 42, b), ?line nope = in_guard_1(<<1>>, a, b), ?line nope = in_guard_1(<<1,2>>, 1, 1), diff --git a/lib/debugger/test/bs_construct_SUITE.erl b/lib/debugger/test/bs_construct_SUITE.erl index e0bda7eac8..4870c87d74 100644 --- a/lib/debugger/test/bs_construct_SUITE.erl +++ b/lib/debugger/test/bs_construct_SUITE.erl @@ -454,6 +454,8 @@ in_guard(Config) when is_list(Config) -> ?line 1 = in_guard(<<16#74ad:16>>, 16#e95, 5), ?line 2 = in_guard(<<16#3A,16#F7,"hello">>, 16#3AF7, <<"hello">>), ?line 3 = in_guard(<<16#FBCD:14,3.1415/float,3:2>>, 16#FBCD, 3.1415), + ?line 3 = in_guard(<<16#FBCD:14,3/float,3:2>>, 16#FBCD, 3), + ?line 3 = in_guard(<<16#FBCD:14,(2 bsl 226)/float,3:2>>, 16#FBCD, 2 bsl 226), nope = in_guard(<<1>>, 42, b), nope = in_guard(<<1>>, a, b), nope = in_guard(<<1,2>>, 1, 1), diff --git a/lib/debugger/test/bs_match_misc_SUITE.erl b/lib/debugger/test/bs_match_misc_SUITE.erl index 6b66c45448..54fa9a59df 100644 --- a/lib/debugger/test/bs_match_misc_SUITE.erl +++ b/lib/debugger/test/bs_match_misc_SUITE.erl @@ -26,7 +26,7 @@ kenneth/1,encode_binary/1,native/1,happi/1, size_var/1,wiger/1,x0_context/1,huge_float_field/1, writable_binary_matched/1,otp_7198/1, - unordered_bindings/1]). + unordered_bindings/1,float_middle_endian/1]). -include_lib("test_server/include/test_server.hrl"). @@ -36,7 +36,7 @@ all() -> [bound_var, bound_tail, t_float, little_float, sean, kenneth, encode_binary, native, happi, size_var, wiger, x0_context, huge_float_field, writable_binary_matched, - otp_7198, unordered_bindings]. + otp_7198, unordered_bindings, float_middle_endian]. groups() -> []. @@ -106,6 +106,13 @@ t_float(Config) when is_list(Config) -> ok. +float_middle_endian(Config) when is_list(Config) -> + F = 9007199254740990.0, % turns to -NaN when word-swapped + ?line fcmp(F, match_float(<<F:64/float>>, 64, 0)), + ?line fcmp(F, match_float(<<1:1,F:64/float,127:7>>, 64, 1)), + ?line fcmp(F, match_float(<<1:13,F:64/float,127:3>>, 64, 13)), + ok. + fcmp(F1, F2) when (F1 - F2) / F2 < 0.0000001 -> ok. |