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.

complex

  1. Outdated egg!
  2. complex
    1. Description
    2. Author
    3. Requirements
    4. Download
    5. Documentation
    6. Changelog
    7. License

Description

Support for complex numbers in chicken.

Author

Thomas Christian Chust

Requirements

regex-case

Download

complex.egg

Documentation

This library provides new versions of all numeric operations. Specifically, the following standard procedures are re-implemented:

 abs
 complex? number? real? rational? integer?
 exact? inexact?
 zero?
 positive?
 odd? even?
 = < > <= >= 
 max min
 + - * /
 quotient remainder modulo
 gcd lcm
 floor ceiling 
 truncate round
 exact->inexact inexact->exact
 number->string string->number
 exp log sin cos tan 
 asin acos atan
 sqrt
 expt

The library also provides the following definitions:

[procedure] (conj COMPLEX)

Computes the conjugate of COMPLEX.

[constant] i
[constant] -i
[constant] j
[constant] -j

Handy numeric values.

Note: If this library is used in compiled code, the option -usual-integrations and the declaration standard-bindings (implied by -O2) will replace invocations of numeric standard procedures with open-coded versions that support only the basic numeric types provided by the Chicken system. If you use the complex extension and compile with -O2, then add declarations that mark the used numeric primitives to disable in-lining:

(use complex)

(declare 
  (not standard-bindings sin number->string) )

(number->string (sin i))
 => "0.+1.1752011936438i"

(This has been fixed in Chicken version 1.72 and higher)

Changelog

License

 Copyright (c) 2004 by Thomas Christian Chust
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or
 without modification, are permitted provided that the following
 conditions are met:
 
 * Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above
   copyright notice, this list of conditions and the following
   disclaimer in the documentation and/or other materials provided
   with the distribution.
 * Neither the name of the author nor the names of its
   contributors may be used to endorse or promote products derived
   from this software without specific prior written permission.
 
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.