[LLVMdev] Reference Manual Clarifications 2
delta17 at cox.net
Tue Apr 1 12:07:24 PDT 2008
Chris Lattner wrote:
> 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.
Yes. AFAIK, IEEE754 defines floating-point truncation also. If a
double-precision value is too large for single precision, the result
is infinity (not undefined).
>> The manual needs to state the rounding mode of the fptrunc, uitofp, and
>> sitofp instruction (if only to say it's undefined). I recommend
> Everything is implicitly assumed to be in the default rounding mode.
After doing a quick search on Google, it looks like the default rounding
mode is round to nearest. Would the default rounding mode ever be
different than round to nearest?
More information about the llvm-dev