Average Error: 14.0 → 7.5
Time: 11.0s
Precision: binary64
\[ \begin{array}{c}[M, D] = \mathsf{sort}([M, D])\\ \end{array} \]
\[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
\[\begin{array}{l} t_0 := w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\\ \mathbf{if}\;t_0 \leq -\infty:\\ \;\;\;\;w0 \cdot {\left({\left(e^{0.25}\right)}^{\left(\log \left(\left(\frac{h}{\ell} \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot -0.25\right) + \log \left(\frac{-1}{M}\right) \cdot -2\right)}\right)}^{2}\\ \mathbf{elif}\;t_0 \leq 6.874178835402741 \cdot 10^{+263}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot {\left({\left(1 - \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\ell} \cdot \left(h \cdot \left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)\right)\right)}^{0.25}\right)}^{2}\\ \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
(FPCore (w0 M D h l d)
 :precision binary64
 (let* ((t_0
         (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)))))))
   (if (<= t_0 (- INFINITY))
     (*
      w0
      (pow
       (pow
        (exp 0.25)
        (+
         (log (* (* (/ h l) (* (/ D d) (/ D d))) -0.25))
         (* (log (/ -1.0 M)) -2.0)))
       2.0))
     (if (<= t_0 6.874178835402741e+263)
       t_0
       (*
        w0
        (pow
         (pow
          (- 1.0 (* (/ (* D (* 0.5 (/ M d))) l) (* h (* (/ M d) (* D 0.5)))))
          0.25)
         2.0))))))
double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = w0 * pow(pow(exp(0.25), (log((((h / l) * ((D / d) * (D / d))) * -0.25)) + (log((-1.0 / M)) * -2.0))), 2.0);
	} else if (t_0 <= 6.874178835402741e+263) {
		tmp = t_0;
	} else {
		tmp = w0 * pow(pow((1.0 - (((D * (0.5 * (M / d))) / l) * (h * ((M / d) * (D * 0.5))))), 0.25), 2.0);
	}
	return tmp;
}
public static double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
public static double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = w0 * Math.pow(Math.pow(Math.exp(0.25), (Math.log((((h / l) * ((D / d) * (D / d))) * -0.25)) + (Math.log((-1.0 / M)) * -2.0))), 2.0);
	} else if (t_0 <= 6.874178835402741e+263) {
		tmp = t_0;
	} else {
		tmp = w0 * Math.pow(Math.pow((1.0 - (((D * (0.5 * (M / d))) / l) * (h * ((M / d) * (D * 0.5))))), 0.25), 2.0);
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
def code(w0, M, D, h, l, d):
	t_0 = w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
	tmp = 0
	if t_0 <= -math.inf:
		tmp = w0 * math.pow(math.pow(math.exp(0.25), (math.log((((h / l) * ((D / d) * (D / d))) * -0.25)) + (math.log((-1.0 / M)) * -2.0))), 2.0)
	elif t_0 <= 6.874178835402741e+263:
		tmp = t_0
	else:
		tmp = w0 * math.pow(math.pow((1.0 - (((D * (0.5 * (M / d))) / l) * (h * ((M / d) * (D * 0.5))))), 0.25), 2.0)
	return tmp
function code(w0, M, D, h, l, d)
	return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)))))
end
function code(w0, M, D, h, l, d)
	t_0 = Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)))))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(w0 * ((exp(0.25) ^ Float64(log(Float64(Float64(Float64(h / l) * Float64(Float64(D / d) * Float64(D / d))) * -0.25)) + Float64(log(Float64(-1.0 / M)) * -2.0))) ^ 2.0));
	elseif (t_0 <= 6.874178835402741e+263)
		tmp = t_0;
	else
		tmp = Float64(w0 * ((Float64(1.0 - Float64(Float64(Float64(D * Float64(0.5 * Float64(M / d))) / l) * Float64(h * Float64(Float64(M / d) * Float64(D * 0.5))))) ^ 0.25) ^ 2.0));
	end
	return tmp
end
function tmp = code(w0, M, D, h, l, d)
	tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l))));
end
function tmp_2 = code(w0, M, D, h, l, d)
	t_0 = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l))));
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = w0 * ((exp(0.25) ^ (log((((h / l) * ((D / d) * (D / d))) * -0.25)) + (log((-1.0 / M)) * -2.0))) ^ 2.0);
	elseif (t_0 <= 6.874178835402741e+263)
		tmp = t_0;
	else
		tmp = w0 * (((1.0 - (((D * (0.5 * (M / d))) / l) * (h * ((M / d) * (D * 0.5))))) ^ 0.25) ^ 2.0);
	end
	tmp_2 = tmp;
end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(w0 * N[Power[N[Power[N[Exp[0.25], $MachinePrecision], N[(N[Log[N[(N[(N[(h / l), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] + N[(N[Log[N[(-1.0 / M), $MachinePrecision]], $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 6.874178835402741e+263], t$95$0, N[(w0 * N[Power[N[Power[N[(1.0 - N[(N[(N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(h * N[(N[(M / d), $MachinePrecision] * N[(D * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\begin{array}{l}
t_0 := w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;w0 \cdot {\left({\left(e^{0.25}\right)}^{\left(\log \left(\left(\frac{h}{\ell} \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot -0.25\right) + \log \left(\frac{-1}{M}\right) \cdot -2\right)}\right)}^{2}\\

\mathbf{elif}\;t_0 \leq 6.874178835402741 \cdot 10^{+263}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;w0 \cdot {\left({\left(1 - \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\ell} \cdot \left(h \cdot \left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)\right)\right)}^{0.25}\right)}^{2}\\


\end{array}

Error

Bits error versus w0

Bits error versus M

Bits error versus D

Bits error versus h

Bits error versus l

Bits error versus d

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))))) < -inf.0

    1. Initial program 64.0

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Simplified61.8

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(M \cdot \frac{D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    3. Applied egg-rr56.7

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{1}{\frac{\ell}{{\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2} \cdot h}}}} \]
    4. Applied egg-rr61.3

      \[\leadsto w0 \cdot \color{blue}{{\left({\left(1 - \frac{{\left(D \cdot \left(\frac{0.5}{d} \cdot M\right)\right)}^{2}}{\frac{\ell}{h}}\right)}^{0.25}\right)}^{2}} \]
    5. Applied egg-rr51.5

      \[\leadsto w0 \cdot {\left({\left(1 - \color{blue}{\frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\ell} \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{1}{h}}}\right)}^{0.25}\right)}^{2} \]
    6. Taylor expanded in M around -inf 57.4

      \[\leadsto w0 \cdot {\color{blue}{\left(e^{0.25 \cdot \left(\log \left(-0.25 \cdot \frac{{D}^{2} \cdot h}{\ell \cdot {d}^{2}}\right) - 2 \cdot \log \left(\frac{-1}{M}\right)\right)}\right)}}^{2} \]
    7. Simplified50.1

      \[\leadsto w0 \cdot {\color{blue}{\left({\left(e^{0.25}\right)}^{\left(\log \left(\left(\frac{h}{\ell} \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot -0.25\right) + \log \left(\frac{-1}{M}\right) \cdot -2\right)}\right)}}^{2} \]

    if -inf.0 < (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))))) < 6.8741788354027406e263

    1. Initial program 0.1

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]

    if 6.8741788354027406e263 < (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)))))

    1. Initial program 53.0

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Simplified50.7

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(M \cdot \frac{D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    3. Applied egg-rr32.1

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{1}{\frac{\ell}{{\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2} \cdot h}}}} \]
    4. Applied egg-rr48.8

      \[\leadsto w0 \cdot \color{blue}{{\left({\left(1 - \frac{{\left(D \cdot \left(\frac{0.5}{d} \cdot M\right)\right)}^{2}}{\frac{\ell}{h}}\right)}^{0.25}\right)}^{2}} \]
    5. Applied egg-rr22.6

      \[\leadsto w0 \cdot {\left({\left(1 - \color{blue}{\frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\ell} \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\frac{1}{h}}}\right)}^{0.25}\right)}^{2} \]
    6. Applied egg-rr22.6

      \[\leadsto w0 \cdot {\left({\left(1 - \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\ell} \cdot \color{blue}{\left(\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right) \cdot h\right)}\right)}^{0.25}\right)}^{2} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification7.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \leq -\infty:\\ \;\;\;\;w0 \cdot {\left({\left(e^{0.25}\right)}^{\left(\log \left(\left(\frac{h}{\ell} \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \cdot -0.25\right) + \log \left(\frac{-1}{M}\right) \cdot -2\right)}\right)}^{2}\\ \mathbf{elif}\;w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \leq 6.874178835402741 \cdot 10^{+263}:\\ \;\;\;\;w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot {\left({\left(1 - \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\ell} \cdot \left(h \cdot \left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)\right)\right)}^{0.25}\right)}^{2}\\ \end{array} \]

Reproduce

herbie shell --seed 2022153 
(FPCore (w0 M D h l d)
  :name "Henrywood and Agarwal, Equation (9a)"
  :precision binary64
  (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))