1
0
Fork 0
forked from fun/fun

Added some more HEX (dec_to_hex()) to Fun. (0.37.15)

This commit is contained in:
Johannes Findeisen 2025-12-18 10:29:50 +01:00
commit 37c5ae6f58
5 changed files with 66 additions and 2 deletions

View file

@ -87,3 +87,15 @@ fun hex_to_dec(hex)
res = res * 16 + hex_val(substr(s, i, 1))
i = i + 1
return res
fun dec_to_hex(n)
number val = n
if (val == 0)
return "0"
hexd = "0123456789abcdef"
res = ""
while val > 0
number m = val % 16
res = substr(hexd, m, 1) + res
val = val / 16
return res