Table of Contents Author Guidelines Submit a Manuscript
Scientific Programming
Volume 2, Issue 3, Pages 77-106

Handling of Complex Numbers in the CH Programming Language

Harry H. Cheng

Department of Mechanical and Aeronautical Engineering, University of California, Davis, CA 95616, USA

Received 28 October 1992; Accepted 28 May 1993

Copyright © 1993 Hindawi Publishing Corporation. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.


The handling of complex numbers in the CH programming language will be described in this paper. Complex is a built-in data type in CH. The I/O, arithmetic and relational operations, and built-in mathematical functions are defined for both regular complex numbers and complex metanumbers of ComplexZero, Complexlnf, and ComplexNaN. Due to polymorphism, the syntax of complex arithmetic and relational operations and built-in mathematical functions are the same as those for real numbers. Besides polymorphism, the built-in mathematical functions are implemented with a variable number of arguments that greatly simplify computations of different branches of multiple-valued complex functions. The valid lvalues related to complex numbers are defined. Rationales for the design of complex features in CH are discussed from language design, implementation, and application points of views. Sample CH programs show that a computer language that does not distinguish the sign of zeros in complex numbers can also handle the branch cuts of multiple-valued complex functions effectively so long as it is appropriately designed and implemented.