Nios II Custom Instruction User Guide

ID 683242
Date 4/27/2020
Document Table of Contents
Give Feedback

5.4. Special Floating Point Cases

The table below lists the results of some IEEE 754 special cases. The x represents a normal value. The FPH2 are compliant for all of these cases.

Results are assumed to be correctly signed so signs are omitted when they are not important. When the sign is relevant, signs are shown with extra parenthesis around the value such as (+∞). The value x in the table represents any non-NaN value.

Comparisons ignore the sign of zero for equality. For example, (-0) == (+0) and (+0) ≤ (-0). Comparisons that don’t include equality, like > and <, don’t consider -0 to be less than +0. Comparisons return false if either or both inputs are NaN. The min and max operations return the non-NaN input if one of their inputs is NaN and the other is non-NaN. Other operations that produce floating point results return NaN if any or all of their inputs are NaN.

Table 12.  Special Cases
Operation Special Cases
fdivs 0/0=NaN ∞/∞=NaN 0/∞=0, ∞/0=∞ NaN/x=NaN, x/NaN=NaN, NaN/NaN=NaN
fsubs (+∞)-(+∞)=NaN (-∞)-(-∞)=NaN (-0)-(-0)=+0 NaN-x=NaN, x-NaN=NaN, NaN-NaN=NaN
fadds (+∞)+(-∞)=NaN (-∞)+(+∞)=NaN (+0)+(-0)=+0, (-0)+(+0)=+0 NaN+x=NaN, x+NaN=NaN, NaN+NaN=NaN
fmuls 0*∞=NaN ∞*0=NaN   NaN*x=NaN, x*NaN=NaN, NaN*NaN=NaN

sqrt(-0) =-0

sqrt(x) =NaN, x<-0   sqrt(NAN) =NaN
  int(>2fixsi & round31-1)= 0x7fffffff, int(+∞)=0x7fffffff fixsiint(<-231)= x80000000, int(-∞)=0x80000000   int(NaN)=undefined
fmins min((+0),(-0))=(-0) min((-0),(+0))=(-0)   min(NaN,n)=x, min(x,NaN)=x, min(NaN,NaN)=NaN, min(+∞,x)=x, min(-∞,x)=-∞
fmaxs max((+0),(-0))=(+0) max((-0),(+0))=(+0)   max(NaN,x)=x, max(x,NaN)=x, max(NaN,NaN)=NaN, max(+∞,x)=+∞, max(-∞,x)=x
fcmplts (<) (+∞)<(+∞)=0 (-∞)<(-∞)=0 (-0)<(+0)=0, (+0)<(-0)=0 NaN<x=0, x<NaN=0, NaN<NaN=0
fcmples (≤) (+∞)≤(+∞)=1 (-∞)≤(-∞)=1 (+0)≤(-0)=1, (-0)≤(+0)=1 NaN≤x=0, x≤NaN=0, NaN≤NaN=0
fcmpgts (>) (+∞)>(+∞)=0 (-∞)>(-∞)=0 (-0)>(+0)=0, (+0)>(-0)=0 NaN>x=0, x>NaN=0, NaN>NaN=0
fcmpges (≥) (+∞)≥(+∞)=1 (-∞)≥(-∞)=1 (-0)≥(+0)=1, (+0)≥(-0)=1 NaN≥x=0, x≥NaN=0, NaN≥NaN=0
fcmpeqs (=) (+∞)=(+∞)=1 (-∞)=(-∞)=1 (-0)=(+0)=1 (NaN==x)=0, (x==NaN)=0, (NaN==NaN)=0
fcmpnes (≠) (+∞)≠ (+∞)=0 (-∞)≠ (-∞)=0 (-0)≠(+0)=0 NaN≠x=0, x≠NaN=0, NaN≠NaN=0