Jan Finis via llvm-dev
2017-Jun-22 15:04 UTC
[llvm-dev] Semantics of fdiv division by zero
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? Regards, Jan Finis
Maybe the semantic somehow implied by [1], but I think it's desired a better definition. [1] http://llvm.org/docs/LangRef.html#fast-math-flags 2017-06-22 23:04 GMT+08:00 Jan Finis via llvm-dev <llvm-dev at lists.llvm.org>:> 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? > > Regards, > > Jan Finis > > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-- Wei-Ren Chen (陳韋任) Homepage: https://people.cs.nctu.edu.tw/~chenwj -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170622/378512e9/attachment.html>
Jan Finis via llvm-dev
2017-Jun-22 16:25 UTC
[llvm-dev] Semantics of fdiv division by zero
Unfortunately, no flag in [1] mentions anything about devision by zero. So it still seems that there is no place in the reference where anything is stated about the semantics of it. On 22/06/17 17:27, 陳韋任 wrote: Maybe the semantic somehow implied by [1], but I think it's desired a better definition. [1] http://llvm.org/docs/LangRef.html#fast-math-flags 2017-06-22 23:04 GMT+08:00 Jan Finis via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>>: 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? Regards, Jan Finis _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -- Wei-Ren Chen (陳韋任) Homepage: https://people.cs.nctu.edu.tw/~chenwj<https://people.cs.nctu.edu.tw/%7Echenwj> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170622/12e7c3ad/attachment.html>
Hal Finkel via llvm-dev
2017-Jun-22 16:25 UTC
[llvm-dev] Semantics of fdiv division by zero
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
Seemingly Similar Threads
- Unsafe floating point operation (FDiv & FRem) in LoopVectorizer
- [LLVMdev] a question about constant fold for fdiv
- [LLVMdev] a question about constant fold for fdiv
- [LLVMdev] a question about constant fold for fdiv
- [LLVMdev] a question about constant fold for fdiv