From c6a68a171a299f39a3bd577b085a38f65c7569ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Fri, 5 May 2023 09:08:02 +0200 Subject: Add uppcoming incompatibility note about matching +0.0 and -0.0 --- .../general_info/upcoming_incompatibilities.xml | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/system/doc/general_info/upcoming_incompatibilities.xml b/system/doc/general_info/upcoming_incompatibilities.xml index 04ab4459c0..4d31784f8d 100644 --- a/system/doc/general_info/upcoming_incompatibilities.xml +++ b/system/doc/general_info/upcoming_incompatibilities.xml @@ -53,6 +53,7 @@
+ Feature maybe_expr will be enabled by default

As of OTP 27, the maybe_expr feature will be approved @@ -119,6 +120,41 @@ the regular expression before matching with it.

+ +
+ + 0.0 and -0.0 will no longer be exactly equal + +

Currently, the floating point numbers 0.0 and -0.0 + have distinct internal representations. That can be seen if they are + converted to binaries:

+
+1> <<0.0/float>>.
+<<0,0,0,0,0,0,0,0>>
+2> <<-0.0/float>>.
+<<128,0,0,0,0,0,0,0>>
+ +

However, when they are matched against each other or compared + using the =:= operator, they are considered to be + equal. Thus, 0.0 =:= -0.0 currently returns + true.

+ +

In Erlang/OTP 27, 0.0 =:= -0.0 will return false, and matching + 0.0 against -0.0 will fail. When used as map keys, 0.0 and + -0.0 will be considered to be distinct.

+ +

The == operator will continue to return true + for 0.0 == -0.0.

+ +

To help to find code that might need to be revised, in OTP 27 + there will be a new compiler warning when matching against + 0.0 or comparing to that value using the =:= + operator. The warning can be suppressed by matching against + +0.0 instead of 0.0.

+ +

We plan to introduce the same warning in OTP 26.1, but by default it + will be disabled.

+
-- cgit v1.2.1