I follow the example of a problem from the Internet, but the area is not the same as in the task, why I can not understand. enter image description here

enter image description here

Closed due to the fact that off-topic participants Kromster , freim , aleksandr barakin , 0xdb , arg May 12 at 20:14 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - aleksandr barakin, 0xdb
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Better insert the code itself instead of a screenshot - Yernar

1 answer 1

See the root example here and the cosine example here . You do not get the cosine correctly. It is necessary, as indicated in the example above, to transfer radians, not degrees.

double degrees = 120.0; double cos = Math.toRadians(degrees); 
  • Thanks, it turned out;) - Alexander
  • Mark, then, please, that the answer is accepted - Dred
  • purely for educational purposes it would be worth adding that radians = PI/180*degrees; - Stranger in the Q