Eliminate the baroque floating-point operators a la !<>=
div0
div0 at users.sourceforge.net
Sun May 17 10:25:24 PDT 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Denis Koroskin wrote:
> On Sun, 17 May 2009 21:14:46 +0400, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
>
>> Hello,
>>
>>
>> I think the floating-point operators:
>>
>> a !<>= b
>> a !<> b
>> a <> b
>> a <>= b
>> a !> b
>> a !>= b
>> a !< b
>> a !<= b
>>
>> are useless. A simple peephole optimization in the compiler can
>> automatically rewrite NaN test followed by regular operations into the
>> operations above, for example:
>>
>> isNaN(a) || isNan(b) || a >= b
>>
>> is the same as
>>
>> a !< b
>>
>> This is in keeping with what the compiler does when seeing code like:
>>
>> a = x / y;
>> b = x % y;
>>
>> There's a peephole optimization that groups the / and the % together
>> into an assembler operation that does both. If this is the way to go, we
>> better be congruent and use explicit isNaN tests (that are then
>> optimized) instead of defining eight extra operators.
>>
>>
>> Andrei
>
> Does anyone other than Don uses them at all?
> I don't care if they are removed from D.
+vote
Me too. isNaN is a lot easier to read.
- --
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFKEEiET9LetA9XoXwRAiyPAJ9CaZhm8eLuvzwmbsGtDiboEzz+qACfR9kD
AvlFq15dYJO91X6vyLkvJMw=
=J5dd
-----END PGP SIGNATURE-----
More information about the Digitalmars-d
mailing list