?

Average Error: 59.4 → 19.8
Time: 32.2s
Precision: binary64
Cost: 14152

?

\[\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{\frac{d}{D}}{\sqrt{M}}\\ \mathbf{if}\;M \leq 9.5 \cdot 10^{-298}:\\ \;\;\;\;0.25 \cdot \frac{\frac{D}{d} \cdot \left(M \cdot h\right)}{\frac{\frac{d}{D}}{M}}\\ \mathbf{elif}\;M \leq 2.3 \cdot 10^{-268}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \left(\frac{d}{D \cdot w} \cdot \frac{d}{D \cdot h}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\frac{h}{t_0} \cdot \frac{M}{t_0}\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 D) (sqrt M))))
   (if (<= M 9.5e-298)
     (* 0.25 (/ (* (/ D d) (* M h)) (/ (/ d D) M)))
     (if (<= M 2.3e-268)
       (* (/ c0 (* 2.0 w)) (* 2.0 (* c0 (* (/ d (* D w)) (/ d (* D h))))))
       (* 0.25 (* (/ h t_0) (/ M t_0)))))))
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 / D) / sqrt(M);
	double tmp;
	if (M <= 9.5e-298) {
		tmp = 0.25 * (((D / d) * (M * h)) / ((d / D) / M));
	} else if (M <= 2.3e-268) {
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * ((d / (D * w)) * (d / (D * h)))));
	} else {
		tmp = 0.25 * ((h / t_0) * (M / t_0));
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    code = (c0 / (2.0d0 * w)) * (((c0 * (d_1 * d_1)) / ((w * h) * (d * d))) + sqrt(((((c0 * (d_1 * d_1)) / ((w * h) * (d * d))) * ((c0 * (d_1 * d_1)) / ((w * h) * (d * d)))) - (m * m))))
end function
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (d_1 / d) / sqrt(m)
    if (m <= 9.5d-298) then
        tmp = 0.25d0 * (((d / d_1) * (m * h)) / ((d_1 / d) / m))
    else if (m <= 2.3d-268) then
        tmp = (c0 / (2.0d0 * w)) * (2.0d0 * (c0 * ((d_1 / (d * w)) * (d_1 / (d * h)))))
    else
        tmp = 0.25d0 * ((h / t_0) * (m / t_0))
    end if
    code = tmp
end function
public static 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))) + Math.sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M))));
}
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (d / D) / Math.sqrt(M);
	double tmp;
	if (M <= 9.5e-298) {
		tmp = 0.25 * (((D / d) * (M * h)) / ((d / D) / M));
	} else if (M <= 2.3e-268) {
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * ((d / (D * w)) * (d / (D * h)))));
	} else {
		tmp = 0.25 * ((h / t_0) * (M / t_0));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	return (c0 / (2.0 * w)) * (((c0 * (d * d)) / ((w * h) * (D * D))) + math.sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M))))
def code(c0, w, h, D, d, M):
	t_0 = (d / D) / math.sqrt(M)
	tmp = 0
	if M <= 9.5e-298:
		tmp = 0.25 * (((D / d) * (M * h)) / ((d / D) / M))
	elif M <= 2.3e-268:
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * ((d / (D * w)) * (d / (D * h)))))
	else:
		tmp = 0.25 * ((h / t_0) * (M / t_0))
	return tmp
function code(c0, w, h, D, d, M)
	return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) + sqrt(Float64(Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) * Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))) - Float64(M * M)))))
end
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(d / D) / sqrt(M))
	tmp = 0.0
	if (M <= 9.5e-298)
		tmp = Float64(0.25 * Float64(Float64(Float64(D / d) * Float64(M * h)) / Float64(Float64(d / D) / M)));
	elseif (M <= 2.3e-268)
		tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(c0 * Float64(Float64(d / Float64(D * w)) * Float64(d / Float64(D * h))))));
	else
		tmp = Float64(0.25 * Float64(Float64(h / t_0) * Float64(M / t_0)));
	end
	return tmp
end
function tmp = code(c0, w, h, D, d, M)
	tmp = (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))));
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (d / D) / sqrt(M);
	tmp = 0.0;
	if (M <= 9.5e-298)
		tmp = 0.25 * (((D / d) * (M * h)) / ((d / D) / M));
	elseif (M <= 2.3e-268)
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * ((d / (D * w)) * (d / (D * h)))));
	else
		tmp = 0.25 * ((h / t_0) * (M / t_0));
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(N[(N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(d / D), $MachinePrecision] / N[Sqrt[M], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 9.5e-298], N[(0.25 * N[(N[(N[(D / d), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] / N[(N[(d / D), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 2.3e-268], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(c0 * N[(N[(d / N[(D * w), $MachinePrecision]), $MachinePrecision] * N[(d / N[(D * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(h / t$95$0), $MachinePrecision] * N[(M / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\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{\frac{d}{D}}{\sqrt{M}}\\
\mathbf{if}\;M \leq 9.5 \cdot 10^{-298}:\\
\;\;\;\;0.25 \cdot \frac{\frac{D}{d} \cdot \left(M \cdot h\right)}{\frac{\frac{d}{D}}{M}}\\

\mathbf{elif}\;M \leq 2.3 \cdot 10^{-268}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \left(\frac{d}{D \cdot w} \cdot \frac{d}{D \cdot h}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\frac{h}{t_0} \cdot \frac{M}{t_0}\right)\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 3 regimes
  2. if M < 9.50000000000000012e-298

    1. Initial program 59.3

      \[\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. Simplified61.7

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{\frac{c0}{w}}{D \cdot \left(h \cdot D\right)}, \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \left(\frac{d}{D} \cdot {\left(\frac{d}{D}\right)}^{3}\right) \cdot \frac{c0}{w \cdot h}, -M \cdot M\right)}\right)} \]
      Proof

      [Start]59.3

      \[ \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) \]

      associate-*l/ [<=]59.8

      \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\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) \]

      *-commutative [=>]59.8

      \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(d \cdot d\right) \cdot \frac{c0}{\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) \]

      fma-def [=>]60.5

      \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(d \cdot d, \frac{c0}{\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)} \]

      associate-*l* [=>]60.8

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\color{blue}{w \cdot \left(h \cdot \left(D \cdot D\right)\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) \]

      associate-/r* [=>]60.8

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \color{blue}{\frac{\frac{c0}{w}}{h \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) \]

      associate-*r* [=>]60.8

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{\frac{c0}{w}}{\color{blue}{\left(h \cdot D\right) \cdot D}}, \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) \]

      *-commutative [=>]60.8

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{\frac{c0}{w}}{\color{blue}{D \cdot \left(h \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) \]
    3. Taylor expanded in c0 around -inf 59.7

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0} + -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
    4. Simplified35.1

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{\frac{w \cdot \left(M \cdot \left(M \cdot h\right)\right)}{{\left(\frac{d}{D}\right)}^{2}}}{c0}, c0 \cdot 0\right)} \]
      Proof

      [Start]59.7

      \[ \frac{c0}{2 \cdot w} \cdot \left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0} + -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]

      fma-def [=>]59.7

      \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
    5. Taylor expanded in c0 around 0 36.0

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

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

      [Start]36.0

      \[ 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}} \]

      *-commutative [<=]36.0

      \[ 0.25 \cdot \frac{{D}^{2} \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}}{{d}^{2}} \]

      associate-/l* [=>]36.0

      \[ 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{h \cdot {M}^{2}}}} \]

      unpow2 [=>]36.0

      \[ 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2}}{h \cdot {M}^{2}}} \]

      unpow2 [=>]36.0

      \[ 0.25 \cdot \frac{D \cdot D}{\frac{\color{blue}{d \cdot d}}{h \cdot {M}^{2}}} \]

      *-commutative [=>]36.0

      \[ 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{\color{blue}{{M}^{2} \cdot h}}} \]

      unpow2 [=>]36.0

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

      associate-*r* [<=]34.1

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

      associate-/r/ [=>]34.1

      \[ 0.25 \cdot \color{blue}{\left(\frac{D \cdot D}{d \cdot d} \cdot \left(M \cdot \left(M \cdot h\right)\right)\right)} \]
    7. Applied egg-rr26.2

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)} \cdot \left(M \cdot \left(M \cdot h\right)\right)\right) \]
    8. Applied egg-rr19.1

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

    if 9.50000000000000012e-298 < M < 2.3000000000000001e-268

    1. Initial program 52.8

      \[\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. Simplified53.2

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
      Proof

      [Start]52.8

      \[ \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) \]

      times-frac [=>]55.6

      \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \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) \]

      fma-neg [=>]55.6

      \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]

      times-frac [=>]55.2

      \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\mathsf{fma}\left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}\right) \]

      times-frac [=>]53.2

      \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}}, -M \cdot M\right)}\right) \]
    3. Taylor expanded in c0 around inf 55.7

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(2 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right)} \]
    4. Simplified50.0

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(2 \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2}}{w \cdot h} \cdot c0\right)\right)} \]
      Proof

      [Start]55.7

      \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \]

      associate-/l* [=>]56.1

      \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\frac{{d}^{2}}{\frac{{D}^{2} \cdot \left(w \cdot h\right)}{c0}}}\right) \]

      associate-/r/ [=>]56.4

      \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} \cdot c0\right)}\right) \]

      associate-/r* [=>]56.5

      \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{w \cdot h}} \cdot c0\right)\right) \]

      unpow2 [=>]56.5

      \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{\color{blue}{d \cdot d}}{{D}^{2}}}{w \cdot h} \cdot c0\right)\right) \]

      unpow2 [=>]56.5

      \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{d \cdot d}{\color{blue}{D \cdot D}}}{w \cdot h} \cdot c0\right)\right) \]

      times-frac [=>]50.0

      \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\color{blue}{\frac{d}{D} \cdot \frac{d}{D}}}{w \cdot h} \cdot c0\right)\right) \]

      unpow2 [<=]50.0

      \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\color{blue}{{\left(\frac{d}{D}\right)}^{2}}}{w \cdot h} \cdot c0\right)\right) \]
    5. Applied egg-rr49.6

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\color{blue}{\left(\frac{d}{w \cdot D} \cdot \frac{d}{h \cdot D}\right)} \cdot c0\right)\right) \]

    if 2.3000000000000001e-268 < M

    1. Initial program 60.1

      \[\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. Simplified62.2

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{\frac{c0}{w}}{D \cdot \left(h \cdot D\right)}, \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \left(\frac{d}{D} \cdot {\left(\frac{d}{D}\right)}^{3}\right) \cdot \frac{c0}{w \cdot h}, -M \cdot M\right)}\right)} \]
      Proof

      [Start]60.1

      \[ \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) \]

      associate-*l/ [<=]60.5

      \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\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) \]

      *-commutative [=>]60.5

      \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(d \cdot d\right) \cdot \frac{c0}{\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) \]

      fma-def [=>]61.1

      \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(d \cdot d, \frac{c0}{\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)} \]

      associate-*l* [=>]61.4

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\color{blue}{w \cdot \left(h \cdot \left(D \cdot D\right)\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) \]

      associate-/r* [=>]61.4

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \color{blue}{\frac{\frac{c0}{w}}{h \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) \]

      associate-*r* [=>]61.4

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{\frac{c0}{w}}{\color{blue}{\left(h \cdot D\right) \cdot D}}, \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) \]

      *-commutative [=>]61.4

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{\frac{c0}{w}}{\color{blue}{D \cdot \left(h \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) \]
    3. Taylor expanded in c0 around -inf 60.3

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0} + -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
    4. Simplified35.4

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{\frac{w \cdot \left(M \cdot \left(M \cdot h\right)\right)}{{\left(\frac{d}{D}\right)}^{2}}}{c0}, c0 \cdot 0\right)} \]
      Proof

      [Start]60.3

      \[ \frac{c0}{2 \cdot w} \cdot \left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0} + -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]

      fma-def [=>]60.3

      \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
    5. Taylor expanded in c0 around 0 36.4

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

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

      [Start]36.4

      \[ 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}} \]

      *-commutative [<=]36.4

      \[ 0.25 \cdot \frac{{D}^{2} \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}}{{d}^{2}} \]

      associate-/l* [=>]36.4

      \[ 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{h \cdot {M}^{2}}}} \]

      unpow2 [=>]36.4

      \[ 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2}}{h \cdot {M}^{2}}} \]

      unpow2 [=>]36.4

      \[ 0.25 \cdot \frac{D \cdot D}{\frac{\color{blue}{d \cdot d}}{h \cdot {M}^{2}}} \]

      *-commutative [=>]36.4

      \[ 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{\color{blue}{{M}^{2} \cdot h}}} \]

      unpow2 [=>]36.4

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

      associate-*r* [<=]34.2

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

      associate-/r/ [=>]34.0

      \[ 0.25 \cdot \color{blue}{\left(\frac{D \cdot D}{d \cdot d} \cdot \left(M \cdot \left(M \cdot h\right)\right)\right)} \]
    7. Applied egg-rr25.3

      \[\leadsto 0.25 \cdot \color{blue}{\frac{M \cdot h}{\frac{\frac{d}{D \cdot \frac{D}{d}}}{M}}} \]
    8. Applied egg-rr18.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 9.5 \cdot 10^{-298}:\\ \;\;\;\;0.25 \cdot \frac{\frac{D}{d} \cdot \left(M \cdot h\right)}{\frac{\frac{d}{D}}{M}}\\ \mathbf{elif}\;M \leq 2.3 \cdot 10^{-268}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \left(\frac{d}{D \cdot w} \cdot \frac{d}{D \cdot h}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\frac{h}{\frac{\frac{d}{D}}{\sqrt{M}}} \cdot \frac{M}{\frac{\frac{d}{D}}{\sqrt{M}}}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error20.2
Cost1609
\[\begin{array}{l} \mathbf{if}\;M \leq 9.5 \cdot 10^{-298} \lor \neg \left(M \leq 2.3 \cdot 10^{-268}\right):\\ \;\;\;\;0.25 \cdot \frac{\frac{D}{d} \cdot \left(M \cdot h\right)}{\frac{\frac{d}{D}}{M}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \left(\frac{d}{D \cdot w} \cdot \frac{d}{D \cdot h}\right)\right)\right)\\ \end{array} \]
Alternative 2
Error24.2
Cost1489
\[\begin{array}{l} t_0 := M \cdot \left(M \cdot h\right)\\ \mathbf{if}\;d \leq -7.5 \cdot 10^{+55}:\\ \;\;\;\;0.25 \cdot \left(\frac{M \cdot h}{d} \cdot \left(M \cdot \frac{D}{\frac{d}{D}}\right)\right)\\ \mathbf{elif}\;d \leq -2.7 \cdot 10^{-215}:\\ \;\;\;\;0.25 \cdot \frac{D}{\frac{\frac{d}{\frac{D}{d}}}{t_0}}\\ \mathbf{elif}\;d \leq 1.45 \cdot 10^{-146} \lor \neg \left(d \leq 2 \cdot 10^{+130}\right):\\ \;\;\;\;0.25 \cdot \left(t_0 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot \left(M \cdot \left(D \cdot \left(M \cdot h\right)\right)\right)}{d \cdot d}\\ \end{array} \]
Alternative 3
Error24.6
Cost1488
\[\begin{array}{l} t_0 := 0.25 \cdot \frac{M \cdot h}{\frac{\frac{d}{D \cdot \frac{D}{d}}}{M}}\\ t_1 := M \cdot \left(M \cdot h\right)\\ \mathbf{if}\;d \leq -9.8 \cdot 10^{+55}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq -2.6 \cdot 10^{-233}:\\ \;\;\;\;0.25 \cdot \frac{D}{\frac{\frac{d}{\frac{D}{d}}}{t_1}}\\ \mathbf{elif}\;d \leq 6.2 \cdot 10^{-150}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 4.3 \cdot 10^{+130}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot \left(M \cdot \left(D \cdot \left(M \cdot h\right)\right)\right)}{d \cdot d}\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(t_1 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\ \end{array} \]
Alternative 4
Error24.5
Cost1488
\[\begin{array}{l} t_0 := M \cdot \left(M \cdot h\right)\\ \mathbf{if}\;d \leq -4.4 \cdot 10^{+54}:\\ \;\;\;\;0.25 \cdot \frac{M \cdot h}{\frac{\frac{d}{\frac{D}{\frac{d}{D}}}}{M}}\\ \mathbf{elif}\;d \leq -2.5 \cdot 10^{-219}:\\ \;\;\;\;0.25 \cdot \frac{D}{\frac{\frac{d}{\frac{D}{d}}}{t_0}}\\ \mathbf{elif}\;d \leq 8.5 \cdot 10^{-149}:\\ \;\;\;\;0.25 \cdot \frac{M \cdot h}{\frac{\frac{d}{D \cdot \frac{D}{d}}}{M}}\\ \mathbf{elif}\;d \leq 3.5 \cdot 10^{+130}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot \left(M \cdot \left(D \cdot \left(M \cdot h\right)\right)\right)}{d \cdot d}\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(t_0 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\ \end{array} \]
Alternative 5
Error22.1
Cost1488
\[\begin{array}{l} t_0 := 0.25 \cdot \frac{\frac{D}{d} \cdot \left(M \cdot M\right)}{\frac{\frac{d}{D}}{h}}\\ \mathbf{if}\;M \leq -1.55 \cdot 10^{+134}:\\ \;\;\;\;0.25 \cdot \left(\frac{M \cdot h}{d} \cdot \left(M \cdot \frac{D}{\frac{d}{D}}\right)\right)\\ \mathbf{elif}\;M \leq -3.2 \cdot 10^{-116}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;M \leq 10^{-204}:\\ \;\;\;\;0.25 \cdot \frac{D}{\frac{\frac{d}{\frac{D}{d}}}{M \cdot \left(M \cdot h\right)}}\\ \mathbf{elif}\;M \leq 1.85 \cdot 10^{+147}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \frac{M \cdot h}{\frac{\frac{d}{D \cdot \frac{D}{d}}}{M}}\\ \end{array} \]
Alternative 6
Error23.4
Cost1481
\[\begin{array}{l} \mathbf{if}\;D \cdot D \leq 10^{-239} \lor \neg \left(D \cdot D \leq 2 \cdot 10^{+264}\right):\\ \;\;\;\;0.25 \cdot \left(\left(M \cdot \left(M \cdot h\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\frac{M \cdot h}{d} \cdot \left(M \cdot \frac{D}{\frac{d}{D}}\right)\right)\\ \end{array} \]
Alternative 7
Error25.9
Cost960
\[0.25 \cdot \left(\left(M \cdot \left(M \cdot h\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \]
Alternative 8
Error19.1
Cost960
\[0.25 \cdot \frac{\frac{D}{d} \cdot \left(M \cdot h\right)}{\frac{\frac{d}{D}}{M}} \]
Alternative 9
Error32.0
Cost64
\[0 \]

Error

Reproduce?

herbie shell --seed 2023032 
(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))))))