You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The float2string intrinsic is implemented in the OCaml backend using the string_of_float function, which prints specific floating-point numbers in an odd format; for example, the value 1.0 is printed as 1. which does not conform to the JSON standard (#784). In addition, we have existing tests that assume this particular behavior (in arg.mc and csv.mc), which leads to difficulties when implementing the intrinsic in other backends where the standard print functions use a different format (@asta12 has failing tests due to this in the JVM backend).
As suggested in #784, an alternative could be to use the Printf module of OCaml to print floats instead (I assume that would be something like Printf.sprintf "%f" instead of string_of_float). However, this results in what I would argue to be uglier prints (the value 1.0 is printed as 1.000000 instead of 1.). Implementing it natively in Miking could be an alternative, but since we don't currently have bitwise operations (to access the mantissa and exponent), it's not a viable option at the moment.
The text was updated successfully, but these errors were encountered:
The
float2string
intrinsic is implemented in the OCaml backend using thestring_of_float
function, which prints specific floating-point numbers in an odd format; for example, the value1.0
is printed as1.
which does not conform to the JSON standard (#784). In addition, we have existing tests that assume this particular behavior (in arg.mc and csv.mc), which leads to difficulties when implementing the intrinsic in other backends where the standard print functions use a different format (@asta12 has failing tests due to this in the JVM backend).As suggested in #784, an alternative could be to use the Printf module of OCaml to print floats instead (I assume that would be something like
Printf.sprintf "%f"
instead ofstring_of_float
). However, this results in what I would argue to be uglier prints (the value1.0
is printed as1.000000
instead of1.
). Implementing it natively in Miking could be an alternative, but since we don't currently have bitwise operations (to access the mantissa and exponent), it's not a viable option at the moment.The text was updated successfully, but these errors were encountered: