Complex data type
| This is an old revision of this page, as edited by 189.233.49.214 (talk) at 19:49, 31 October 2009 (added phyton as implementing language). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision. |
Some programming languages provide a complex data type for complex number storage and arithmetic as a built-in (primitive) data type.
In some programming environments the term complex data type (in contrast to primitive data types) is a synonym to the composite data type.[1][2]
Complex number arithmetic
A complex variable or value is usually represented as a pair of floating point numbers. Languages that support a complex data type usually provide special syntax for building such values, and extend the basic arithmetic operations ('+', '−', '×', '/') to act on them. These operations are usually translated by the compiler into a sequence of floating-point machine instructions or into library calls. Those languages may also provide support for other operations, such as formatting, equality testing, etc. As in mathematics, those languages often interpret a floating-point value as equivalent to a complex value with a zero imaginary part.
Programming Languages
- Common Lisp: The ANSI Common Lisp standard supports complex numbers of floats and arbitrary precision integers. Its basic mathematical functions are defined for complex numbers, where applicable. For example the square root of -1 is a complex number:
? (sqrt -1) #C(0 1) ; the result of (sqrt -1)
- Phyton: It has the built in data type
complexwith the double (as in C) precision on each, real and imaginary, part.[3]
History
The COMPLEX data type was provided in FORTRAN IV.[citation needed]
References
|
||||||||||||||||||||||||||||||
| This computer science article is a stub. You can help Wikipedia by expanding it. |