Chapter 16. Built-in Math Functions


Despite some ill-informed opinions to the contrary, Java is a programming language that is well suited to perform mathematical computations . The Math and StrictMath classes from the java.lang package offer a wide variety of built-in math methods. The capability includes methods to perform absolute value, power, square root, exponential, logarithmic , trigonometric, minimum, maximum, and rounding operations. The Java math methods are based on Institute of Electrical and Electronics Engineers (IEEE) mathematical algorithms.

The java.math package contains two classes that encapsulate variable precision integer and decimal values. These classes allow you to specify how numbers are rounded. The BigDecimal and BigInteger classes are not widely used in scientific and engineering calculations, but a brief discussion of them is presented. At the end of this chapter we will do a one-to-one comparison of the built-in math capabilities of Java, C, C++, and Fortran.

The specific topics we will cover in this chapter are ”

  • Math and StrictMath classes

  • Mathematical constants

  • Absolute value methods

  • Power and square root methods

  • Transcendental math functions

  • Trigonometric methods

  • Conversion methods

  • Minimum and maximum methods

  • Rounding and remainder methods

  • Random number generator methods

  • The java.math package

  • Comparing the built-in math capability of C, C++, Fortran, and Java



Technical Java. Applications for Science and Engineering
Technical Java: Applications for Science and Engineering
ISBN: 0131018159
EAN: 2147483647
Year: 2003
Pages: 281
Authors: Grant Palmer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net