Base-Changing Calculator

Here are some examples of the number format:

  • 123
  • 123.456
  • -123.456
  • 123^789
  • -123.456^-789
  • [NaN]
  • [Infinity]
  • -[Infinity]

Each base n uses the first n digits out of the the sequence (0-9A-Z). You don't have to worry about capitalization.

The '^' symbol is used in place of an 'e' so as not to conflict with bases over 14 that use 'e' as a digit. The number 1.2^4 is in scientific notation and should be read "one point two times ten to the fourth."

Internally, these numbers are represented as JavaScript numbers, which is to say they're IEEE-754 doubles. However, the display code isn't accurate to quite that level of precision, so it intentionally strips off the least significant digit.

About this project

I did this for a class assignment at Linfield College in 2008. It's an early example of the kind of immediate feedback UI I like to build, and at the time it was the only four-function calculator I'd seen that dealt with floating-point numbers in bases other than 10 or 2.

About Me
In-Browser Utilities
Writing Hosted Here
Me on the Web

© 2013 Ross Angle (Rocketnia)

This page was last updated 23-May-2013.