Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.math

 
Olivier Legat
Ranch Hand
Posts: 176
Chrome Mac Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any imports in java that I can use to perform functions like logarithms, e^x, cos, sin, tan, square root ... etc. I've looked up the java sun webpage at the import java.math but the only useful thing I found was pow(int expo). Is there any way I can get those other complex functions? I really need them. Just the name of an import would be very much appreciated.
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most of the basic math functions, such as cos, sin, tan, acos, asin, atan, etc should be inside the math package. If you're looking for a very complex math functions, should can take a look at http://commons.apache.org/math/
 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Olivier Legat:
Is there any imports in java that I can use to perform functions like logarithms, e^x, cos, sin, tan, square root ... etc. I've looked up the java sun webpage at the import java.math but the only useful thing I found was pow(int expo). Is there any way I can get those other complex functions? I really need them. Just the name of an import would be very much appreciated.


You already got the answer for your question. Please take a close look at the methods in java.lang.math(which you stated as your subject)

Here is the link which you already come through.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Balasubramanian Chandrasekaran:
You already got the answer for your question. Please take a close look at the methods in java.lang.math(which you stated as your subject)

Actually, he hasn't found what he's looking for. Note that he mentioned the java.math package (which doesn't have trigonometric functions). The functions he's looking for are in the java.lang.Math class as you pointed out.
 
Olivier Legat
Ranch Hand
Posts: 176
Chrome Mac Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh great! Thanks Ulf Dittmer, this is exactly what I need
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic