| · Portal |
Help
Search
Members
Calendar
|
| Welcome Guest ( Log In | Register ) | Resend Validation Email |
RULES~ "Number Bases"![]() ![]() ![]() |
| Dan |
Posted: Aug 11 2005, 05:03 AM
|
||||||||||
|
Dozens Disciple Group: Members Posts: 585 Member No.: 19 Joined: 8-August 05 |
Here's a little Python program I wrote for converting numbers from one base to another, with unlimited precision. Thought you might find it useful.
Examples Convert decimal 123.456 to dozenal:
Round it to two dozenal places:
Convert Avogadro's Number to hexadecimal ("@" is used as the scientific notation symbol because "e" is a digit):
Compute 1/23 (i.e. 0.1 base 23) in dozenal to 36 significant digits
|
||||||||||
| The Mighty Dozen |
Posted: Aug 11 2005, 07:40 PM
|
![]() Administrator Group: Admin Posts: 558 Member No.: 1 Joined: 2-August 05 |
Okay Dan, I am braindead as far as computer stuff goes. So, how does one use the above program?
-------------------- Forum Administrator
Please call me "Bryan", not "Sir/Idiot/Madam/Mighty Dozen" ** The reason nature seems to test mankind With cold and stone-hard stares and unmoved mind, Is just to make him see what's plainly true: He's like an animal, nay, is one too. |
| Dan |
Posted: Aug 12 2005, 02:53 AM
|
||
|
Dozens Disciple Group: Members Posts: 585 Member No.: 19 Joined: 8-August 05 |
First, you'll need to install Python and download the rational numbers module. Copy the contents of that big code box into your text editor (making sure to preserve the indentation), and save it as "baseconv.py". The program is meant to be executed from the command prompt. The syntax for it is: python baseconv.py options number_to_convert The possible options are:
|
||
| The Mighty Dozen |
Posted: Aug 12 2005, 01:29 PM
|
![]() Administrator Group: Admin Posts: 558 Member No.: 1 Joined: 2-August 05 |
Cheers, Dan. I'll give it a go when I get a spare ten minutes
-------------------- Forum Administrator
Please call me "Bryan", not "Sir/Idiot/Madam/Mighty Dozen" ** The reason nature seems to test mankind With cold and stone-hard stares and unmoved mind, Is just to make him see what's plainly true: He's like an animal, nay, is one too. |
| Twinbee |
Posted: Aug 12 2005, 04:27 PM
|
|
Casual Member Group: Members Posts: 21 Member No.: 11 Joined: 4-August 05 |
Dan, if you have time, make it into an exe and give it a GUI
|
| The Mighty Dozen |
Posted: Aug 12 2005, 04:48 PM
|
||
![]() Administrator Group: Admin Posts: 558 Member No.: 1 Joined: 2-August 05 |
...and install it for us, while you're at it -------------------- Forum Administrator
Please call me "Bryan", not "Sir/Idiot/Madam/Mighty Dozen" ** The reason nature seems to test mankind With cold and stone-hard stares and unmoved mind, Is just to make him see what's plainly true: He's like an animal, nay, is one too. |
||
| Dan |
Posted: Aug 15 2005, 03:07 AM
|
||
|
Dozens Disciple Group: Members Posts: 585 Member No.: 19 Joined: 8-August 05 |
I'll put on on my website next week when I re-acquire my domain name. |
||
| finlay |
Posted: Aug 18 2005, 05:25 PM
|
|
Regular Group: Members Posts: 78 Member No.: 17 Joined: 6-August 05 |
It's fairly obvious why you've done it, but could you possibly implement a system whereby you could use bases higher than 36?
I'm just about to try it, anyway, and then once my sister's come off msn Sounds cool. OK it's not working. Some syntax error? Not sure if it's yours or mine. |
| Dan |
Posted: Aug 18 2005, 07:47 PM
|
||
|
Dozens Disciple Group: Members Posts: 585 Member No.: 19 Joined: 8-August 05 |
What error are you getting? |
||
| finlay |
Posted: Aug 20 2005, 05:34 PM
|
||
|
Regular Group: Members Posts: 78 Member No.: 17 Joined: 6-August 05 |
Apparently it's neither yours nor mine, unless I'm somehow mistaken.... :\ |
||
| Dan |
Posted: Aug 20 2005, 06:18 PM
|
|
Dozens Disciple Group: Members Posts: 585 Member No.: 19 Joined: 8-August 05 |
Try installing the latest version of Python.
|
| Dan |
Posted: Jul 19 2007, 03:23 AM
|
|
Dozens Disciple Group: Members Posts: 585 Member No.: 19 Joined: 8-August 05 |
I guess I should explain my use of @ as the separator between the mantissa and exponent.
The usual notation uses "e", but that's a digit in bases fifteen and higher, so I couldn't use it. Or any letter (or digit, of course), because it would be a digit in some base. I also didn't want to use any of the symbols !"#%&\'()*+,-./:;<=>?[\]^_{|}~ because each of them has a meaning in C (which, along with its descendants C++ and Java, are the most popular programming languages today). So, that left only 3 characters left on my keyboard: $, @, and `. But "$" is very commonly used with digits, and ` could be confused with the apostrophe, so the only practical choice was @. Coincidentally, it has a slight resemblance to a lowercase "e". |
| Ged |
Posted: Jul 22 2007, 03:16 PM
|
![]() Casual Member Group: Members Posts: 29 Member No.: 16 Joined: 6-August 05 |
I had the same problem with Python.
However I have written a base conversion programme in GUI using C++, but it only works on Windows So if anybody is interested in it let me know. |
| Dan |
Posted: Jul 23 2007, 12:20 AM
|
||||
|
Dozens Disciple Group: Members Posts: 585 Member No.: 19 Joined: 8-August 05 |
|
||||
| JDozen |
Posted: Aug 23 2007, 12:23 PM
|
![]() Regular Group: Members Posts: 80 Member No.: 113 Joined: 1-June 07 |
There should be a fairly simple way of base conversation for EXCEL. I'll bring it in when I'll find it. I think more folks are familiar with EXCEL than with python
|
| Dan |
Posted: Aug 24 2007, 12:59 AM
|
||
|
Dozens Disciple Group: Members Posts: 585 Member No.: 19 Joined: 8-August 05 |
I don't have Excel on my home PC, but OpenOffice has BASE and DECIMAL functions. But they only work for integers. |
||
![]() |
![]() ![]() ![]() |