Average Error: 58.9 → 33.6
Time: 30.1s
Precision: 64
\[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(0\right)\right)\]
\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\mathsf{log1p}\left(\mathsf{expm1}\left(0\right)\right)
double f(double c0, double w, double h, double D, double d, double M) {
        double r85856 = c0;
        double r85857 = 2.0;
        double r85858 = w;
        double r85859 = r85857 * r85858;
        double r85860 = r85856 / r85859;
        double r85861 = d;
        double r85862 = r85861 * r85861;
        double r85863 = r85856 * r85862;
        double r85864 = h;
        double r85865 = r85858 * r85864;
        double r85866 = D;
        double r85867 = r85866 * r85866;
        double r85868 = r85865 * r85867;
        double r85869 = r85863 / r85868;
        double r85870 = r85869 * r85869;
        double r85871 = M;
        double r85872 = r85871 * r85871;
        double r85873 = r85870 - r85872;
        double r85874 = sqrt(r85873);
        double r85875 = r85869 + r85874;
        double r85876 = r85860 * r85875;
        return r85876;
}

double f(double __attribute__((unused)) c0, double __attribute__((unused)) w, double __attribute__((unused)) h, double __attribute__((unused)) D, double __attribute__((unused)) d, double __attribute__((unused)) M) {
        double r85877 = 0.0;
        double r85878 = expm1(r85877);
        double r85879 = log1p(r85878);
        return r85879;
}

Error

Bits error versus c0

Bits error versus w

Bits error versus h

Bits error versus D

Bits error versus d

Bits error versus M

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.9

    \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)\]
  2. Taylor expanded around inf 35.5

    \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{0}\]
  3. Using strategy rm
  4. Applied log1p-expm1-u35.5

    \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{c0}{2 \cdot w} \cdot 0\right)\right)}\]
  5. Simplified33.6

    \[\leadsto \mathsf{log1p}\left(\color{blue}{\mathsf{expm1}\left(0\right)}\right)\]
  6. Final simplification33.6

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(0\right)\right)\]

Reproduce

herbie shell --seed 2019306 +o rules:numerics
(FPCore (c0 w h D d M)
  :name "Henrywood and Agarwal, Equation (13)"
  :precision binary64
  (* (/ c0 (* 2 w)) (+ (/ (* c0 (* d d)) (* (* w h) (* D D))) (sqrt (- (* (/ (* c0 (* d d)) (* (* w h) (* D D))) (/ (* c0 (* d d)) (* (* w h) (* D D)))) (* M M))))))