Java Reference
In-Depth Information
Chapter 23
Fundamental Operations
Calculator Operations
In this chapter we look at basic mathematical calculations in Java. You can
think of these operations as those typically found in scientific or engineer-
ing calculator. For the purpose of this chapter we classify the fundamental
operations into the following groups:
1. Basic arithmetic: the calculation of absolute value,maximum and mini-
mum,IEEE-style remainder,rounding operations,and obtaining the con-
stants π and e
2. Exponential functions: the calculation of powers and roots
3. Trigonometric functions: the calculation of trigonometric functions and
arc-functions,conversions of radians to degrees and degrees to radians,
and calculation of hyperbolic functions and arc-functions
4. Logarithms: the calculation of common and natural logarithms and the cor-
responding antilogarithms
5. Generation of random numbers
Java Floating-Point Math
Most engineering calculations require decimal numbers. For this reason
our emphasis in this chapter is on floating-point operations. These opera-
tions are located in several classes in the java.lang and java.math packages.
Some of these classes have been discussed in previous chapters. In particu-
lar the classes Double and Float of java.lang,which were mentioned in
Chapter21 ,andtheclasesBigDecimalandBigInteger,whichwerethetopic
of Chapter22 .HerewearemainlyconcernedwiththeclassesMathand
StrictMath of java.math.
Search WWH ::




Custom Search