[llvm-dev] Semantics of fdiv division by zero

Hal Finkel via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 22 09:25:26 PDT 2017


On 06/22/2017 10:04 AM, Jan Finis via llvm-dev wrote:
> Hey guys,
>
> I am wondering what the semantics for fdiv is, if the denominator is
> zero. For sdiv, the language reference specifies that this is undefined
> behavior. For fdiv, the language reference says nothing (hence, I assume
> that it is defined somehow).
>
> So how is it defined? Does it follow IEEE-754 definition, i.e., +Inf if
> nominator is > 0, -Inf if nominator is < 0, otherwise NaN?

That's correct (it follows the semantics for the underlying type, which 
is generally IEEE with default rounding).

  -Hal

>
> Regards,
>
> Jan Finis
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-dev mailing list