Abstract

The handling of complex numbers in the CHprogramming 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 CHare discussed from language design, implementation, and application points of views. Sample CHprograms 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.

Highlights

  • Cheng [1] presented the extension of C to CH, a general-purpose block-structured interpretive programming language for the numerical computation of real numbers

  • The results of complex functions involving complex metanumbers will be discussed . ln Table 8. the principal value 0 of the argument of a complex number is in the range of -rr < 0 :S rr

  • Note that the trigonometric function atan2(y, x) is in the range of -rr :S atan2(J·. x) :S rr. ~ormally. through complex arithmetic and complex functions. one shall not get a complex number with its real or imaginary part being the value of -lnf

Read more

Summary

INTRODUCTION

Cheng [1] presented the extension of C to CH, a general-purpose block-structured interpretive programming language for the numerical computation of real numbers. The reason for providing complex as a basic data type is for programming convenience, and for design considerations Design considerations such as automatic data conversion, handling of metanumbers, and optional arguments in a function are difficult to implement at a user's program level even for a language like c++ with operator and function overloading capabilities. Variable x is used to represent the real part of a complex number and y the imaginary part; FLT_MAX, a predefined system constant, is the maximum representable finite floating-point number in the float data type.

Complex Constants and Complex Variables
Data Conversion Rules
Complex Operations With Regular Complex Numbers
Complex Operations With Complex Metanumbers
COMPLEX FUNCTIONS
Results of Complex Functions With Regular Complex Numbers
C11 Syntax
Results of Complex Functions With Complex Metanumbers
LVALUE RELATED TO COMPLEX NUMBERS
RATIONALE BEHIND CH
No Unanticipated Complex Values
Programming Complex Numbers Over the Extended Finite Complex Plane
Application Examples Involving Branch Cuts
CONCLUSIONS
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call