Binary, Hex, and Octal

19 views
Skip to first unread message

David Wishart

unread,
Nov 5, 2021, 5:43:29 AM11/5/21
to Numbas Users
Forgive me if I've missed something in the documentation but are there any functions to convert between decimal/binary/hex/octal in Numbas?

I have a few questions that require these conversions,  is this a job for a custom function (I don't mind getting my hands dirty with some javascript if that is what is necessary)?

Christian Lawson-Perfect

unread,
Nov 8, 2021, 11:48:10 AM11/8/21
to numbas...@googlegroups.com
There weren't any functions to do that, but there definitely should be!
I've added new functions tobinary, tooctal, tohexadecimal and tobase to write numbers as strings in given bases, and functions frombinary, fromoctal, fromhexadecimal, frombase to parse strings representing numbers in those bases.
Thanks for the suggestion!

On Fri, 5 Nov 2021 at 09:43, David Wishart <d.wi...@tees.ac.uk> wrote:
Forgive me if I've missed something in the documentation but are there any functions to convert between decimal/binary/hex/octal in Numbas?

I have a few questions that require these conversions,  is this a job for a custom function (I don't mind getting my hands dirty with some javascript if that is what is necessary)?

--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/numbas-users/ac58091c-db4a-4780-8f3c-880cf2be1415n%40googlegroups.com.

David Wishart

unread,
Nov 9, 2021, 5:06:58 AM11/9/21
to Numbas Users
That was quick, thank-you.
Reply all
Reply to author
Forward
0 new messages