# Total term order

**URL:** <https://erlangforums.com/t/total-term-order/2477>\
**Category:** Proposals: RFC\
**Tags:** erlang\
**Created:** [March 20, 2023, 2:51pm UTC](https://erlangforums.com/t/total-term-order/2477 "2023-03-20T14:51:06Z")\
**Posts on this page:** 1\
**Showing post:** 41

<div class="post-metadata">

**Author:** ![nzok](https://erlangforums.com/letter_avatar_proxy/v4/letter/n/4af34b/32.png) [@nzok](https://erlangforums.com/u/nzok)\
**Post date:** [March 28, 2023, 4:18am UTC](https://erlangforums.com/t/total-term-order/2477/41 "2023-03-28T04:18:36Z")

</div>

First off, -0.0 =:= 0.0 coming out true is a BUG.  
It’s simply wrong behaviour.  
It is also a clear and blatant BUG that 0.0 = -0.0  
succeeds.

Erlang CAN distinguish these two numbers and DOES  
distinguish them. (Most obviously in term\_to\_binary/1  
and float\_to\_list/1, but there are others.)

It makes NO sense to appeal to the IEEE standard for  
floating-point arithmetic in a programming language  
that goes out of its way NOT to conform to that standard.  
Not just omitting IEEE _operations_ such as copysign(-,-)  
– and there is no shortage of other missing operations –  
but also in omitting IEEE-mandated required values.

The facth that _arithmetic_ comparison unifies 0.0, -0.0,  
and 0 is no reason why “exact equality” should do so,  
and certainly we’d have to regard any so-called total  
order on terms that made (or, right now, makes)

T1 =:= T2,

F(T1) =/= F(T2)  
come out true when F is a pure function, as badly broken.  
As missing half the POINT of “equality”. As making it  
harder to write correct code, for no advantage.

Arithmetic comparison SHOULD identify 0, 0.0, and -0.0  
Exact comparison and matching should NOT.

Consider this.  
f(X, X) → X.

> f(0.0, -0.0).

Will the answer be 0.0 or -0.0? Can you tell which without  
trying it? Is it obvious to you that it depends on the  
order of the arguments? Is clause matching _supposed_ to  
depend on the order of the arguments?

---

_[View the full topic](https://erlangforums.com/t/total-term-order/2477)._
