Average Error: 59.7 → 23.3
Time: 21.2s
Precision: binary64
\[\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) \]
\[\begin{array}{l} t_0 := \frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}}\\ \mathbf{if}\;M \cdot M \leq 8.501049133625495 \cdot 10^{+307}:\\ \;\;\;\;0.25 \cdot \left(t_0 \cdot \left(\left(\frac{D}{d} \cdot h\right) \cdot \frac{M \cdot M}{\sqrt[3]{d}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(t_0 \cdot \left(\frac{D}{\sqrt[3]{d}} \cdot \frac{M \cdot \left(M \cdot h\right)}{d}\right)\right)\\ \end{array} \]
\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)
\begin{array}{l}
t_0 := \frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}}\\
\mathbf{if}\;M \cdot M \leq 8.501049133625495 \cdot 10^{+307}:\\
\;\;\;\;0.25 \cdot \left(t_0 \cdot \left(\left(\frac{D}{d} \cdot h\right) \cdot \frac{M \cdot M}{\sqrt[3]{d}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(t_0 \cdot \left(\frac{D}{\sqrt[3]{d}} \cdot \frac{M \cdot \left(M \cdot h\right)}{d}\right)\right)\\


\end{array}
(FPCore (c0 w h D d M)
 :precision binary64
 (*
  (/ c0 (* 2.0 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))))))
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ D (* (cbrt d) (cbrt d)))))
   (if (<= (* M M) 8.501049133625495e+307)
     (* 0.25 (* t_0 (* (* (/ D d) h) (/ (* M M) (cbrt d)))))
     (* 0.25 (* t_0 (* (/ D (cbrt d)) (/ (* M (* M h)) d)))))))
double code(double c0, double w, double h, double D, double d, double M) {
	return (c0 / (2.0 * 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)));
}
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = D / (cbrt(d) * cbrt(d));
	double tmp;
	if ((M * M) <= 8.501049133625495e+307) {
		tmp = 0.25 * (t_0 * (((D / d) * h) * ((M * M) / cbrt(d))));
	} else {
		tmp = 0.25 * (t_0 * ((D / cbrt(d)) * ((M * (M * h)) / d)));
	}
	return tmp;
}

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. Split input into 2 regimes
  2. if (*.f64 M M) < 8.5010491336254954e307

    1. Initial program 59.0

      \[\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 in c0 around -inf 31.1

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}} \]
    3. Applied add-sqr-sqrt_binary6447.8

      \[\leadsto 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{\color{blue}{\left(\sqrt{d} \cdot \sqrt{d}\right)}}^{2}} \]
    4. Applied unpow-prod-down_binary6447.8

      \[\leadsto 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{{\left(\sqrt{d}\right)}^{2} \cdot {\left(\sqrt{d}\right)}^{2}}} \]
    5. Applied times-frac_binary6445.9

      \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{\left(\sqrt{d}\right)}^{2}} \cdot \frac{{M}^{2} \cdot h}{{\left(\sqrt{d}\right)}^{2}}\right)} \]
    6. Simplified45.9

      \[\leadsto 0.25 \cdot \left(\color{blue}{\frac{D \cdot D}{d}} \cdot \frac{{M}^{2} \cdot h}{{\left(\sqrt{d}\right)}^{2}}\right) \]
    7. Simplified27.4

      \[\leadsto 0.25 \cdot \left(\frac{D \cdot D}{d} \cdot \color{blue}{\frac{h \cdot \left(M \cdot M\right)}{d}}\right) \]
    8. Applied add-cube-cbrt_binary6427.4

      \[\leadsto 0.25 \cdot \left(\frac{D \cdot D}{\color{blue}{\left(\sqrt[3]{d} \cdot \sqrt[3]{d}\right) \cdot \sqrt[3]{d}}} \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\right) \]
    9. Applied times-frac_binary6424.3

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}} \cdot \frac{D}{\sqrt[3]{d}}\right)} \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\right) \]
    10. Applied associate-*l*_binary6422.4

      \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}} \cdot \left(\frac{D}{\sqrt[3]{d}} \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\right)\right)} \]
    11. Applied add-cube-cbrt_binary6422.5

      \[\leadsto 0.25 \cdot \left(\frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}} \cdot \left(\frac{D}{\sqrt[3]{d}} \cdot \frac{h \cdot \left(M \cdot M\right)}{\color{blue}{\left(\sqrt[3]{d} \cdot \sqrt[3]{d}\right) \cdot \sqrt[3]{d}}}\right)\right) \]
    12. Applied times-frac_binary6421.6

      \[\leadsto 0.25 \cdot \left(\frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}} \cdot \left(\frac{D}{\sqrt[3]{d}} \cdot \color{blue}{\left(\frac{h}{\sqrt[3]{d} \cdot \sqrt[3]{d}} \cdot \frac{M \cdot M}{\sqrt[3]{d}}\right)}\right)\right) \]
    13. Applied associate-*r*_binary6420.6

      \[\leadsto 0.25 \cdot \left(\frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}} \cdot \color{blue}{\left(\left(\frac{D}{\sqrt[3]{d}} \cdot \frac{h}{\sqrt[3]{d} \cdot \sqrt[3]{d}}\right) \cdot \frac{M \cdot M}{\sqrt[3]{d}}\right)}\right) \]
    14. Simplified19.7

      \[\leadsto 0.25 \cdot \left(\frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}} \cdot \left(\color{blue}{\left(\frac{D}{d} \cdot h\right)} \cdot \frac{M \cdot M}{\sqrt[3]{d}}\right)\right) \]

    if 8.5010491336254954e307 < (*.f64 M M)

    1. Initial program 64.0

      \[\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 in c0 around -inf 64.0

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}} \]
    3. Applied add-sqr-sqrt_binary6464.0

      \[\leadsto 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{\color{blue}{\left(\sqrt{d} \cdot \sqrt{d}\right)}}^{2}} \]
    4. Applied unpow-prod-down_binary6464.0

      \[\leadsto 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{{\left(\sqrt{d}\right)}^{2} \cdot {\left(\sqrt{d}\right)}^{2}}} \]
    5. Applied times-frac_binary6463.9

      \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{\left(\sqrt{d}\right)}^{2}} \cdot \frac{{M}^{2} \cdot h}{{\left(\sqrt{d}\right)}^{2}}\right)} \]
    6. Simplified63.9

      \[\leadsto 0.25 \cdot \left(\color{blue}{\frac{D \cdot D}{d}} \cdot \frac{{M}^{2} \cdot h}{{\left(\sqrt{d}\right)}^{2}}\right) \]
    7. Simplified63.9

      \[\leadsto 0.25 \cdot \left(\frac{D \cdot D}{d} \cdot \color{blue}{\frac{h \cdot \left(M \cdot M\right)}{d}}\right) \]
    8. Applied add-cube-cbrt_binary6463.9

      \[\leadsto 0.25 \cdot \left(\frac{D \cdot D}{\color{blue}{\left(\sqrt[3]{d} \cdot \sqrt[3]{d}\right) \cdot \sqrt[3]{d}}} \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\right) \]
    9. Applied times-frac_binary6463.9

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}} \cdot \frac{D}{\sqrt[3]{d}}\right)} \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\right) \]
    10. Applied associate-*l*_binary6463.9

      \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}} \cdot \left(\frac{D}{\sqrt[3]{d}} \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\right)\right)} \]
    11. Applied associate-*r*_binary6445.0

      \[\leadsto 0.25 \cdot \left(\frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}} \cdot \left(\frac{D}{\sqrt[3]{d}} \cdot \frac{\color{blue}{\left(h \cdot M\right) \cdot M}}{d}\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification23.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \cdot M \leq 8.501049133625495 \cdot 10^{+307}:\\ \;\;\;\;0.25 \cdot \left(\frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}} \cdot \left(\left(\frac{D}{d} \cdot h\right) \cdot \frac{M \cdot M}{\sqrt[3]{d}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}} \cdot \left(\frac{D}{\sqrt[3]{d}} \cdot \frac{M \cdot \left(M \cdot h\right)}{d}\right)\right)\\ \end{array} \]

Reproduce

herbie shell --seed 2022095 
(FPCore (c0 w h D d M)
  :name "Henrywood and Agarwal, Equation (13)"
  :precision binary64
  (* (/ c0 (* 2.0 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))))))