[LLVMdev] Reference Manual Clarifications 2

Chris Lattner sabre at nondot.org
Tue Apr 1 11:48:49 PDT 2008


On Mon, 31 Mar 2008, Jon Sargeant wrote:
> The fptrunc instruction states "If the value cannot fit within the 
> destination type, ty2, then the results are undefined."  This is fine, but 
> what about other floating-point operations that can overflow?  For example, 
> does 'mul double 1.0e300, 1.0e300' produce +infinity or is it undefined?

It is defined by IEEE to be inf.

> I 
> think LLVM should treat floating-point overflows consistently.  On a similar 
> note, what is the result of division by zero for fdiv?  infinity or 
> undefined?

IEEE also specifies these, but I don't know the answer off-hand.

> The manual needs to state the rounding mode of the fptrunc, uitofp, and 
> sitofp instruction (if only to say it's undefined).  I recommend 
> round-to-nearest.

Everything is implicitly assumed to be in the default rounding mode.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list