In ancient times - in Delphi - we had a “Currency” floating point type. I believe it has a fixed 4 digits precision.
Is there something alike in Zig? Or should I fabricate it myself using some i64 value (if I ever need it)?
It’s an accepted proposal.
opened 06:55PM - 17 Feb 19 UTC
proposal
accepted
I discovered Zig yesterday and have spent pretty much all my time since then del… ving into it and reading various materials on it. Loving it so far.
One feature that I feel is missing currently is built-in support for fixed-point numbers. As the language doesn't allow operator overloading, this isn't something I could implement in user code and use like any other numeric type. For reference, the [Embedded C standard](http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1169.pdf) specifies support for such numbers (refer to Annex A), although I'm not aware of any C compiler that supports them for a desktop target.
I found it interesting that Zig offers support for variable-width integers through `i#` and `u#`. I wonder if this could be applied to fixed-point numbers by supporting some form of Q-notation, perhaps?