Answer the question
In order to leave comments, you need to log in
How to handle the break point in Math.atan(1/x)?
Implemented the construction of graphs of functions of the form y=... on canvas.
I can not solve one problem, identifying the asymptote of the function y=atan(1/x).
At point zero produces a numeric value, i.e. in javascript, Math.atan(1/0) produces the value 1.5707963267948966 while Math.tan(1/0) produces NaN which can be processed.
How is it possible to bypass this feature of javascript?
Answer the question
In order to leave comments, you need to log in
function atan (num) {
if (num === Infinity || num === -Infinity)
return NaN;
return Math.atan(num);
}
atan(1/0); // NaN
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question