Re: [RFC brainstorm] Approximately equals operator

From: Date: Wed, 02 Apr 2025 06:11:17 +0000
Subject: Re: [RFC brainstorm] Approximately equals operator
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
I love April Fools jokes.

Yes, and let's add the null coalescing increment and decrement operators:
$foo??++ and $bar??-- .  I want to ensure that an undeclared or null
variable defaults to 0 before becoming 1  or -1 without needing to manually
instantiate the variable as 0.

Pfft.
---

Anyhow, why wouldn't rounding precision be decided by the precision of the
float/integer with the lesser precision?

1.  1.55 ~= 1.5499 // true (because rounding 1.5499 to 2 decimal places is
1.55)

2.  3.1415 ~= 3.141 // false (because rounding 3.1415 to three decimal
places is 3.142)

3. 1000 ~= 999.50000001 // true (rounding to integer comparison)

mickmackusa


Thread (17 messages)

« previous php.internals (#127023) next »