program main
  fn parse_f64(text: string) -> (result f64 i32)
    call std.string.parse_f64_result
      var text
  fn main() -> i32
    local let value: (result f64 i32)
      call parse_f64
        string "-0.25"
    if
      std.result.is_ok
        var value
      if
        binary =
          std.result.unwrap_ok
            var value
          binary -
            float 0
            float 0.25
        int 0
        int 1
      std.result.unwrap_err
        var value
  test "parse f64 decimal ok"
    local let value: (result f64 i32)
      call parse_f64
        string "12.5"
    if
      std.result.is_ok
        var value
      binary =
        std.result.unwrap_ok
          var value
        float 12.5
      bool false
  test "parse f64 negative decimal ok"
    local let value: (result f64 i32)
      call parse_f64
        string "-0.25"
    if
      std.result.is_ok
        var value
      binary =
        std.result.unwrap_ok
          var value
        binary -
          float 0
          float 0.25
      bool false
  test "parse f64 text err"
    local let value: (result f64 i32)
      call parse_f64
        string "abc"
    if
      std.result.is_err
        var value
      binary =
        std.result.unwrap_err
          var value
        int 1
      bool false
  test "parse f64 nan err"
    local let value: (result f64 i32)
      call parse_f64
        string "nan"
    if
      std.result.is_err
        var value
      binary =
        std.result.unwrap_err
          var value
        int 1
      bool false
