All files / complex-js/functions acosh.ts

0% Statements 0/15
0% Branches 0/1
0% Functions 0/1
0% Lines 0/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21                                         
import { IComplex, IComplexConstructor } from '../internal/complex';
import add from '../methods/add';
import mul from '../methods/mul';
import from from './from';
import log from './log';
import sqrt from './sqrt';
 
export default function acosh<T extends IComplex> (Complex: IComplexConstructor<T>, z: IComplex | number, i = 0): T {
  const ONE = from(Complex, 1);
  const NEG_ONE = from(Complex, -1);
 
  const add1 = add(Complex, NEG_ONE, z, i);
  const sqrt1 = sqrt(Complex, add1);
  const add2 = add(Complex, ONE, z, i);
  const sqrt2 = sqrt(Complex, add2);
  const mul1 = mul(Complex, sqrt1, sqrt2);
  const add3 = add(Complex, mul1, z, i);
  
  return log(Complex, add3);
}