code: static double slowCos(final double x, final double result[]) {
  
          final double xs[] = new double[2];
          final double ys[] = new double[2];
          final double facts[] = new double[2];
          final double as[] = new double[2];
          split(x, xs);
          ys[0] = ys[1] = 0.0;
  
          for (int i = FACT.length-1; i >= 0; i--) {
              splitMult(xs, ys, as);
              ys[0] = as[0]; ys[1] = as[1];
  
              if ( (i & 1) != 0) { // skip odd entries
                  continue;
              }
  
              split(FACT[i], as);
              splitReciprocal(as, facts);
  
              if ( (i & 2) != 0 ) { // alternate terms are negative
                  facts[0] = -facts[0];
                  facts[1] = -facts[1];
              }
  
              splitAdd(ys, facts, as);
              ys[0] = as[0]; ys[1] = as[1];
          }
  
          if (result != null) {
              result[0] = ys[0];
              result[1] = ys[1];
          }
  
          return ys[0] + ys[1];
      }
docs: For x between 0 and pi/4 compute cosine using Talor series
  cos(x) = 1 - x^2/2! + x^4/4! ...
  @param x number from which cosine is requested
  @param result placeholder where to put the result in extended precision
  (may be null)
  @return cos(x)