Math FPCore C Julia Wolfram TeX \[\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{c0 \cdot d}{D}}{w \cdot h}\\
t_1 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;M \leq -3.5 \cdot 10^{-148}:\\
\;\;\;\;t_1 \cdot \mathsf{fma}\left(t_0, \frac{d}{D}, \sqrt{\mathsf{fma}\left(M, -M, {\left(d \cdot \left(\frac{1}{D} \cdot t_0\right)\right)}^{2}\right)}\right)\\
\mathbf{elif}\;M \leq 1.56 \cdot 10^{-162}:\\
\;\;\;\;c0 \cdot \left(\frac{0.5}{w} \cdot \sqrt{-M \cdot M}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \mathsf{fma}\left(t_0, \frac{d}{D}, \sqrt{\mathsf{fma}\left(M, -M, {\left(\frac{1}{D} \cdot \left(d \cdot t_0\right)\right)}^{2}\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 (/ (/ (* c0 d) D) (* w h))) (t_1 (/ c0 (* 2.0 w))))
(if (<= M -3.5e-148)
(*
t_1
(fma t_0 (/ d D) (sqrt (fma M (- M) (pow (* d (* (/ 1.0 D) t_0)) 2.0)))))
(if (<= M 1.56e-162)
(* c0 (* (/ 0.5 w) (sqrt (- (* M M)))))
(*
t_1
(fma
t_0
(/ d D)
(sqrt (fma M (- M) (pow (* (/ 1.0 D) (* d t_0)) 2.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 = ((c0 * d) / D) / (w * h);
double t_1 = c0 / (2.0 * w);
double tmp;
if (M <= -3.5e-148) {
tmp = t_1 * fma(t_0, (d / D), sqrt(fma(M, -M, pow((d * ((1.0 / D) * t_0)), 2.0))));
} else if (M <= 1.56e-162) {
tmp = c0 * ((0.5 / w) * sqrt(-(M * M)));
} else {
tmp = t_1 * fma(t_0, (d / D), sqrt(fma(M, -M, pow(((1.0 / D) * (d * t_0)), 2.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(Float64(c0 * d) / D) / Float64(w * h))
t_1 = Float64(c0 / Float64(2.0 * w))
tmp = 0.0
if (M <= -3.5e-148)
tmp = Float64(t_1 * fma(t_0, Float64(d / D), sqrt(fma(M, Float64(-M), (Float64(d * Float64(Float64(1.0 / D) * t_0)) ^ 2.0)))));
elseif (M <= 1.56e-162)
tmp = Float64(c0 * Float64(Float64(0.5 / w) * sqrt(Float64(-Float64(M * M)))));
else
tmp = Float64(t_1 * fma(t_0, Float64(d / D), sqrt(fma(M, Float64(-M), (Float64(Float64(1.0 / D) * Float64(d * t_0)) ^ 2.0)))));
end
return 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[(N[(c0 * d), $MachinePrecision] / D), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, -3.5e-148], N[(t$95$1 * N[(t$95$0 * N[(d / D), $MachinePrecision] + N[Sqrt[N[(M * (-M) + N[Power[N[(d * N[(N[(1.0 / D), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 1.56e-162], N[(c0 * N[(N[(0.5 / w), $MachinePrecision] * N[Sqrt[(-N[(M * M), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$0 * N[(d / D), $MachinePrecision] + N[Sqrt[N[(M * (-M) + N[Power[N[(N[(1.0 / D), $MachinePrecision] * N[(d * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $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{c0 \cdot d}{D}}{w \cdot h}\\
t_1 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;M \leq -3.5 \cdot 10^{-148}:\\
\;\;\;\;t_1 \cdot \mathsf{fma}\left(t_0, \frac{d}{D}, \sqrt{\mathsf{fma}\left(M, -M, {\left(d \cdot \left(\frac{1}{D} \cdot t_0\right)\right)}^{2}\right)}\right)\\
\mathbf{elif}\;M \leq 1.56 \cdot 10^{-162}:\\
\;\;\;\;c0 \cdot \left(\frac{0.5}{w} \cdot \sqrt{-M \cdot M}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \mathsf{fma}\left(t_0, \frac{d}{D}, \sqrt{\mathsf{fma}\left(M, -M, {\left(\frac{1}{D} \cdot \left(d \cdot t_0\right)\right)}^{2}\right)}\right)\\
\end{array}
Alternatives Alternative 1 Error 46.4 Cost 28104
\[\begin{array}{l}
t_0 := \frac{\frac{c0 \cdot d}{D}}{w \cdot h}\\
t_1 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;M \leq -3.5 \cdot 10^{-148}:\\
\;\;\;\;t_1 \cdot \mathsf{fma}\left(t_0, \frac{d}{D}, \sqrt{\mathsf{fma}\left(M, -M, {\left(t_0 \cdot \frac{d}{D}\right)}^{2}\right)}\right)\\
\mathbf{elif}\;M \leq 1.56 \cdot 10^{-162}:\\
\;\;\;\;c0 \cdot \left(\frac{0.5}{w} \cdot \sqrt{-M \cdot M}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \mathsf{fma}\left(t_0, \frac{d}{D}, \sqrt{\mathsf{fma}\left(M, -M, {\left(\frac{t_0 \cdot d}{D}\right)}^{2}\right)}\right)\\
\end{array}
\]
Alternative 2 Error 46.5 Cost 28104
\[\begin{array}{l}
t_0 := \frac{\frac{c0 \cdot d}{D}}{w \cdot h}\\
t_1 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;M \leq -3.5 \cdot 10^{-148}:\\
\;\;\;\;t_1 \cdot \mathsf{fma}\left(t_0, \frac{d}{D}, \sqrt{\mathsf{fma}\left(M, -M, {\left(d \cdot \left(\frac{1}{D} \cdot t_0\right)\right)}^{2}\right)}\right)\\
\mathbf{elif}\;M \leq 5 \cdot 10^{-163}:\\
\;\;\;\;c0 \cdot \left(\frac{0.5}{w} \cdot \sqrt{-M \cdot M}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \mathsf{fma}\left(t_0, \frac{d}{D}, \sqrt{\mathsf{fma}\left(M, -M, {\left(\frac{t_0 \cdot d}{D}\right)}^{2}\right)}\right)\\
\end{array}
\]
Alternative 3 Error 46.2 Cost 28100
\[\begin{array}{l}
t_0 := \frac{\frac{c0 \cdot d}{D}}{w \cdot h}\\
\mathbf{if}\;M \cdot M \leq 0:\\
\;\;\;\;c0 \cdot \left(\frac{0.5}{w} \cdot \sqrt{-M \cdot M}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(t_0, \frac{d}{D}, \sqrt{\mathsf{fma}\left(M, -M, {\left(t_0 \cdot \frac{d}{D}\right)}^{2}\right)}\right)\\
\end{array}
\]
Alternative 4 Error 46.3 Cost 27780
\[\begin{array}{l}
t_0 := \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\\
t_1 := \frac{\frac{d \cdot \left(c0 \cdot d\right)}{w \cdot \left(h \cdot D\right)}}{D}\\
t_2 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;M \leq -1.55 \cdot 10^{-162}:\\
\;\;\;\;t_2 \cdot \left(t_0 + \sqrt{{t_0}^{2} - M \cdot M}\right)\\
\mathbf{elif}\;M \leq 5 \cdot 10^{-163}:\\
\;\;\;\;c0 \cdot \left(\frac{0.5}{w} \cdot \sqrt{-M \cdot M}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(t_1 + \sqrt{{t_1}^{2} - M \cdot M}\right)\\
\end{array}
\]
Alternative 5 Error 46.4 Cost 27780
\[\begin{array}{l}
t_0 := \frac{\frac{c0}{h}}{w} \cdot {\left(\frac{d}{D}\right)}^{2}\\
t_1 := \frac{\frac{d \cdot \left(c0 \cdot d\right)}{w \cdot \left(h \cdot D\right)}}{D}\\
t_2 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;M \leq -2 \cdot 10^{-162}:\\
\;\;\;\;t_2 \cdot \left(t_0 + \sqrt{{t_0}^{2} - M \cdot M}\right)\\
\mathbf{elif}\;M \leq 5 \cdot 10^{-163}:\\
\;\;\;\;c0 \cdot \left(\frac{0.5}{w} \cdot \sqrt{-M \cdot M}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(t_1 + \sqrt{{t_1}^{2} - M \cdot M}\right)\\
\end{array}
\]
Alternative 6 Error 46.4 Cost 21572
\[\begin{array}{l}
t_0 := \frac{c0}{w \cdot h}\\
t_1 := \frac{\frac{d \cdot \left(c0 \cdot d\right)}{w \cdot \left(h \cdot D\right)}}{D}\\
t_2 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;M \leq -1 \cdot 10^{-161}:\\
\;\;\;\;t_2 \cdot \left(t_0 \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{{\left(\frac{d}{D} \cdot \left(t_0 \cdot \frac{d}{D}\right)\right)}^{2} - M \cdot M}\right)\\
\mathbf{elif}\;M \leq 5 \cdot 10^{-163}:\\
\;\;\;\;c0 \cdot \left(\frac{0.5}{w} \cdot \sqrt{-M \cdot M}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(t_1 + \sqrt{{t_1}^{2} - M \cdot M}\right)\\
\end{array}
\]
Alternative 7 Error 46.7 Cost 21572
\[\begin{array}{l}
t_0 := \frac{\frac{c0}{h}}{w}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{\frac{d \cdot \left(c0 \cdot d\right)}{w \cdot \left(h \cdot D\right)}}{D}\\
\mathbf{if}\;M \leq -5 \cdot 10^{-149}:\\
\;\;\;\;t_1 \cdot \left(\frac{\left(t_0 \cdot \frac{d}{D}\right) \cdot d}{D} + \sqrt{{\left(t_0 \cdot {\left(\frac{d}{D}\right)}^{2}\right)}^{2} - M \cdot M}\right)\\
\mathbf{elif}\;M \leq 1.56 \cdot 10^{-162}:\\
\;\;\;\;c0 \cdot \left(\frac{0.5}{w} \cdot \sqrt{-M \cdot M}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(t_2 + \sqrt{{t_2}^{2} - M \cdot M}\right)\\
\end{array}
\]
Alternative 8 Error 46.8 Cost 15496
\[\begin{array}{l}
t_0 := \frac{\frac{d \cdot \left(c0 \cdot d\right)}{w \cdot \left(h \cdot D\right)}}{D}\\
t_1 := \frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{{t_0}^{2} - M \cdot M}\right)\\
\mathbf{if}\;M \leq -4 \cdot 10^{-148}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;M \leq 1.56 \cdot 10^{-162}:\\
\;\;\;\;c0 \cdot \left(\frac{0.5}{w} \cdot \sqrt{-M \cdot M}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 9 Error 48.6 Cost 9924
\[\begin{array}{l}
t_0 := \left(w \cdot h\right) \cdot \left(D \cdot D\right)\\
\mathbf{if}\;M \cdot M \leq 0:\\
\;\;\;\;c0 \cdot \left(\frac{0.5}{w} \cdot \sqrt{-M \cdot M}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{t_0} \cdot \left(d \cdot d\right) + \sqrt{\left(\frac{c0 \cdot d}{w} \cdot \frac{d}{\left(h \cdot D\right) \cdot D}\right) \cdot \left(\frac{d}{t_0} \cdot \left(c0 \cdot d\right)\right) - M \cdot M}\right)\\
\end{array}
\]
Alternative 10 Error 48.1 Cost 9924
\[\begin{array}{l}
t_0 := \frac{c0 \cdot d}{w} \cdot \frac{d}{\left(h \cdot D\right) \cdot D}\\
\mathbf{if}\;M \cdot M \leq 0:\\
\;\;\;\;c0 \cdot \left(\frac{0.5}{w} \cdot \sqrt{-M \cdot M}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot \left(\frac{d}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \left(c0 \cdot d\right)\right) - M \cdot M}\right)\\
\end{array}
\]
Alternative 11 Error 49.7 Cost 7040
\[c0 \cdot \left(\frac{0.5}{w} \cdot \sqrt{-M \cdot M}\right)
\]