MCPcopy Create free account
hub / github.com/apache/fory / IsInf

Method IsInf

go/fory/float16/float16.go:246–259  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

244// If sign < 0, IsInf reports whether f is negative infinity.
245// If sign == 0, IsInf reports whether f is either infinity.
246func (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.
262func (f Float16) IsZero() bool {

Callers 8

compatibleValueToStringFunction · 0.80
compatibleValueRatFunction · 0.80
compatibleNonFiniteHalfFunction · 0.80
TestBFloat16_ConversionFunction · 0.80
TestFloat16_ConversionFunction · 0.80
TestFloat16_NaNFunction · 0.80

Calls

no outgoing calls

Tested by 3

TestBFloat16_ConversionFunction · 0.64
TestFloat16_ConversionFunction · 0.64
TestFloat16_NaNFunction · 0.64