realpart, imagpart  real and imaginary parts of a complex number
LIBRARY
(import (rnrs)) ;R6RS
(import (rnrs base)) ;R6RS
(import (scheme r5rs)) ;R7RS
(import (scheme complex)) ;R7RS, optional library
SYNOPSIS
(realpart z)
(imagpart z)
DESCRIPTION
If z is the complex number a+bi, then the
realpart
procedure returns
a
and
imagpart
returns
b.
IMPLEMENTATION NOTES
See the notes in
makerectangular(3scm).
RETURN VALUES
These procedures return a single value, a real number.
EXAMPLES
(realpart 1.1+2.2i) => 1.1 ;approximately
(imagpart 1.1+2.2i) => 2.2 ;approximately
(realpart 2+3i) => 2 or 2.0
(imagpart 2+3i) => 3 or 3.0
(imagpart 42) => 0 or 0.0
COMPATIBILITY
All R6RS implementations support complex numbers. Implementations of
the other RnRS reports may or may not support complex numbers. In such
cases these procedures will be missing.
ERRORS
This procedure can raise exceptions with the following condition types:
 &assertion (R6RS)

The wrong number of arguments was passed or an argument was outside its domain.
 R7RS

The assertions described above are errors.
Implementations may signal an error, extend the procedure's
domain of definition to include such arguments,
or fail catastrophically.
SEE ALSO
makerectangular(3scm),
angle(3scm)
STANDARDS
R4RS,
IEEE Scheme,
R5RS,
R6RS,
R7RS
HISTORY
These procedures first appeared in R2RS, which got them from Common Lisp,
where they are called
realpart
and
imagpart.
AUTHORS
This page is part of the
schememanpages
project.
It includes materials from the RnRS documents.
More information can be found at
https://github.com/schemedoc/manpages/
.
Markup created by unroff 1.0sc, March 04, 2023.