I have noticed my code that uses float ↔ int coercion builtins,
@floatToInt, does not compile with the latest Zig,
I then opened the documentation, and found that these builtins are not there, but I have found two new ones:
@floatFromInt(int: anytype) anytype Converts an integer to the closest floating point representation. The return type is the inferred result type. To convert the other way, use @intFromFloat. This cast is always safe.
@intFromFloat(float: anytype) anytype Converts the integer part of a floating point number to the inferred result type. If the integer part of the floating point number cannot fit in the destination type, it invokes safety-checked Undefined Behavior.
These look more than just reskin of the original
@floatToInt, in that the desired type is not specified anymore.
Please forgive me if it was described already, but where do I read on how the type of the result is inferred? Is there a way to control this behavior?