[LLVMdev] Floating-Point Overflow check
Dale Johannesen
dalej at apple.com
Fri Jul 23 10:41:10 PDT 2010
On Jul 23, 2010, at 7:20 AMPDT, Steffen Geißinger wrote:
> Hi,
>
> 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...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100723/9a9dde45/attachment.html>
More information about the llvm-dev
mailing list