3 ms·
Endianness and pointer casts are the mechanical part and I would expect Zig to emulate them correctly. Other parts, like floats are harder. This is where a dif
by weinzierl 9d ago
Endianness and pointer casts are the mechanical part and I would expect Zig to emulate them correctly.
Other parts, like floats are harder. This is where a difference shows. Rust is like: "Sorry, since we cannot uphold our guarantees, no transcendentals for you at comptime ", whereas Zig is chill about that and let you have your transcendentals even if results
may differ between comptime and runtime. Different mindsets.
- simonask 9d agoJust to note, Rust has had compile-time floats for a while now, but yes.
- weinzierl 9d agoYes, but no transcendentals on floats. You can add them and the like but you cannot calculate the sine.
- adrian_b 9d agoThe guarantees could be provided, if there would be a way to ensure that the compiler uses the same standard math library that is used by the executable program that is created. This could be done, for instance, if the standard math library would be dynamically linked into the compiler, so the same library would be available for the compiled program.
- weinzierl 8d agoIf you disregard performance, yes. Unfortunately forcing softfloat everywhere would result in abysmal performance, so this is not an option.