5 ms·
f16 in Rust is equivalent to float in C# f32 in Rust is equivalent to double in C# f64 in Rust is equivalent to decimal in C# correcting a typo on this page:
by CrimsonCape 3y ago
f16 in Rust is equivalent to float in C#
f32 in Rust is equivalent to double in C#
f64 in Rust is equivalent to decimal in C#
correcting a typo on this page:
https://microsoft.github.io/rust-for-dotnet-devs/latest/language/scalar-types.html https://microsoft.github.io/rust-for-dotnet-devs/latest/lang...
- pornel 3y agoAre you quoting some old version? Because the page correctly states that Rust's f32 is C#'s float.
- kcb 3y agoThat doesn't sound right.
- jjtheblunt 3y agoWhere are you getting what you wrote? Rust doesn't (March 2024) have f16. And the other correspondences you wrote are wrong. There's a crate (several it seems) which realizes an f16 with arithmetic using u16, for example.
- kdowns 3y agoDon't think that's quite right. `float` has 4 bytes, and `double` has 8. The `decimal` type has 16 bytes and does all it's arithmetic in base 10. https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types#characteristics-of-the-floating-point-types https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...
- bloqs 3y agoThis smells like it was written by an LLM
- cqqxo4zV46cp 3y agoNo it doesn’t.