code: public static double toDegrees(double x)
      {
          if (Double.isInfinite(x) || x == 0.0) { // Matches +/- 0.0; return correct sign
              return x;
          }
  
          // These are 180/PI split into high and low order bits
          final double facta = 57.2957763671875;
          final double factb = 3.145894820876798E-6;
  
          double xa = doubleHighPart(x);
          double xb = x - xa;
  
          return xb * factb + xb * facta + xa * factb + xa * facta;
      }
docs: Convert radians to degrees, with error of less than 0.5 ULP
  @param x angle in radians
  @return x converted into degrees