
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h -2e-310)
(*
(-
1.0
(*
(/ (* (* (/ 0.5 d) D) M) (/ 1.0 h))
(/ (* (/ M d) (* (* D 0.5) 0.5)) l)))
(* (/ (sqrt (- d)) (sqrt (- l))) (pow (/ d h) (/ 1.0 2.0))))
(*
(- 1.0 (* (/ h l) (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 1.0 2.0))))
(* (pow (/ d l) (/ 1.0 2.0)) (/ (sqrt d) (sqrt h))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -2e-310) {
tmp = (1.0 - (((((0.5 / d) * D) * M) / (1.0 / h)) * (((M / d) * ((D * 0.5) * 0.5)) / l))) * ((sqrt(-d) / sqrt(-l)) * pow((d / h), (1.0 / 2.0)));
} else {
tmp = (1.0 - ((h / l) * (pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (pow((d / l), (1.0 / 2.0)) * (sqrt(d) / sqrt(h)));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (h <= (-2d-310)) then
tmp = (1.0d0 - (((((0.5d0 / d) * d_1) * m) / (1.0d0 / h)) * (((m / d) * ((d_1 * 0.5d0) * 0.5d0)) / l))) * ((sqrt(-d) / sqrt(-l)) * ((d / h) ** (1.0d0 / 2.0d0)))
else
tmp = (1.0d0 - ((h / l) * ((((m * d_1) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0)))) * (((d / l) ** (1.0d0 / 2.0d0)) * (sqrt(d) / sqrt(h)))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -2e-310) {
tmp = (1.0 - (((((0.5 / d) * D) * M) / (1.0 / h)) * (((M / d) * ((D * 0.5) * 0.5)) / l))) * ((Math.sqrt(-d) / Math.sqrt(-l)) * Math.pow((d / h), (1.0 / 2.0)));
} else {
tmp = (1.0 - ((h / l) * (Math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (Math.pow((d / l), (1.0 / 2.0)) * (Math.sqrt(d) / Math.sqrt(h)));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if h <= -2e-310: tmp = (1.0 - (((((0.5 / d) * D) * M) / (1.0 / h)) * (((M / d) * ((D * 0.5) * 0.5)) / l))) * ((math.sqrt(-d) / math.sqrt(-l)) * math.pow((d / h), (1.0 / 2.0))) else: tmp = (1.0 - ((h / l) * (math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (math.pow((d / l), (1.0 / 2.0)) * (math.sqrt(d) / math.sqrt(h))) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -2e-310) tmp = Float64(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(0.5 / d) * D) * M) / Float64(1.0 / h)) * Float64(Float64(Float64(M / d) * Float64(Float64(D * 0.5) * 0.5)) / l))) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * (Float64(d / h) ^ Float64(1.0 / 2.0)))); else tmp = Float64(Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * Float64(sqrt(d) / sqrt(h)))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= -2e-310)
tmp = (1.0 - (((((0.5 / d) * D) * M) / (1.0 / h)) * (((M / d) * ((D * 0.5) * 0.5)) / l))) * ((sqrt(-d) / sqrt(-l)) * ((d / h) ^ (1.0 / 2.0)));
else
tmp = (1.0 - ((h / l) * ((((M * D) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0)))) * (((d / l) ^ (1.0 / 2.0)) * (sqrt(d) / sqrt(h)));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -2e-310], N[(N[(1.0 - N[(N[(N[(N[(N[(0.5 / d), $MachinePrecision] * D), $MachinePrecision] * M), $MachinePrecision] / N[(1.0 / h), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M / d), $MachinePrecision] * N[(N[(D * 0.5), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - \frac{\left(\frac{0.5}{d} \cdot D\right) \cdot M}{\frac{1}{h}} \cdot \frac{\frac{M}{d} \cdot \left(\left(D \cdot 0.5\right) \cdot 0.5\right)}{\ell}\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if h < -1.999999999999994e-310Initial program 72.4%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites76.2%
lift-/.f64N/A
metadata-eval76.2
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6485.4
Applied rewrites85.4%
if -1.999999999999994e-310 < h Initial program 73.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6478.9
Applied rewrites78.9%
Final simplification82.5%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (fabs (/ d (sqrt (* l h)))))
(t_2
(*
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))
(- 1.0 (* (/ h l) (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 1.0 2.0))))))
(t_3 (sqrt (/ d l))))
(if (<= t_2 -1e-167)
(*
(*
t_0
(fma (* (* (* (/ 0.5 d) D) M) (/ (* (* 0.25 D) M) (* (- l) d))) h 1.0))
t_3)
(if (<= t_2 0.0) t_1 (if (<= t_2 2e+264) (* t_0 t_3) t_1)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = fabs((d / sqrt((l * h))));
double t_2 = (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))));
double t_3 = sqrt((d / l));
double tmp;
if (t_2 <= -1e-167) {
tmp = (t_0 * fma(((((0.5 / d) * D) * M) * (((0.25 * D) * M) / (-l * d))), h, 1.0)) * t_3;
} else if (t_2 <= 0.0) {
tmp = t_1;
} else if (t_2 <= 2e+264) {
tmp = t_0 * t_3;
} else {
tmp = t_1;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = abs(Float64(d / sqrt(Float64(l * h)))) t_2 = Float64(Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0))))) t_3 = sqrt(Float64(d / l)) tmp = 0.0 if (t_2 <= -1e-167) tmp = Float64(Float64(t_0 * fma(Float64(Float64(Float64(Float64(0.5 / d) * D) * M) * Float64(Float64(Float64(0.25 * D) * M) / Float64(Float64(-l) * d))), h, 1.0)) * t_3); elseif (t_2 <= 0.0) tmp = t_1; elseif (t_2 <= 2e+264) tmp = Float64(t_0 * t_3); else tmp = t_1; end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, -1e-167], N[(N[(t$95$0 * N[(N[(N[(N[(N[(0.5 / d), $MachinePrecision] * D), $MachinePrecision] * M), $MachinePrecision] * N[(N[(N[(0.25 * D), $MachinePrecision] * M), $MachinePrecision] / N[((-l) * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[t$95$2, 0.0], t$95$1, If[LessEqual[t$95$2, 2e+264], N[(t$95$0 * t$95$3), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_2 := \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right)\\
t_3 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-167}:\\
\;\;\;\;\left(t\_0 \cdot \mathsf{fma}\left(\left(\left(\frac{0.5}{d} \cdot D\right) \cdot M\right) \cdot \frac{\left(0.25 \cdot D\right) \cdot M}{\left(-\ell\right) \cdot d}, h, 1\right)\right) \cdot t\_3\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+264}:\\
\;\;\;\;t\_0 \cdot t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1e-167Initial program 88.7%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites89.5%
Applied rewrites83.5%
if -1e-167 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 27.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6427.0
Applied rewrites27.0%
Applied rewrites57.1%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000009e264Initial program 99.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.0
Applied rewrites31.0%
Applied rewrites99.0%
Final simplification80.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))
(- 1.0 (* (/ h l) (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 1.0 2.0))))))
(t_1 (sqrt (/ d h)))
(t_2 (sqrt (/ d l)))
(t_3 (fabs (/ d (sqrt (* l h))))))
(if (<= t_0 -1e-167)
(*
(*
(fma (* (/ (* (* -0.25 (* M D)) M) (* l d)) h) (* (/ 0.5 d) D) 1.0)
t_1)
t_2)
(if (<= t_0 0.0) t_3 (if (<= t_0 2e+264) (* t_1 t_2) t_3)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))));
double t_1 = sqrt((d / h));
double t_2 = sqrt((d / l));
double t_3 = fabs((d / sqrt((l * h))));
double tmp;
if (t_0 <= -1e-167) {
tmp = (fma(((((-0.25 * (M * D)) * M) / (l * d)) * h), ((0.5 / d) * D), 1.0) * t_1) * t_2;
} else if (t_0 <= 0.0) {
tmp = t_3;
} else if (t_0 <= 2e+264) {
tmp = t_1 * t_2;
} else {
tmp = t_3;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0))))) t_1 = sqrt(Float64(d / h)) t_2 = sqrt(Float64(d / l)) t_3 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_0 <= -1e-167) tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(-0.25 * Float64(M * D)) * M) / Float64(l * d)) * h), Float64(Float64(0.5 / d) * D), 1.0) * t_1) * t_2); elseif (t_0 <= 0.0) tmp = t_3; elseif (t_0 <= 2e+264) tmp = Float64(t_1 * t_2); else tmp = t_3; end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -1e-167], N[(N[(N[(N[(N[(N[(N[(-0.25 * N[(M * D), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] * N[(N[(0.5 / d), $MachinePrecision] * D), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$3, If[LessEqual[t$95$0, 2e+264], N[(t$95$1 * t$95$2), $MachinePrecision], t$95$3]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right)\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-167}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\left(-0.25 \cdot \left(M \cdot D\right)\right) \cdot M}{\ell \cdot d} \cdot h, \frac{0.5}{d} \cdot D, 1\right) \cdot t\_1\right) \cdot t\_2\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+264}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1e-167Initial program 88.7%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites89.5%
Applied rewrites83.5%
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites78.3%
if -1e-167 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 27.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6427.0
Applied rewrites27.0%
Applied rewrites57.1%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000009e264Initial program 99.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.0
Applied rewrites31.0%
Applied rewrites99.0%
Final simplification78.4%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))
(- 1.0 (* (/ h l) (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 1.0 2.0))))))
(t_1 (sqrt (/ d l)))
(t_2 (sqrt (/ d h)))
(t_3 (fabs (/ d (sqrt (* l h))))))
(if (<= t_0 -1e+93)
(*
(*
(fma (* -0.5 (/ h l)) (/ (* (* (* M M) 0.25) (* D D)) (* d d)) 1.0)
t_1)
t_2)
(if (<= t_0 0.0) t_3 (if (<= t_0 2e+264) (* t_2 t_1) t_3)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))));
double t_1 = sqrt((d / l));
double t_2 = sqrt((d / h));
double t_3 = fabs((d / sqrt((l * h))));
double tmp;
if (t_0 <= -1e+93) {
tmp = (fma((-0.5 * (h / l)), ((((M * M) * 0.25) * (D * D)) / (d * d)), 1.0) * t_1) * t_2;
} else if (t_0 <= 0.0) {
tmp = t_3;
} else if (t_0 <= 2e+264) {
tmp = t_2 * t_1;
} else {
tmp = t_3;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0))))) t_1 = sqrt(Float64(d / l)) t_2 = sqrt(Float64(d / h)) t_3 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_0 <= -1e+93) tmp = Float64(Float64(fma(Float64(-0.5 * Float64(h / l)), Float64(Float64(Float64(Float64(M * M) * 0.25) * Float64(D * D)) / Float64(d * d)), 1.0) * t_1) * t_2); elseif (t_0 <= 0.0) tmp = t_3; elseif (t_0 <= 2e+264) tmp = Float64(t_2 * t_1); else tmp = t_3; end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -1e+93], N[(N[(N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(M * M), $MachinePrecision] * 0.25), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$3, If[LessEqual[t$95$0, 2e+264], N[(t$95$2 * t$95$1), $MachinePrecision], t$95$3]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{d}{h}}\\
t_3 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+93}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, \frac{\left(\left(M \cdot M\right) \cdot 0.25\right) \cdot \left(D \cdot D\right)}{d \cdot d}, 1\right) \cdot t\_1\right) \cdot t\_2\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+264}:\\
\;\;\;\;t\_2 \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1.00000000000000004e93Initial program 88.9%
Applied rewrites60.8%
if -1.00000000000000004e93 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 30.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6425.9
Applied rewrites25.9%
Applied rewrites54.6%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000009e264Initial program 99.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.0
Applied rewrites31.0%
Applied rewrites99.0%
Final simplification71.4%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))
(- 1.0 (* (/ h l) (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 1.0 2.0))))))
(t_1 (fabs (/ d (sqrt (* l h))))))
(if (<= t_0 -1e+42)
(* (sqrt (/ h (* (* l l) l))) (/ (* (* (* (* 0.125 D) M) D) M) d))
(if (<= t_0 0.0)
t_1
(if (<= t_0 2e+264) (* (sqrt (/ d h)) (sqrt (/ d l))) t_1)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))));
double t_1 = fabs((d / sqrt((l * h))));
double tmp;
if (t_0 <= -1e+42) {
tmp = sqrt((h / ((l * l) * l))) * (((((0.125 * D) * M) * D) * M) / d);
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+264) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0))) * (1.0d0 - ((h / l) * ((((m * d_1) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0))))
t_1 = abs((d / sqrt((l * h))))
if (t_0 <= (-1d+42)) then
tmp = sqrt((h / ((l * l) * l))) * (((((0.125d0 * d_1) * m) * d_1) * m) / d)
else if (t_0 <= 0.0d0) then
tmp = t_1
else if (t_0 <= 2d+264) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = t_1
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (Math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))));
double t_1 = Math.abs((d / Math.sqrt((l * h))));
double tmp;
if (t_0 <= -1e+42) {
tmp = Math.sqrt((h / ((l * l) * l))) * (((((0.125 * D) * M) * D) * M) / d);
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+264) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = t_1;
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) t_1 = math.fabs((d / math.sqrt((l * h)))) tmp = 0 if t_0 <= -1e+42: tmp = math.sqrt((h / ((l * l) * l))) * (((((0.125 * D) * M) * D) * M) / d) elif t_0 <= 0.0: tmp = t_1 elif t_0 <= 2e+264: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = t_1 return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0))))) t_1 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_0 <= -1e+42) tmp = Float64(sqrt(Float64(h / Float64(Float64(l * l) * l))) * Float64(Float64(Float64(Float64(Float64(0.125 * D) * M) * D) * M) / d)); elseif (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 2e+264) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = t_1; end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0))) * (1.0 - ((h / l) * ((((M * D) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0))));
t_1 = abs((d / sqrt((l * h))));
tmp = 0.0;
if (t_0 <= -1e+42)
tmp = sqrt((h / ((l * l) * l))) * (((((0.125 * D) * M) * D) * M) / d);
elseif (t_0 <= 0.0)
tmp = t_1;
elseif (t_0 <= 2e+264)
tmp = sqrt((d / h)) * sqrt((d / l));
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -1e+42], N[(N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(N[(N[(0.125 * D), $MachinePrecision] * M), $MachinePrecision] * D), $MachinePrecision] * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 2e+264], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right)\\
t_1 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+42}:\\
\;\;\;\;\sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}} \cdot \frac{\left(\left(\left(0.125 \cdot D\right) \cdot M\right) \cdot D\right) \cdot M}{d}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+264}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1.00000000000000004e42Initial program 89.1%
Taylor expanded in h around -inf
associate-*r*N/A
lower-*.f64N/A
Applied rewrites38.9%
Applied rewrites44.7%
Applied rewrites50.3%
if -1.00000000000000004e42 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 29.4%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6426.2
Applied rewrites26.2%
Applied rewrites55.2%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000009e264Initial program 99.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.0
Applied rewrites31.0%
Applied rewrites99.0%
Final simplification68.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))
(- 1.0 (* (/ h l) (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 1.0 2.0))))))
(t_1 (fabs (/ d (sqrt (* l h))))))
(if (<= t_0 -1e+42)
(* (/ (* (* (* 0.125 (* D D)) M) M) d) (sqrt (/ h (* (* l l) l))))
(if (<= t_0 0.0)
t_1
(if (<= t_0 2e+264) (* (sqrt (/ d h)) (sqrt (/ d l))) t_1)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))));
double t_1 = fabs((d / sqrt((l * h))));
double tmp;
if (t_0 <= -1e+42) {
tmp = ((((0.125 * (D * D)) * M) * M) / d) * sqrt((h / ((l * l) * l)));
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+264) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0))) * (1.0d0 - ((h / l) * ((((m * d_1) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0))))
t_1 = abs((d / sqrt((l * h))))
if (t_0 <= (-1d+42)) then
tmp = ((((0.125d0 * (d_1 * d_1)) * m) * m) / d) * sqrt((h / ((l * l) * l)))
else if (t_0 <= 0.0d0) then
tmp = t_1
else if (t_0 <= 2d+264) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = t_1
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (Math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))));
double t_1 = Math.abs((d / Math.sqrt((l * h))));
double tmp;
if (t_0 <= -1e+42) {
tmp = ((((0.125 * (D * D)) * M) * M) / d) * Math.sqrt((h / ((l * l) * l)));
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+264) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = t_1;
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) t_1 = math.fabs((d / math.sqrt((l * h)))) tmp = 0 if t_0 <= -1e+42: tmp = ((((0.125 * (D * D)) * M) * M) / d) * math.sqrt((h / ((l * l) * l))) elif t_0 <= 0.0: tmp = t_1 elif t_0 <= 2e+264: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = t_1 return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0))))) t_1 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_0 <= -1e+42) tmp = Float64(Float64(Float64(Float64(Float64(0.125 * Float64(D * D)) * M) * M) / d) * sqrt(Float64(h / Float64(Float64(l * l) * l)))); elseif (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 2e+264) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = t_1; end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0))) * (1.0 - ((h / l) * ((((M * D) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0))));
t_1 = abs((d / sqrt((l * h))));
tmp = 0.0;
if (t_0 <= -1e+42)
tmp = ((((0.125 * (D * D)) * M) * M) / d) * sqrt((h / ((l * l) * l)));
elseif (t_0 <= 0.0)
tmp = t_1;
elseif (t_0 <= 2e+264)
tmp = sqrt((d / h)) * sqrt((d / l));
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -1e+42], N[(N[(N[(N[(N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * M), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 2e+264], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right)\\
t_1 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+42}:\\
\;\;\;\;\frac{\left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot M\right) \cdot M}{d} \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+264}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1.00000000000000004e42Initial program 89.1%
Taylor expanded in h around -inf
associate-*r*N/A
lower-*.f64N/A
Applied rewrites38.9%
Applied rewrites44.7%
if -1.00000000000000004e42 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 29.4%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6426.2
Applied rewrites26.2%
Applied rewrites55.2%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000009e264Initial program 99.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.0
Applied rewrites31.0%
Applied rewrites99.0%
Final simplification66.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))
(- 1.0 (* (/ h l) (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 1.0 2.0))))))
(t_1 (fabs (/ d (sqrt (* l h))))))
(if (<= t_0 -1e+42)
(* (* (sqrt (/ h (* (* l l) l))) (/ M d)) (* (* 0.125 (* D D)) M))
(if (<= t_0 0.0)
t_1
(if (<= t_0 2e+264) (* (sqrt (/ d h)) (sqrt (/ d l))) t_1)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))));
double t_1 = fabs((d / sqrt((l * h))));
double tmp;
if (t_0 <= -1e+42) {
tmp = (sqrt((h / ((l * l) * l))) * (M / d)) * ((0.125 * (D * D)) * M);
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+264) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0))) * (1.0d0 - ((h / l) * ((((m * d_1) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0))))
t_1 = abs((d / sqrt((l * h))))
if (t_0 <= (-1d+42)) then
tmp = (sqrt((h / ((l * l) * l))) * (m / d)) * ((0.125d0 * (d_1 * d_1)) * m)
else if (t_0 <= 0.0d0) then
tmp = t_1
else if (t_0 <= 2d+264) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = t_1
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (Math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))));
double t_1 = Math.abs((d / Math.sqrt((l * h))));
double tmp;
if (t_0 <= -1e+42) {
tmp = (Math.sqrt((h / ((l * l) * l))) * (M / d)) * ((0.125 * (D * D)) * M);
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+264) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = t_1;
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) t_1 = math.fabs((d / math.sqrt((l * h)))) tmp = 0 if t_0 <= -1e+42: tmp = (math.sqrt((h / ((l * l) * l))) * (M / d)) * ((0.125 * (D * D)) * M) elif t_0 <= 0.0: tmp = t_1 elif t_0 <= 2e+264: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = t_1 return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0))))) t_1 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_0 <= -1e+42) tmp = Float64(Float64(sqrt(Float64(h / Float64(Float64(l * l) * l))) * Float64(M / d)) * Float64(Float64(0.125 * Float64(D * D)) * M)); elseif (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 2e+264) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = t_1; end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0))) * (1.0 - ((h / l) * ((((M * D) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0))));
t_1 = abs((d / sqrt((l * h))));
tmp = 0.0;
if (t_0 <= -1e+42)
tmp = (sqrt((h / ((l * l) * l))) * (M / d)) * ((0.125 * (D * D)) * M);
elseif (t_0 <= 0.0)
tmp = t_1;
elseif (t_0 <= 2e+264)
tmp = sqrt((d / h)) * sqrt((d / l));
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -1e+42], N[(N[(N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision] * N[(N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 2e+264], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right)\\
t_1 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+42}:\\
\;\;\;\;\left(\sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}} \cdot \frac{M}{d}\right) \cdot \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot M\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+264}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1.00000000000000004e42Initial program 89.1%
Taylor expanded in h around -inf
associate-*r*N/A
lower-*.f64N/A
Applied rewrites38.9%
Applied rewrites44.7%
Applied rewrites44.7%
if -1.00000000000000004e42 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 29.4%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6426.2
Applied rewrites26.2%
Applied rewrites55.2%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000009e264Initial program 99.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.0
Applied rewrites31.0%
Applied rewrites99.0%
Final simplification66.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))
(- 1.0 (* (/ h l) (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 1.0 2.0))))))
(t_1 (fabs (/ d (sqrt (* l h))))))
(if (<= t_0 -1e+93)
(* (* (* (* (/ M d) M) 0.125) (sqrt (/ h (* (* l l) l)))) (* D D))
(if (<= t_0 0.0)
t_1
(if (<= t_0 2e+264) (* (sqrt (/ d h)) (sqrt (/ d l))) t_1)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))));
double t_1 = fabs((d / sqrt((l * h))));
double tmp;
if (t_0 <= -1e+93) {
tmp = ((((M / d) * M) * 0.125) * sqrt((h / ((l * l) * l)))) * (D * D);
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+264) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0))) * (1.0d0 - ((h / l) * ((((m * d_1) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0))))
t_1 = abs((d / sqrt((l * h))))
if (t_0 <= (-1d+93)) then
tmp = ((((m / d) * m) * 0.125d0) * sqrt((h / ((l * l) * l)))) * (d_1 * d_1)
else if (t_0 <= 0.0d0) then
tmp = t_1
else if (t_0 <= 2d+264) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = t_1
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (Math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))));
double t_1 = Math.abs((d / Math.sqrt((l * h))));
double tmp;
if (t_0 <= -1e+93) {
tmp = ((((M / d) * M) * 0.125) * Math.sqrt((h / ((l * l) * l)))) * (D * D);
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+264) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = t_1;
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) t_1 = math.fabs((d / math.sqrt((l * h)))) tmp = 0 if t_0 <= -1e+93: tmp = ((((M / d) * M) * 0.125) * math.sqrt((h / ((l * l) * l)))) * (D * D) elif t_0 <= 0.0: tmp = t_1 elif t_0 <= 2e+264: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = t_1 return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0))))) t_1 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_0 <= -1e+93) tmp = Float64(Float64(Float64(Float64(Float64(M / d) * M) * 0.125) * sqrt(Float64(h / Float64(Float64(l * l) * l)))) * Float64(D * D)); elseif (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 2e+264) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = t_1; end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0))) * (1.0 - ((h / l) * ((((M * D) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0))));
t_1 = abs((d / sqrt((l * h))));
tmp = 0.0;
if (t_0 <= -1e+93)
tmp = ((((M / d) * M) * 0.125) * sqrt((h / ((l * l) * l)))) * (D * D);
elseif (t_0 <= 0.0)
tmp = t_1;
elseif (t_0 <= 2e+264)
tmp = sqrt((d / h)) * sqrt((d / l));
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -1e+93], N[(N[(N[(N[(N[(M / d), $MachinePrecision] * M), $MachinePrecision] * 0.125), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 2e+264], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right)\\
t_1 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+93}:\\
\;\;\;\;\left(\left(\left(\frac{M}{d} \cdot M\right) \cdot 0.125\right) \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\right) \cdot \left(D \cdot D\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+264}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1.00000000000000004e93Initial program 88.9%
Taylor expanded in h around -inf
associate-*r*N/A
lower-*.f64N/A
Applied rewrites39.3%
Applied rewrites41.7%
if -1.00000000000000004e93 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 30.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6425.9
Applied rewrites25.9%
Applied rewrites54.6%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000009e264Initial program 99.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.0
Applied rewrites31.0%
Applied rewrites99.0%
Final simplification65.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))
(- 1.0 (* (/ h l) (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 1.0 2.0))))))
(t_1 (fabs (/ d (sqrt (* l h))))))
(if (<= t_0 -1e+202)
(* (* (/ (* D D) d) (sqrt (/ h (* (* l l) l)))) (* -0.125 (* M M)))
(if (<= t_0 0.0)
t_1
(if (<= t_0 2e+264) (* (sqrt (/ d h)) (sqrt (/ d l))) t_1)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))));
double t_1 = fabs((d / sqrt((l * h))));
double tmp;
if (t_0 <= -1e+202) {
tmp = (((D * D) / d) * sqrt((h / ((l * l) * l)))) * (-0.125 * (M * M));
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+264) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0))) * (1.0d0 - ((h / l) * ((((m * d_1) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0))))
t_1 = abs((d / sqrt((l * h))))
if (t_0 <= (-1d+202)) then
tmp = (((d_1 * d_1) / d) * sqrt((h / ((l * l) * l)))) * ((-0.125d0) * (m * m))
else if (t_0 <= 0.0d0) then
tmp = t_1
else if (t_0 <= 2d+264) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = t_1
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (Math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))));
double t_1 = Math.abs((d / Math.sqrt((l * h))));
double tmp;
if (t_0 <= -1e+202) {
tmp = (((D * D) / d) * Math.sqrt((h / ((l * l) * l)))) * (-0.125 * (M * M));
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+264) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = t_1;
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) t_1 = math.fabs((d / math.sqrt((l * h)))) tmp = 0 if t_0 <= -1e+202: tmp = (((D * D) / d) * math.sqrt((h / ((l * l) * l)))) * (-0.125 * (M * M)) elif t_0 <= 0.0: tmp = t_1 elif t_0 <= 2e+264: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = t_1 return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0))))) t_1 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_0 <= -1e+202) tmp = Float64(Float64(Float64(Float64(D * D) / d) * sqrt(Float64(h / Float64(Float64(l * l) * l)))) * Float64(-0.125 * Float64(M * M))); elseif (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 2e+264) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = t_1; end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0))) * (1.0 - ((h / l) * ((((M * D) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0))));
t_1 = abs((d / sqrt((l * h))));
tmp = 0.0;
if (t_0 <= -1e+202)
tmp = (((D * D) / d) * sqrt((h / ((l * l) * l)))) * (-0.125 * (M * M));
elseif (t_0 <= 0.0)
tmp = t_1;
elseif (t_0 <= 2e+264)
tmp = sqrt((d / h)) * sqrt((d / l));
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -1e+202], N[(N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.125 * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 2e+264], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right)\\
t_1 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+202}:\\
\;\;\;\;\left(\frac{D \cdot D}{d} \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\right) \cdot \left(-0.125 \cdot \left(M \cdot M\right)\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+264}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -9.999999999999999e201Initial program 88.6%
Taylor expanded in h around inf
associate-*l/N/A
*-commutativeN/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites29.5%
if -9.999999999999999e201 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 32.6%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6425.2
Applied rewrites25.2%
Applied rewrites52.8%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000009e264Initial program 99.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.0
Applied rewrites31.0%
Applied rewrites99.0%
Final simplification60.7%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* l h)))))
(t_1
(*
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))
(-
1.0
(* (/ h l) (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 1.0 2.0)))))))
(if (<= t_1 -1e-167)
(/ d (sqrt (sqrt (* (* l h) (* l h)))))
(if (<= t_1 0.0)
t_0
(if (<= t_1 2e+264) (* (sqrt (/ d h)) (sqrt (/ d l))) t_0)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = fabs((d / sqrt((l * h))));
double t_1 = (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))));
double tmp;
if (t_1 <= -1e-167) {
tmp = d / sqrt(sqrt(((l * h) * (l * h))));
} else if (t_1 <= 0.0) {
tmp = t_0;
} else if (t_1 <= 2e+264) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = t_0;
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((d / sqrt((l * h))))
t_1 = (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0))) * (1.0d0 - ((h / l) * ((((m * d_1) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0))))
if (t_1 <= (-1d-167)) then
tmp = d / sqrt(sqrt(((l * h) * (l * h))))
else if (t_1 <= 0.0d0) then
tmp = t_0
else if (t_1 <= 2d+264) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = t_0
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.abs((d / Math.sqrt((l * h))));
double t_1 = (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (Math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))));
double tmp;
if (t_1 <= -1e-167) {
tmp = d / Math.sqrt(Math.sqrt(((l * h) * (l * h))));
} else if (t_1 <= 0.0) {
tmp = t_0;
} else if (t_1 <= 2e+264) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = t_0;
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = math.fabs((d / math.sqrt((l * h)))) t_1 = (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) tmp = 0 if t_1 <= -1e-167: tmp = d / math.sqrt(math.sqrt(((l * h) * (l * h)))) elif t_1 <= 0.0: tmp = t_0 elif t_1 <= 2e+264: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = t_0 return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = abs(Float64(d / sqrt(Float64(l * h)))) t_1 = Float64(Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0))))) tmp = 0.0 if (t_1 <= -1e-167) tmp = Float64(d / sqrt(sqrt(Float64(Float64(l * h) * Float64(l * h))))); elseif (t_1 <= 0.0) tmp = t_0; elseif (t_1 <= 2e+264) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = t_0; end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = abs((d / sqrt((l * h))));
t_1 = (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0))) * (1.0 - ((h / l) * ((((M * D) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0))));
tmp = 0.0;
if (t_1 <= -1e-167)
tmp = d / sqrt(sqrt(((l * h) * (l * h))));
elseif (t_1 <= 0.0)
tmp = t_0;
elseif (t_1 <= 2e+264)
tmp = sqrt((d / h)) * sqrt((d / l));
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-167], N[(d / N[Sqrt[N[Sqrt[N[(N[(l * h), $MachinePrecision] * N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$0, If[LessEqual[t$95$1, 2e+264], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_1 := \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-167}:\\
\;\;\;\;\frac{d}{\sqrt{\sqrt{\left(\ell \cdot h\right) \cdot \left(\ell \cdot h\right)}}}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+264}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1e-167Initial program 88.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6415.4
Applied rewrites15.4%
Applied rewrites11.0%
Applied rewrites23.0%
if -1e-167 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 27.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6427.0
Applied rewrites27.0%
Applied rewrites57.1%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000009e264Initial program 99.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.0
Applied rewrites31.0%
Applied rewrites99.0%
Final simplification59.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))
(- 1.0 (* (/ h l) (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 1.0 2.0)))))
2e+264)
(*
(-
1.0
(* (/ (* (/ (* 0.25 D) l) M) d) (/ (* (* (/ 0.5 d) D) M) (/ 1.0 h))))
(* (sqrt (/ d h)) (sqrt (/ d l))))
(fabs (/ d (sqrt (* l h))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))))) <= 2e+264) {
tmp = (1.0 - (((((0.25 * D) / l) * M) / d) * ((((0.5 / d) * D) * M) / (1.0 / h)))) * (sqrt((d / h)) * sqrt((d / l)));
} else {
tmp = fabs((d / sqrt((l * h))));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0))) * (1.0d0 - ((h / l) * ((((m * d_1) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0))))) <= 2d+264) then
tmp = (1.0d0 - (((((0.25d0 * d_1) / l) * m) / d) * ((((0.5d0 / d) * d_1) * m) / (1.0d0 / h)))) * (sqrt((d / h)) * sqrt((d / l)))
else
tmp = abs((d / sqrt((l * h))))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (((Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (Math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))))) <= 2e+264) {
tmp = (1.0 - (((((0.25 * D) / l) * M) / d) * ((((0.5 / d) * D) * M) / (1.0 / h)))) * (Math.sqrt((d / h)) * Math.sqrt((d / l)));
} else {
tmp = Math.abs((d / Math.sqrt((l * h))));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if ((math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))))) <= 2e+264: tmp = (1.0 - (((((0.25 * D) / l) * M) / d) * ((((0.5 / d) * D) * M) / (1.0 / h)))) * (math.sqrt((d / h)) * math.sqrt((d / l))) else: tmp = math.fabs((d / math.sqrt((l * h)))) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0))))) <= 2e+264) tmp = Float64(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(0.25 * D) / l) * M) / d) * Float64(Float64(Float64(Float64(0.5 / d) * D) * M) / Float64(1.0 / h)))) * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); else tmp = abs(Float64(d / sqrt(Float64(l * h)))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (((((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0))) * (1.0 - ((h / l) * ((((M * D) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0))))) <= 2e+264)
tmp = (1.0 - (((((0.25 * D) / l) * M) / d) * ((((0.5 / d) * D) * M) / (1.0 / h)))) * (sqrt((d / h)) * sqrt((d / l)));
else
tmp = abs((d / sqrt((l * h))));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+264], N[(N[(1.0 - N[(N[(N[(N[(N[(0.25 * D), $MachinePrecision] / l), $MachinePrecision] * M), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(N[(0.5 / d), $MachinePrecision] * D), $MachinePrecision] * M), $MachinePrecision] / N[(1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \leq 2 \cdot 10^{+264}:\\
\;\;\;\;\left(1 - \frac{\frac{0.25 \cdot D}{\ell} \cdot M}{d} \cdot \frac{\left(\frac{0.5}{d} \cdot D\right) \cdot M}{\frac{1}{h}}\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000009e264Initial program 90.5%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites90.2%
lift-/.f64N/A
metadata-eval90.2
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6490.2
Applied rewrites90.2%
lift-/.f64N/A
metadata-eval90.2
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6490.2
Applied rewrites90.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6490.2
Applied rewrites90.2%
if 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 24.4%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6421.6
Applied rewrites21.6%
Applied rewrites53.2%
Final simplification80.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))
(- 1.0 (* (/ h l) (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 1.0 2.0)))))
2e+264)
(*
(*
(fma (* (* (/ 0.25 (- l)) (/ (* M D) d)) (* (* (/ 0.5 d) D) M)) h 1.0)
(sqrt (/ d h)))
(sqrt (/ d l)))
(fabs (/ d (sqrt (* l h))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))))) <= 2e+264) {
tmp = (fma((((0.25 / -l) * ((M * D) / d)) * (((0.5 / d) * D) * M)), h, 1.0) * sqrt((d / h))) * sqrt((d / l));
} else {
tmp = fabs((d / sqrt((l * h))));
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0))))) <= 2e+264) tmp = Float64(Float64(fma(Float64(Float64(Float64(0.25 / Float64(-l)) * Float64(Float64(M * D) / d)) * Float64(Float64(Float64(0.5 / d) * D) * M)), h, 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); else tmp = abs(Float64(d / sqrt(Float64(l * h)))); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+264], N[(N[(N[(N[(N[(N[(0.25 / (-l)), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(0.5 / d), $MachinePrecision] * D), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \leq 2 \cdot 10^{+264}:\\
\;\;\;\;\left(\mathsf{fma}\left(\left(\frac{0.25}{-\ell} \cdot \frac{M \cdot D}{d}\right) \cdot \left(\left(\frac{0.5}{d} \cdot D\right) \cdot M\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000009e264Initial program 90.5%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites90.2%
Applied rewrites85.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6489.8
Applied rewrites89.8%
if 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 24.4%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6421.6
Applied rewrites21.6%
Applied rewrites53.2%
Final simplification79.9%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))
(- 1.0 (* (/ h l) (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 1.0 2.0)))))
2e+264)
(*
(*
(fma (* (/ (/ (* -0.25 (* M D)) l) d) (* (* (/ 0.5 d) D) M)) h 1.0)
(sqrt (/ d h)))
(sqrt (/ d l)))
(fabs (/ d (sqrt (* l h))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))))) <= 2e+264) {
tmp = (fma(((((-0.25 * (M * D)) / l) / d) * (((0.5 / d) * D) * M)), h, 1.0) * sqrt((d / h))) * sqrt((d / l));
} else {
tmp = fabs((d / sqrt((l * h))));
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0))))) <= 2e+264) tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(-0.25 * Float64(M * D)) / l) / d) * Float64(Float64(Float64(0.5 / d) * D) * M)), h, 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); else tmp = abs(Float64(d / sqrt(Float64(l * h)))); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+264], N[(N[(N[(N[(N[(N[(N[(-0.25 * N[(M * D), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(0.5 / d), $MachinePrecision] * D), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \leq 2 \cdot 10^{+264}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\frac{-0.25 \cdot \left(M \cdot D\right)}{\ell}}{d} \cdot \left(\left(\frac{0.5}{d} \cdot D\right) \cdot M\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000009e264Initial program 90.5%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites90.2%
Applied rewrites85.3%
lift-neg.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-*.f6489.8
Applied rewrites89.8%
if 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 24.4%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6421.6
Applied rewrites21.6%
Applied rewrites53.2%
Final simplification79.9%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))
(- 1.0 (* (/ h l) (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 1.0 2.0)))))
-1e+42)
(* (sqrt (/ 1.0 (* l h))) d)
(fabs (/ d (sqrt (* l h))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))))) <= -1e+42) {
tmp = sqrt((1.0 / (l * h))) * d;
} else {
tmp = fabs((d / sqrt((l * h))));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0))) * (1.0d0 - ((h / l) * ((((m * d_1) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0))))) <= (-1d+42)) then
tmp = sqrt((1.0d0 / (l * h))) * d
else
tmp = abs((d / sqrt((l * h))))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (((Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (Math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))))) <= -1e+42) {
tmp = Math.sqrt((1.0 / (l * h))) * d;
} else {
tmp = Math.abs((d / Math.sqrt((l * h))));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if ((math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))))) <= -1e+42: tmp = math.sqrt((1.0 / (l * h))) * d else: tmp = math.fabs((d / math.sqrt((l * h)))) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0))))) <= -1e+42) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * d); else tmp = abs(Float64(d / sqrt(Float64(l * h)))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (((((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0))) * (1.0 - ((h / l) * ((((M * D) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0))))) <= -1e+42)
tmp = sqrt((1.0 / (l * h))) * d;
else
tmp = abs((d / sqrt((l * h))));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e+42], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \leq -1 \cdot 10^{+42}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot d\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1.00000000000000004e42Initial program 89.1%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6415.8
Applied rewrites15.8%
if -1.00000000000000004e42 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 64.4%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6428.6
Applied rewrites28.6%
Applied rewrites63.0%
Final simplification47.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ d (sqrt (* l h)))))
(if (<=
(*
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))
(- 1.0 (* (/ h l) (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 1.0 2.0)))))
-1e+42)
t_0
(fabs t_0))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = d / sqrt((l * h));
double tmp;
if (((pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))))) <= -1e+42) {
tmp = t_0;
} else {
tmp = fabs(t_0);
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = d / sqrt((l * h))
if (((((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0))) * (1.0d0 - ((h / l) * ((((m * d_1) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0))))) <= (-1d+42)) then
tmp = t_0
else
tmp = abs(t_0)
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d / Math.sqrt((l * h));
double tmp;
if (((Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (Math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))))) <= -1e+42) {
tmp = t_0;
} else {
tmp = Math.abs(t_0);
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = d / math.sqrt((l * h)) tmp = 0 if ((math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) * (1.0 - ((h / l) * (math.pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))))) <= -1e+42: tmp = t_0 else: tmp = math.fabs(t_0) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(d / sqrt(Float64(l * h))) tmp = 0.0 if (Float64(Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0))))) <= -1e+42) tmp = t_0; else tmp = abs(t_0); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = d / sqrt((l * h));
tmp = 0.0;
if (((((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0))) * (1.0 - ((h / l) * ((((M * D) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0))))) <= -1e+42)
tmp = t_0;
else
tmp = abs(t_0);
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e+42], t$95$0, N[Abs[t$95$0], $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \leq -1 \cdot 10^{+42}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|t\_0\right|\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1.00000000000000004e42Initial program 89.1%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6415.8
Applied rewrites15.8%
Applied rewrites11.3%
if -1.00000000000000004e42 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 64.4%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6428.6
Applied rewrites28.6%
Applied rewrites63.0%
Final simplification45.6%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ d h) (/ 1.0 2.0))) (t_1 (* (* (/ 0.5 d) D) M)))
(if (<= d -5e-310)
(*
(- 1.0 (* (/ t_1 (/ 1.0 h)) (/ (* (/ M d) (* (* D 0.5) 0.5)) l)))
(* (/ (sqrt (- d)) (sqrt (- l))) t_0))
(if (<= d 5.2e-210)
(/
(* (fma (* t_1 (/ (* (* 0.25 D) M) (* (- l) d))) h 1.0) d)
(sqrt (* l h)))
(*
(* (sqrt (/ d l)) t_0)
(-
1.0
(* (/ h l) (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ 1.0 2.0)))))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((d / h), (1.0 / 2.0));
double t_1 = ((0.5 / d) * D) * M;
double tmp;
if (d <= -5e-310) {
tmp = (1.0 - ((t_1 / (1.0 / h)) * (((M / d) * ((D * 0.5) * 0.5)) / l))) * ((sqrt(-d) / sqrt(-l)) * t_0);
} else if (d <= 5.2e-210) {
tmp = (fma((t_1 * (((0.25 * D) * M) / (-l * d))), h, 1.0) * d) / sqrt((l * h));
} else {
tmp = (sqrt((d / l)) * t_0) * (1.0 - ((h / l) * (pow(((M * D) / (2.0 * d)), 2.0) * (1.0 / 2.0))));
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(d / h) ^ Float64(1.0 / 2.0) t_1 = Float64(Float64(Float64(0.5 / d) * D) * M) tmp = 0.0 if (d <= -5e-310) tmp = Float64(Float64(1.0 - Float64(Float64(t_1 / Float64(1.0 / h)) * Float64(Float64(Float64(M / d) * Float64(Float64(D * 0.5) * 0.5)) / l))) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * t_0)); elseif (d <= 5.2e-210) tmp = Float64(Float64(fma(Float64(t_1 * Float64(Float64(Float64(0.25 * D) * M) / Float64(Float64(-l) * d))), h, 1.0) * d) / sqrt(Float64(l * h))); else tmp = Float64(Float64(sqrt(Float64(d / l)) * t_0) * Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0))))); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(0.5 / d), $MachinePrecision] * D), $MachinePrecision] * M), $MachinePrecision]}, If[LessEqual[d, -5e-310], N[(N[(1.0 - N[(N[(t$95$1 / N[(1.0 / h), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M / d), $MachinePrecision] * N[(N[(D * 0.5), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.2e-210], N[(N[(N[(N[(t$95$1 * N[(N[(N[(0.25 * D), $MachinePrecision] * M), $MachinePrecision] / N[((-l) * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * d), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\\
t_1 := \left(\frac{0.5}{d} \cdot D\right) \cdot M\\
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - \frac{t\_1}{\frac{1}{h}} \cdot \frac{\frac{M}{d} \cdot \left(\left(D \cdot 0.5\right) \cdot 0.5\right)}{\ell}\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot t\_0\right)\\
\mathbf{elif}\;d \leq 5.2 \cdot 10^{-210}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1 \cdot \frac{\left(0.25 \cdot D\right) \cdot M}{\left(-\ell\right) \cdot d}, h, 1\right) \cdot d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t\_0\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right)\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 72.4%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites76.2%
lift-/.f64N/A
metadata-eval76.2
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6485.4
Applied rewrites85.4%
if -4.999999999999985e-310 < d < 5.1999999999999997e-210Initial program 35.8%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites35.8%
Applied rewrites66.6%
if 5.1999999999999997e-210 < d Initial program 80.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6480.9
Applied rewrites80.9%
Final simplification82.3%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -3.7e-169)
(fabs (/ d (sqrt (* l h))))
(if (<= l -4.3e-297)
(/ d (sqrt (sqrt (* (* l h) (* l h)))))
(if (<= l 3.6e-228)
(* (sqrt (/ 1.0 (* l h))) (- d))
(/ d (* (sqrt l) (sqrt h)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3.7e-169) {
tmp = fabs((d / sqrt((l * h))));
} else if (l <= -4.3e-297) {
tmp = d / sqrt(sqrt(((l * h) * (l * h))));
} else if (l <= 3.6e-228) {
tmp = sqrt((1.0 / (l * h))) * -d;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-3.7d-169)) then
tmp = abs((d / sqrt((l * h))))
else if (l <= (-4.3d-297)) then
tmp = d / sqrt(sqrt(((l * h) * (l * h))))
else if (l <= 3.6d-228) then
tmp = sqrt((1.0d0 / (l * h))) * -d
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3.7e-169) {
tmp = Math.abs((d / Math.sqrt((l * h))));
} else if (l <= -4.3e-297) {
tmp = d / Math.sqrt(Math.sqrt(((l * h) * (l * h))));
} else if (l <= 3.6e-228) {
tmp = Math.sqrt((1.0 / (l * h))) * -d;
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -3.7e-169: tmp = math.fabs((d / math.sqrt((l * h)))) elif l <= -4.3e-297: tmp = d / math.sqrt(math.sqrt(((l * h) * (l * h)))) elif l <= 3.6e-228: tmp = math.sqrt((1.0 / (l * h))) * -d else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -3.7e-169) tmp = abs(Float64(d / sqrt(Float64(l * h)))); elseif (l <= -4.3e-297) tmp = Float64(d / sqrt(sqrt(Float64(Float64(l * h) * Float64(l * h))))); elseif (l <= 3.6e-228) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -3.7e-169)
tmp = abs((d / sqrt((l * h))));
elseif (l <= -4.3e-297)
tmp = d / sqrt(sqrt(((l * h) * (l * h))));
elseif (l <= 3.6e-228)
tmp = sqrt((1.0 / (l * h))) * -d;
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -3.7e-169], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, -4.3e-297], N[(d / N[Sqrt[N[Sqrt[N[(N[(l * h), $MachinePrecision] * N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.6e-228], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.7 \cdot 10^{-169}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{elif}\;\ell \leq -4.3 \cdot 10^{-297}:\\
\;\;\;\;\frac{d}{\sqrt{\sqrt{\left(\ell \cdot h\right) \cdot \left(\ell \cdot h\right)}}}\\
\mathbf{elif}\;\ell \leq 3.6 \cdot 10^{-228}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -3.6999999999999997e-169Initial program 69.0%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f646.9
Applied rewrites6.9%
Applied rewrites49.6%
if -3.6999999999999997e-169 < l < -4.3000000000000003e-297Initial program 88.8%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6436.1
Applied rewrites36.1%
Applied rewrites24.8%
Applied rewrites54.8%
if -4.3000000000000003e-297 < l < 3.6000000000000002e-228Initial program 79.4%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6458.2
Applied rewrites58.2%
if 3.6000000000000002e-228 < l Initial program 71.8%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.0
Applied rewrites42.0%
Applied rewrites42.0%
Applied rewrites56.0%
Final simplification53.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= l 3.6e-228) (/ 1.0 (/ (sqrt (* l h)) (- d))) (/ d (* (sqrt l) (sqrt h)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.6e-228) {
tmp = 1.0 / (sqrt((l * h)) / -d);
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 3.6d-228) then
tmp = 1.0d0 / (sqrt((l * h)) / -d)
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.6e-228) {
tmp = 1.0 / (Math.sqrt((l * h)) / -d);
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 3.6e-228: tmp = 1.0 / (math.sqrt((l * h)) / -d) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 3.6e-228) tmp = Float64(1.0 / Float64(sqrt(Float64(l * h)) / Float64(-d))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 3.6e-228)
tmp = 1.0 / (sqrt((l * h)) / -d);
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 3.6e-228], N[(1.0 / N[(N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision] / (-d)), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.6 \cdot 10^{-228}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\ell \cdot h}}{-d}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 3.6000000000000002e-228Initial program 73.2%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6412.5
Applied rewrites12.5%
Applied rewrites29.8%
Taylor expanded in d around -inf
Applied rewrites45.3%
if 3.6000000000000002e-228 < l Initial program 71.8%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.0
Applied rewrites42.0%
Applied rewrites42.0%
Applied rewrites56.0%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= l 3.6e-228) (* (sqrt (/ 1.0 (* l h))) (- d)) (/ d (* (sqrt l) (sqrt h)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.6e-228) {
tmp = sqrt((1.0 / (l * h))) * -d;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 3.6d-228) then
tmp = sqrt((1.0d0 / (l * h))) * -d
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.6e-228) {
tmp = Math.sqrt((1.0 / (l * h))) * -d;
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 3.6e-228: tmp = math.sqrt((1.0 / (l * h))) * -d else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 3.6e-228) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 3.6e-228)
tmp = sqrt((1.0 / (l * h))) * -d;
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 3.6e-228], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.6 \cdot 10^{-228}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 3.6000000000000002e-228Initial program 73.2%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6444.9
Applied rewrites44.9%
if 3.6000000000000002e-228 < l Initial program 71.8%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.0
Applied rewrites42.0%
Applied rewrites42.0%
Applied rewrites56.0%
Final simplification49.3%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (/ d (sqrt (* l h))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((l * h));
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d / sqrt((l * h))
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((l * h));
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): return d / math.sqrt((l * h))
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(l * h))) end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((l * h));
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 72.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6424.3
Applied rewrites24.3%
Applied rewrites22.8%
herbie shell --seed 2024235
(FPCore (d h l M D)
:name "Henrywood and Agarwal, Equation (12)"
:precision binary64
(* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))