DevX Home    Premier Club    Search    Newsletters    Skill Building    Code Library    Help    Shop DevX    
   
 Tip of the day
 
 
Java
  Beginner
  Use Math.PI and Math.E for Scientific Calculations
 
Many scientific/trigonometric/mathematical applications need the values of ‘pi’ and ‘e’ (the basis of natural logarithms) for calculations. The math class in the java.lang package has two static double constants that represent values that are closer than any other to these. They can be used in calculations.

Since they are static, they can be used as Math.PI and math.E.
  Santhosh Ananthakrishnan
Centreville, Virginia
 
  If you have a hot tip and we publish it, we'll pay you $25. Be sure to include a clear explanation of what the technique does and why it's useful. If it includes code, limit it to 20 lines if possible. Submit your tips here.

 

Back to JavaZone Back to Java Zone Search Tips Browse Java Tips