Phootip
Phootip

Reputation: 186

java, How to calculate degree from tan

I'm using java. I have a tan value. I really surprise that I can't find a way to turn it into degree. I already search but only find a way to turn degree into tan. please help.

Upvotes: 5

Views: 6820

Answers (2)

paxdiablo
paxdiablo

Reputation: 882136

The function you're looking for is double atan(double tangent) which, given the tangent, will return the angle in radians.

From there, you can simply multiply it by 180 / PI to get degrees or, better yet, use the inbuilt double toDegrees(double radians).

In other words, something like (assuming you've bought in java.lang.Math):

double degs = toDegrees(atan(tangent));

Upvotes: 7

TigOldBitties
TigOldBitties

Reputation: 1337

tan^-1 of value and some more text because it's too short.

Upvotes: -3

Related Questions