Index of /~pieter/SOFT/methadone.cpp
Name Last modified Size Description
Parent Directory -
Makefile 11-Feb-2007 01:44 2.7K
README.html 11-Feb-2007 01:44 5.4K
TEST.data 11-Feb-2007 01:44 23K
TEST.diff 11-Feb-2007 01:44 1.8K
TEST.sh 11-Feb-2007 01:44 2.7K
bcd_arithmetic.cpp 11-Feb-2007 01:44 2.0K
bcd_arithmetic.hpp 11-Feb-2007 01:44 4.1K
bin_arithmetic.cpp 11-Feb-2007 01:44 30K
bin_arithmetic.hpp 11-Feb-2007 01:44 6.4K
demo.cpp 11-Feb-2007 01:44 4.4K
fix.cpp 11-Feb-2007 01:44 17K
fix.hpp 11-Feb-2007 01:44 5.3K
fixd.cpp 11-Feb-2007 01:44 15K
fixd.hpp 11-Feb-2007 01:44 4.8K
fragmentation.h 11-Feb-2007 01:44 2.9K
fragselect.h 11-Feb-2007 01:44 23
int_def.cpp 11-Feb-2007 01:44 4.5K
test.cpp 11-Feb-2007 01:44 24K
u.cpp 11-Feb-2007 01:44 14K
u.hpp 11-Feb-2007 01:44 4.7K
METHADONE.CPP version 0.28
METHADONE.CPP consists in a set of arithmetic C++ classes, to replace C++'s
built-in floating-point arithmetic; pin-down and expand the built-in integer
arithmetic; provide decimal arithmetic.
All this, to obtain reproducable calculations when moving source-code to diffe-
rent machines, compilers, etc.. Get rid of the 'float' and 'double' addiction.
FEATURES
========
Size-awareness during programming with C++'s built-in integers.
Including headerfile "int.h" enables you to work with fixed-size integers.
And for more precision (max. 2 million bits) the following classes are provided:
Arithmetic: C++ name: How to use:
----------- --------- -----------
built-in binary:
unsigned integers U8 Include "int.h".
U16 Pins down the (sizes of) built-in integers.
U32
U64
signed integers S8
S16
S32
S64
extended binary:
unsigned integer u Include "int.h", "fragmentation.h" and "u.hpp"
(in that order) and link your main executable or
library against "u.o".
signed integer s Include "int.h", "fragmentation.h" and "s.hpp"
(in that order) and link your main executable or
library against "s.o".
signed fixed point fix Include "int.h", "fragmentation.h" and "fix.hpp"
(in that order) and link your main executable or
library against "fix.o".
decimal:
signed fixed point fixd Include "int.h" and "fixd.hpp" (in that order)
and link your main executable or library against
"fixd.o".
For the classes 'u', 's', 'fix' and 'fixd', the default constructors may NOT be
called. The constructors always need at least 1 argument:
(1) the number of bits (or decimal digits). Or
(2) another object (copy constructor).
When 'u', 's', 'fix' or 'fixd' objects are created by (1), they are always
initialised to zero.
DOWNLOAD
========
../methadone.cpp-0.28.tar.gz
BUILD
=====
Unpack the downloaded .tar.gz file and change to the newly created directory:
gunzip methadone.cpp-0.28.tar.gz
tar xf methadone.cpp-0.28.tar
cd methadone.cpp-0.28
Then simply run script 'TEST.sh'. It will build and test 3 times.
First of all, headerfile "int.h" is generated. It pins down C++'s built-in
integer datatypes.
It is always good to throw away "int.h" after changing compiler(-setting)s,
the provided Makefile will then automatically regenerate a fresh one.
TESTED MACHINES, OPERATING SYSTEMS AND COMPILERS
================================================
1) Silicon Graphics Octane, dual R10000; IRIX 6.5; GCC compiler version 3.4.6
2) Silicon Graphics Octane, dual R10000; IRIX 6.5; MIPSpro compiler version 7.4.
3) Acer Ubuntu GCC
ENDIANNESS
==========
We do not deal with native endian-issues! Nowhere in the sourcecode, you'll
encounter the word; we ignore internal representations.
The software is completely unaware of the endianness of the hardware it
is running and being compiled on, it should always perform correctly.
BE AWARE
========
C++ has the nasty habit of automatically calling our one-argument constructors
for conversion. For instance:
u i(64000); // A 64000-bit unsigned integer, initialised to zero.
if (i == 13) // ERROR: u(13) is invoked automatically by C++!
... // Notice that we are lucky here: the argument is 13 and we
// get noticed. Imagine what could happen if the argument
// is (by coincidence) a large power of 2. Thus be careful!
Notice the order in which expression evaluation occurs is not defined in C++,
so use as much as possible brackets to enforce reproducable evaluation-order.
LICENSE
=======
METHADONE.CPP version 0.25, februari 3, 2007.
Latest version available at: http://kmt.hku.nl/~pieter/SOFT/
Copyright (c) 2006 2007 - Pieter Suurmond
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Any person wishing to distribute modifications to the Software is requested
to send the modifications to the original developer so that they can be
incorporated into the canonical version.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.