Outdated egg!

This is an egg for CHICKEN 3, the unsupported old release. You're almost certainly looking for the CHICKEN 4 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

lognum

Introduction

A logarithmic number system (LNS) is an arithmetic system for representing real numbers. In LNS, a number X, is represented by the logarithm L of its absolute value:

   X -> { s, L = \log_b(|X|) }

where s denotes the sign of X (s = 1 if X > 0 and s = -1 if X < 0).

Requires

syntax-case
matchable
datatype

Library procedures

[procedure] {{lognum?:: X -> BOOL}}
[procedure] {{lognum-sign:: X -> INTEGER}}
[procedure] {{lognum-value:: X -> NUMBER}}
[procedure] {{number->lognum:: NUMBER -> LOGNUM}}
[procedure] {{lognum->number:: LOGNUM -> NUMBER}}
[procedure] {{lognum+:: A * B -> X}}
[procedure] {{lognum-:: A * B -> X}}
[procedure] {{lognum*:: A * B -> X}}
[procedure] {{lognum/:: A * B -> X}}
[procedure] {{lognum-neg:: A -> B}}
[procedure] {{lognum-abs:: A -> B}}
[procedure] {{lognum-signum:: A -> B}}
[procedure] {{lognum-recip:: A -> B}}

Authors

Ivan Raikov

Version

1.0
Initial version

License

Copyright 2009 Ivan Raikov and the Okinawa Institute of Science and Technology.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

A full copy of the GPL license can be found at <http://www.gnu.org/licenses/>.