We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 624594e commit 3a24a09Copy full SHA for 3a24a09
typedapi/types/float64.go
@@ -46,8 +46,11 @@ func (f Float64) MarshalJSON() ([]byte, error) {
46
func (f *Float64) UnmarshalJSON(data []byte) error {
47
switch {
48
case bytes.Equal(data, []byte(`"NaN"`)):
49
- nan := Float64(math.NaN())
50
- f = &nan
+ *f = Float64(math.NaN())
+ case bytes.Equal(data, []byte(`"+Infinity"`)):
51
+ *f = Float64(math.Inf(1))
52
+ case bytes.Equal(data, []byte(`"-Infinity"`)):
53
+ *f = Float64(math.Inf(-1))
54
case bytes.Equal(data, []byte(`null`)):
55
return nil
56
default:
0 commit comments