Windows compile:
Open the magnum.dsw file with msdev and hit F7.
Unix compile:
Type: g++ -o magnum magnum_unix.cpp mgnum.cpp CString.cpp
Windows installation:
Just place MagNum.exe anywhere you please and make a shortcut to it on your desktop.
Unix installation:
Anywhere in your PATH will do (/usr/local/bin is a good one).
Usage:
Windows users get a dialog box, Unix users type "magnum" followed by a number.
The number must be limited to a 32 bit one.
Use standard C convention:
100 = 100 decimal
-100 = -100
0x100 = 100 hex (256 decimal)
0100 = 100 oct (64 decimal)
The above "basic" conversions are MagNum's first use, it will give ALL the representations of a
given number as well as the negated ones.
You may also give MagNum a string of precisely 14 digits, it will interpret this to be:
yyyymmddHHMMSS
yyyy = year with century, between 1970 and, depending on your platform, 2036 or 2106 ...
mm = month (1..12)
dd = day (1..31)
HH = hour (0..23)
MM = minute (0..59)
SS = second (0..59)
You MAY enter out-of-range values, you'll get a warning and the opportunity to see how your
platform's mktime() function handles that (for dates after 2038, my version of Windows 2K
returns -1 instead of the more logical unsigned time_t, for instance).
The "magic" comes next:
ctime: The date and time this number would be if it was a time_t value. Friday 13th?
^666: XOR 666, in decimal, hex and oct representation.
~hex:
~oct: The inverted number.
asc: The number if it was for instance a RIFF code (ie. four characters used as the four
bytes of a 32 bit word).
Here the following coding is used:
[SP] normal space (32)
{SP} non-breakable space (255)
^chr control character (0..31)
chr normal character (32..126)
{^chr} control character with bit 8 stripped.
{chr} character with bit 8 stripped.
bin: The bits.
pow2: The number as the greatest power of 2. 32767->no power of 2, 32768->2^15*1
666: Any factor involving the decimal, hex or oct representation of the number 666.
This has a certain attraction to certain people, hence its inclusion in the tests.
fact: The number split up in its prime factors (only itself if it is a prime).
time: Some attempts to regard the number as a number of seconds, minutes or such.
Example (real) problem:
The program crashes after 22 days and 19 hours, each time, according to our logfile.
We enter: 19700123190000 (22 days and 19 hours after 1 jan 1970, the start of ctime).
We get (amongst others) that this corresponds to 32760 minutes! Yes, that signed 16 bits
variable wasn't such a good idea...