[LLVMdev] Floating-Point Overflow check
dalej at apple.com
Fri Jul 23 10:41:10 PDT 2010
On Jul 23, 2010, at 7:20 AMPDT, Steffen Geißinger wrote:
> i need to check if an overflow of an floating-point arithmetic
> operation occured.
> Currently I'm doing something like this (for addition):
> (LHS > 0 && RHS > 0 && sum <= 0) || (LHS < 0 && RHS < 0 && sum >= 0)
> This is checked for every addition.
> Is there a more efficient way like the intrisic for int overflow?
> How is it possible to raise a signal like SIGFPE?
If you're talking about compile-time arithmetic, you should be using
the APFloat library, which figures this out for you.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev