TARGET LANGUAGE:JAVA
THEORY:(DATA TYPE:Float)
Floating Point Type
Floating point numbers also known as real numbers are used when evaluating expressions that require fractional precision.
Example:
THEORY:(DATA TYPE:Float)
Floating Point Type
Floating point numbers also known as real numbers are used when evaluating expressions that require fractional precision.
Example:
- Calculations such as square root..
Program:
public class CalculateSquareRootWithMathSqrt { public static void main(String[] args) { float a=30; // square root of 16 which equals with 4 System.out.println(Math.sqrt(16)); // square root of 44 which is 6.6332495807108 System.out.println(Math.sqrt(44)); // sin of 30 is -0.9880316240928618 System.out.print(Math.sin(a)); //cos of 30 is 0.15425144988758405 System.out.print(Math.cos(a)); } }
There are two kinds of floating point types Float and double.
Their ranges are specified in the table below.
No comments:
Post a Comment