Next: Type bigg, Previous: Type bigfr, Up: Types of Numbers [Contents][Index]
The type ‘bigc’ is an abstract C type for arbitrary-precision complex number approximations with correct rounding facilities. The actual C type is provided either by the MPC library (‘mpc_t’) or by the SXEmacs pseudo imlementation based on MPFR.
Any other library which implements something similar to MPC, should be accessed via the abstract type ‘bigc’, too.
Lisp objects can be tested for the type ‘bigc’ by the following predicate.
This predicate tests whether its argument is a complex number (as
provided by MPC or the SXEmacs pseudo-implementation), and returns
t
if so, nil
otherwise.
For ‘bigc’ objects exist two accessor functions, namely
real-part
and imaginary-part
to access the respective
parts of a complex number.
Return the real part of number.
Return the imaginary part of number. If number is a comparable, 0 is returned.
The read syntax of ‘bigc’s is inspired by the notation of elements of algebraic adjunctions. In these terms the lisp reader interprets a+bi as ‘bigc’ whenever both a and b are written in float syntax, alternatively it is allowed to capitalise the imaginary symbol. If the imaginary part of a ‘bigc’ is one, it is additionally allowed to omit b. Consider the examples:
2.0+3.0i ⇒ 2.000000+3.000000i 2.0+3.0I ⇒ 2.000000+3.000000i 3.0+i ⇒ 3.000000+1.000000i
Note that the read syntax for complex numbers steals a whole class of possible symbol identifiers. In a non-ENT-SXEmacs 2.0+3.0i is a valid name for a variable.
There is also the possibility to create ‘bigc’ objects with a constructor, passing a real and an imaginary part to it. Both real and imaginary part may be of any comparable number type, in this case. In a certain sense, this is the inverse function of the selector functions above.
Return the bigc number whose real component is real-part and whose imaginary component is imaginary-part.
(make-bigc 1 2) ⇒ 1.000000+2.000000i (make-bigc 1/2 3/2) ⇒ 0.500000+1.500000i
Again, numbers of type ‘bigc’ can be assigned a precision. This precision can be queried and changed at any time.
Return the precision of number as an integer.
Set the precision of number to precision, a nonnegative integer. The new precision of number is returned.
Note that the return value may differ from precision if the underlying library is unable to support exactly precision bits of precision. Note also, that setting the precision is lossy, that means number after setting the precision is not necessarily the same as the original number.
The precision always affects both, the real and the imaginary part. Although supported by the underlying library, SXEmacs will not handle selective precision assignment.
Next: Type bigg, Previous: Type bigfr, Up: Types of Numbers [Contents][Index]