Adventures in JavaScript: Number Bases

Here’s just a quick lit­tle JavaScript that will con­vert num­bers between dif­fer­ent bases. It grew out of the idea that num­bers in a sys­tem based on π would be much more use­ful in engi­neer­ing that the reg­u­lar old ones. Well, just because one can do it doesn’t mean it’s a good idea, but it was fun fig­ur­ing out how to best imple­ment such a con­ver­sion. Once you know how to do it to and from one base, all oth­er bases are triv­ial. That’s why there are a cou­ple more besides π.

Enter a num­ber into any field to con­vert it to the oth­er bases.

dec­i­mal:
bina­ry:
octal:
hexa­dec­i­mal:
base π:
base e:

last posts in javascript:

No Comments

Post a Comment

Your email is never shared.