I'm trying to insert hyperbolic functions into my Calculator application in Java. So far, everything has been good except for the inverse hyperbolic functions for secant and cosecant.
The formulas from the picture vs. the code for inverse hyperbolic secant and cosecant, look the same. But vs. a TI-84 Calculator calculation(1.134592657 for cosecant(1)), my calculator yields 0.8813735870195429 for cosecant(1) which is incorrect. As for secant(2)(.7593257175 for the TI-Calculator), my calculator yields NaN for secant(2). Even though they look the same, why don't they function the same?

Code:
void acsch(double x)
{
control.currentNumber = Math.log((1/x) + (Math.sqrt((1/(x*x)) + 1.0)));
}
void asech(double x)
{
control.currentNumber = Math.log((1/x) + Math.sqrt((1/(x*x)) - 1.0));
}