Skip to content

Commit

Permalink
fix bug in parsing of Num.t
Browse files Browse the repository at this point in the history
  • Loading branch information
zapashcanon authored and filipeom committed Dec 3, 2024
1 parent 175f18c commit df5f3fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ast/num.ml
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ let of_string (cast : Ty.t) value =
| Ty_fp 32 -> (
match float_of_string value with
| None -> Error "invalid value, expected float"
| Some n -> Ok (I32 (Int32.bits_of_float n)) )
| Some n -> Ok (F32 (Int32.bits_of_float n)) )
| Ty_fp 64 -> (
match float_of_string value with
| None -> Error "invalid value, expected float"
| Some n -> Ok (I64 (Int64.bits_of_float n)) )
| Some n -> Ok (F64 (Int64.bits_of_float n)) )
| _ -> Error "invalid value, expected num"

let to_json (n : t) : Yojson.Basic.t = `String (to_string n)

0 comments on commit df5f3fd

Please sign in to comment.