In the docs https://www.roc-lang.org/builtins/Num it says:
"To get strings in hexadecimal, octal, or binary format, use Num.format."
But there is no Num.format entry in the docs, and the roc
compiler also claims that format
is not exposed in the module Num
.
Is this a bug? Should this function exist?
Is there another way in roc
to print an Int
as hexadecimal or binary string?
oops yeah let's remove a reference to that from the docs :big_smile:
Is there another way in roc to print an Int as hexadecimal or binary string?
This question hasn't actually been answered! How do we do this now that Num.format
is gone? I don't know myself.
There is also a related issue #5213 for parsing floating point numbers. I think it requires a bit of effort for someone to put together a proposal and consider the trade-offs or make a reccomendation.
I think this is just a case of having docs for q function that didn't exist, but I think fundamentally we do want the function or some alternative to add the functionality
For hexadecimal numbers i wrote this package a while ago, I don't remember if i finished it or not though :sweat_smile:
Last updated: Jul 05 2025 at 12:14 UTC