Quantcast
Channel: calculator – Netninja.com
Viewing all articles
Browse latest Browse all 6

iPhone Programmer’s Calculator

$
0
0

For all of those software/firmware/hardware programmers out there with iPhones reading my blog (…all one of you: me…), I did some work on a “real” calculator last night and put the finishing touches on it today at lunch:

calc.png

For the techies: it’s implemented entirely in JavaScript using primitive datatypes (meaning the range isn’t the greatest in the world.) I’m sure someone out there has a bignum/bigint library implemented in JavaScript. It also doesn’t really like natural numbers too well. I didn’t even implement the decimal-point button because of this (although you can still get decimals by dividing things.) I am debating whether I should just chop everything down to an integer and forget about it. It also doesn’t handle negative numbers very well. You start getting into issues with number of bits and two’s complements that I didn’t feel like dealing with yet. Still, for simple base conversions, bit-shifts, and and/or masking, it’s the best (well, only) solution out there.

You can give it a try in your desktop browser, but be aware that it has been designed for the iPhone’s Safari and has only been tested with Safari and Firefox.

Posted in: Code iPhone

Original article: iPhone Programmer’s Calculator.

Flattr this!


Viewing all articles
Browse latest Browse all 6

Trending Articles