zeroshade commented on code in PR #41109:
URL: https://github.com/apache/arrow/pull/41109#discussion_r1561152657
##########
go/arrow/array/float16.go:
##########
@@ -87,10 +87,16 @@ func (a *Float16) GetOneForMarshal(i int) interface{} {
func (a *Float16) MarshalJSON() ([]byte, error) {
vals := make([]interface{}, a.Len())
for i, v := range a.values {
- if a.IsValid(i) {
- vals[i] = v.Float32()
- } else {
+ if !a.IsValid(i) {
vals[i] = nil
+ continue
+ }
+
+ switch {
+ case v.IsNaN():
+ vals[i] = "NaN"
+ default:
+ vals[i] = v.Float32()
}
Review Comment:
We should add an `IsInf` method to `float16.Num` which can do `return n.bits
& 0x7c00`. After that you can simply check the sign bit via `Signbit()` to
determine if it's `-Inf` or `+Inf`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]