IsInf reports whether f is an infinity, according to sign. If sign > 0, IsInf reports whether f is positive infinity. If sign < 0, IsInf reports whether f is negative infinity. If sign == 0, IsInf reports whether f is either infinity.
(sign int)
| 244 | // If sign < 0, IsInf reports whether f is negative infinity. |
| 245 | // If sign == 0, IsInf reports whether f is either infinity. |
| 246 | func (f Float16) IsInf(sign int) bool { |
| 247 | isInf := (f&maskExp) == maskExp && (f&maskMant) == 0 |
| 248 | if !isInf { |
| 249 | return false |
| 250 | } |
| 251 | if sign == 0 { |
| 252 | return true |
| 253 | } |
| 254 | hasSign := (f & maskSign) != 0 |
| 255 | if sign > 0 { |
| 256 | return !hasSign |
| 257 | } |
| 258 | return hasSign |
| 259 | } |
| 260 | |
| 261 | // IsZero reports whether f is +0 or -0. |
| 262 | func (f Float16) IsZero() bool { |
no outgoing calls