PaddiM8 / kalker

Scientific calculator with math syntax that supports user-defined variables and functions, complex numbers, and estimation of derivatives and integrals
https://kalker.xyz
MIT License
1.64k stars 74 forks source link

Convert number to hex #109

Closed not-matthias closed 1 year ago

not-matthias commented 1 year ago

As far as I know, it's currently only possible to display a hexadecimal number as decimal by entering it with 0x or _16. It would be neat to have a function to convert a decimal number to hexadecimal.

Example:

>> hex(123456)
0x1e240
PaddiM8 commented 1 year ago

This was definitely needed! I ended up making a "base" command instead of having a function, since numbers aren't represented as a particular number base under the hood. Now you will be able to do eg. base 16 and get all results in hexadecimal (as well as decimal).

not-matthias commented 1 year ago

Thank you!