Comparison
(other Float16)
| 320 | // Comparison |
| 321 | |
| 322 | func (f Float16) Equal(other Float16) bool { |
| 323 | // IEEE 754: NaN != NaN |
| 324 | if f.IsNaN() || other.IsNaN() { |
| 325 | return false |
| 326 | } |
| 327 | // +0 == -0 |
| 328 | if f.IsZero() && other.IsZero() { |
| 329 | return true |
| 330 | } |
| 331 | // Direct bit comparison works for typical normals with same sign |
| 332 | // But mixed signs or negative numbers need caear |
| 333 | return f.Float32() == other.Float32() |
| 334 | } |
| 335 | |
| 336 | func (f Float16) Less(other Float16) bool { |
| 337 | if f.IsNaN() || other.IsNaN() { |