def f32.fin

bendonnect-rpc@0.1.0.0 · src/pbjson.bend:27

import bendonnect-rpc@0.1.0.0/src/pbjson.bend as Pbjson
import Base
import bend-kit-json@0.6.1.1/json.bend as Json

27# Finite F32 -> JSON number; NaN / +-Infinity -> the strings the proto3 JSON spec names.
28def f32.fin(kind: U32, +f: F32) -> Json.Val:
29  match kind:
30    case 0:
31      num(F32.show(f))
32    case 1:
33      str("NaN")
34    case 2:
35      str("Infinity")
36    case _:
37      str("-Infinity")

Uses (9)

Used by (2)