Why don't we switch to C like floating pointed arithmetic instead of automatic expansion to reals?
David Nadlinger via Digitalmars-d
digitalmars-d at puremagic.com
Sat Aug 6 14:12:52 PDT 2016
On Saturday, 6 August 2016 at 09:35:32 UTC, Walter Bright wrote:
> The LDC fastmath bothers me a lot. It throws away proper NaN
> and infinity handling, and throws away precision by allowing
> reciprocal and algebraic transformations.
This is true – and precisely the reason why it is actually
defined (ldc.attributes) as
---
alias fastmath = AliasSeq!(llvmAttr("unsafe-fp-math", "true"),
llvmFastMathFlag("fast"));
---
This way, users can actually combine different optimisations in a
more tasteful manner as appropriate for their particular
application.
Experience has shown that people – even those intimately familiar
with FP semantics – expect a catch-all kitchen-sink switch for
all natural optimisations (natural when equating FP values with
real numbers). This is why the shorthand exists.
— David
More information about the Digitalmars-d
mailing list