Atan function not working correctly?

i am trying the inverse tangent function in processing java,
i am using the atan(float) function,
when i use a paramater around 100 / 70 i am getting the wrong result,
this is true for atan(100 / 75), atan(100 / 80) and so on…
converted to degrees, it always returns 45 degrees, which it does not on the windows calculator.

am i doing something wrong or is this not the function i am looking for when needing an inverse tangent?
thanks in advance

1 Like

Try out atan(100 / 75.0) & atan(100.0 / 80) instead, so it’s not integer division anymore! :bulb:


Thank you very much for this, rookie mistake!

I still make that mistake every so often but catch them. :slight_smile:

There is also an atan2()



Try this:

println(atan2(100, 75));  //You are still passing a float. See references.