Implementing Half Floats in D
bearophile
bearophileHUGS at lycos.com
Mon Jan 28 16:44:20 PST 2013
Walter Bright:
> http://www.drdobbs.com/cpp/implementing-half-floats-in-d/240146674
From the article:
>Built-in types tend to run faster because the optimizer can take
>advantage of mathematical identities,<
Generally in D we like the compiler to verify user-applied
annotations like pure and const. For the compiler of a normal
language today it's probably too much difficult to prove the
theorems coming from those identities on user defined types. But
if the compiler assumes the programmer to be right on this
(because such types are usually defined in well reviewed
libraries), then I think it's not too much hard to invent a small
set of @annotations that attached to a user defined struct tell
the compiler to allow some optimizations typical of integral
numbers, floating point numbers, complex numbers, gaussian
integers, quaternions, octonions and few others, according to
them having associative, commutative, etc, properties, or not
having them.
Bye,
bearophile
More information about the Digitalmars-d
mailing list