
(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 18 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}
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= d -1e-309)
(*
(/ t_0 (sqrt (- l)))
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M 2.0) d)) 2.0) -0.5)))))
(*
d
(/
(fma h (* (* 0.25 (pow (* D (/ M d)) 2.0)) (/ -0.5 l)) 1.0)
(* (sqrt h) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(-d);
double tmp;
if (d <= -1e-309) {
tmp = (t_0 / sqrt(-l)) * ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * (pow((D * ((M / 2.0) / d)), 2.0) * -0.5))));
} else {
tmp = d * (fma(h, ((0.25 * pow((D * (M / d)), 2.0)) * (-0.5 / l)), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (d <= -1e-309) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5))))); else tmp = Float64(d * Float64(fma(h, Float64(Float64(0.25 * (Float64(D * Float64(M / d)) ^ 2.0)) * Float64(-0.5 / l)), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -1e-309], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(N[(0.25 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;d \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-\ell}} \cdot \left(\frac{t\_0}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, \left(0.25 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right) \cdot \frac{-0.5}{\ell}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.000000000000002e-309Initial program 72.4%
Simplified73.7%
frac-2neg73.7%
sqrt-div77.6%
Applied egg-rr77.6%
frac-2neg77.6%
sqrt-div87.8%
Applied egg-rr87.8%
if -1.000000000000002e-309 < d Initial program 67.2%
Simplified66.5%
Applied egg-rr81.9%
Simplified87.9%
Final simplification87.9%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* D M) (* d 2.0)) 2.0)))))
INFINITY)
(*
(- 1.0 (* 0.5 (* 0.25 (* (/ h l) (pow (* D (/ M d)) 2.0)))))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(/ (* (pow D 2.0) (/ (sqrt h) (pow l 1.5))) (* -8.0 (/ d (pow M 2.0))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((D * M) / (d * 2.0)), 2.0))))) <= ((double) INFINITY)) {
tmp = (1.0 - (0.5 * (0.25 * ((h / l) * pow((D * (M / d)), 2.0))))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = (pow(D, 2.0) * (sqrt(h) / pow(l, 1.5))) / (-8.0 * (d / pow(M, 2.0)));
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (((Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((D * M) / (d * 2.0)), 2.0))))) <= Double.POSITIVE_INFINITY) {
tmp = (1.0 - (0.5 * (0.25 * ((h / l) * Math.pow((D * (M / d)), 2.0))))) * (Math.sqrt((d / l)) * Math.sqrt((d / h)));
} else {
tmp = (Math.pow(D, 2.0) * (Math.sqrt(h) / Math.pow(l, 1.5))) / (-8.0 * (d / Math.pow(M, 2.0)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if ((math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((D * M) / (d * 2.0)), 2.0))))) <= math.inf: tmp = (1.0 - (0.5 * (0.25 * ((h / l) * math.pow((D * (M / d)), 2.0))))) * (math.sqrt((d / l)) * math.sqrt((d / h))) else: tmp = (math.pow(D, 2.0) * (math.sqrt(h) / math.pow(l, 1.5))) / (-8.0 * (d / math.pow(M, 2.0))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0))))) <= Inf) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(Float64(h / l) * (Float64(D * Float64(M / d)) ^ 2.0))))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64((D ^ 2.0) * Float64(sqrt(h) / (l ^ 1.5))) / Float64(-8.0 * Float64(d / (M ^ 2.0)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (((((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((D * M) / (d * 2.0)) ^ 2.0))))) <= Inf) tmp = (1.0 - (0.5 * (0.25 * ((h / l) * ((D * (M / d)) ^ 2.0))))) * (sqrt((d / l)) * sqrt((d / h))); else tmp = ((D ^ 2.0) * (sqrt(h) / (l ^ 1.5))) / (-8.0 * (d / (M ^ 2.0))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(1.0 - N[(0.5 * N[(0.25 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[D, 2.0], $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-8.0 * N[(d / N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)\right) \leq \infty:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{{D}^{2} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}}{-8 \cdot \frac{d}{{M}^{2}}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < +inf.0Initial program 88.2%
Simplified88.6%
Taylor expanded in M around 0 51.7%
*-commutative51.7%
associate-*r*55.0%
times-frac59.9%
*-commutative59.9%
associate-/l*58.5%
unpow258.5%
unpow258.5%
unpow258.5%
times-frac77.3%
swap-sqr88.6%
unpow288.6%
associate-*r/88.2%
*-commutative88.2%
associate-/l*88.6%
Simplified88.6%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 0.0%
Simplified0.0%
frac-2neg0.0%
sqrt-div1.9%
Applied egg-rr1.9%
Taylor expanded in d around 0 13.5%
*-commutative13.5%
associate-/l*13.5%
associate-*l*13.5%
associate-*r*13.5%
*-commutative13.5%
associate-*l*13.5%
*-commutative13.5%
associate-*r/13.5%
Simplified13.5%
associate-*r*13.5%
clear-num13.5%
un-div-inv13.5%
sqrt-div13.5%
sqrt-pow119.1%
metadata-eval19.1%
*-un-lft-identity19.1%
times-frac19.1%
metadata-eval19.1%
Applied egg-rr19.1%
Final simplification74.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= h -1.75e-23)
(*
(* (/ t_0 (sqrt (- h))) (sqrt (/ d l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D d)) 2.0)))))
(if (<= h -1e-309)
(*
(/ t_0 (sqrt (- l)))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* h (* -0.5 (pow (* D (/ (* M 0.5) d)) 2.0))) l))))
(*
d
(/
(fma h (* (* 0.25 (pow (* D (/ M d)) 2.0)) (/ -0.5 l)) 1.0)
(* (sqrt h) (sqrt l))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(-d);
double tmp;
if (h <= -1.75e-23) {
tmp = ((t_0 / sqrt(-h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D / d)), 2.0))));
} else if (h <= -1e-309) {
tmp = (t_0 / sqrt(-l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * pow((D * ((M * 0.5) / d)), 2.0))) / l)));
} else {
tmp = d * (fma(h, ((0.25 * pow((D * (M / d)), 2.0)) * (-0.5 / l)), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -1.75e-23) tmp = Float64(Float64(Float64(t_0 / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0))))); elseif (h <= -1e-309) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(D * Float64(Float64(M * 0.5) / d)) ^ 2.0))) / l)))); else tmp = Float64(d * Float64(fma(h, Float64(Float64(0.25 * (Float64(D * Float64(M / d)) ^ 2.0)) * Float64(-0.5 / l)), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -1.75e-23], N[(N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1e-309], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(D * N[(N[(M * 0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(N[(0.25 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;h \leq -1.75 \cdot 10^{-23}:\\
\;\;\;\;\left(\frac{t\_0}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\\
\mathbf{elif}\;h \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(D \cdot \frac{M \cdot 0.5}{d}\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, \left(0.25 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right) \cdot \frac{-0.5}{\ell}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -1.74999999999999997e-23Initial program 67.6%
Simplified68.9%
frac-2neg69.8%
sqrt-div87.4%
Applied egg-rr80.8%
if -1.74999999999999997e-23 < h < -1.000000000000002e-309Initial program 78.1%
Simplified79.7%
frac-2neg79.7%
sqrt-div87.0%
Applied egg-rr87.0%
associate-*l/90.7%
*-commutative90.7%
add-sqr-sqrt90.7%
pow290.7%
sqrt-pow190.7%
metadata-eval90.7%
pow190.7%
div-inv90.7%
metadata-eval90.7%
Applied egg-rr90.7%
if -1.000000000000002e-309 < h Initial program 67.2%
Simplified66.5%
Applied egg-rr81.9%
Simplified87.9%
Final simplification86.5%
(FPCore (d h l M D)
:precision binary64
(if (<= l -1e-309)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D d)) 2.0)))))
(*
d
(/
(fma h (* (* 0.25 (pow (* D (/ M d)) 2.0)) (/ -0.5 l)) 1.0)
(* (sqrt h) (sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1e-309) {
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D / d)), 2.0))));
} else {
tmp = d * (fma(h, ((0.25 * pow((D * (M / d)), 2.0)) * (-0.5 / l)), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (l <= -1e-309) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0))))); else tmp = Float64(d * Float64(fma(h, Float64(Float64(0.25 * (Float64(D * Float64(M / d)) ^ 2.0)) * Float64(-0.5 / l)), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1e-309], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(N[(0.25 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, \left(0.25 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right) \cdot \frac{-0.5}{\ell}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.000000000000002e-309Initial program 72.4%
Simplified73.7%
frac-2neg77.6%
sqrt-div87.8%
Applied egg-rr80.9%
if -1.000000000000002e-309 < l Initial program 67.2%
Simplified66.5%
Applied egg-rr81.9%
Simplified87.9%
Final simplification84.2%
(FPCore (d h l M D)
:precision binary64
(if (<= d -3.6e-240)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* h (/ (* -0.5 (pow (/ D (/ (* d 2.0) M)) 2.0)) l)))))
(if (<= d -1e-309)
(* (* 0.125 (* (pow D 2.0) (/ (pow M 2.0) d))) (sqrt (/ h (pow l 3.0))))
(*
d
(/
(fma h (* (* 0.25 (pow (* D (/ M d)) 2.0)) (/ -0.5 l)) 1.0)
(* (sqrt h) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -3.6e-240) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (h * ((-0.5 * pow((D / ((d * 2.0) / M)), 2.0)) / l))));
} else if (d <= -1e-309) {
tmp = (0.125 * (pow(D, 2.0) * (pow(M, 2.0) / d))) * sqrt((h / pow(l, 3.0)));
} else {
tmp = d * (fma(h, ((0.25 * pow((D * (M / d)), 2.0)) * (-0.5 / l)), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (d <= -3.6e-240) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(D / Float64(Float64(d * 2.0) / M)) ^ 2.0)) / l))))); elseif (d <= -1e-309) tmp = Float64(Float64(0.125 * Float64((D ^ 2.0) * Float64((M ^ 2.0) / d))) * sqrt(Float64(h / (l ^ 3.0)))); else tmp = Float64(d * Float64(fma(h, Float64(Float64(0.25 * (Float64(D * Float64(M / d)) ^ 2.0)) * Float64(-0.5 / l)), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -3.6e-240], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(D / N[(N[(d * 2.0), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-309], N[(N[(0.125 * N[(N[Power[D, 2.0], $MachinePrecision] * N[(N[Power[M, 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(N[(0.25 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -3.6 \cdot 10^{-240}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(\frac{D}{\frac{d \cdot 2}{M}}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\left(0.125 \cdot \left({D}^{2} \cdot \frac{{M}^{2}}{d}\right)\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, \left(0.25 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right) \cdot \frac{-0.5}{\ell}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -3.5999999999999999e-240Initial program 80.4%
Simplified82.0%
associate-*r/80.4%
*-un-lft-identity80.4%
times-frac82.0%
associate-/l/82.0%
*-commutative82.0%
times-frac80.4%
*-commutative80.4%
*-un-lft-identity80.4%
frac-times82.1%
clear-num82.2%
frac-times82.0%
*-un-lft-identity82.0%
Applied egg-rr82.0%
associate-*l/83.9%
*-commutative83.9%
Applied egg-rr83.9%
associate-/l*84.8%
*-commutative84.8%
associate-*r/84.8%
Simplified84.8%
if -3.5999999999999999e-240 < d < -1.000000000000002e-309Initial program 35.3%
Simplified34.9%
Taylor expanded in h around -inf 0.0%
associate-*r*0.0%
*-commutative0.0%
associate-/l*0.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt52.1%
associate-/l*52.1%
Simplified52.1%
Taylor expanded in h around 0 52.2%
associate-*r*52.2%
associate-/l*52.1%
Simplified52.1%
if -1.000000000000002e-309 < d Initial program 67.2%
Simplified66.5%
Applied egg-rr81.9%
Simplified87.9%
Final simplification83.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* D (/ M d)) 2.0)))
(if (<= l -1e-309)
(*
(sqrt (/ d l))
(* (/ (sqrt (- d)) (sqrt (- h))) (+ 1.0 (* (/ h l) (* t_0 -0.125)))))
(* d (/ (fma h (* (* 0.25 t_0) (/ -0.5 l)) 1.0) (* (sqrt h) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((D * (M / d)), 2.0);
double tmp;
if (l <= -1e-309) {
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (t_0 * -0.125))));
} else {
tmp = d * (fma(h, ((0.25 * t_0) * (-0.5 / l)), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(D * Float64(M / d)) ^ 2.0 tmp = 0.0 if (l <= -1e-309) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(t_0 * -0.125))))); else tmp = Float64(d * Float64(fma(h, Float64(Float64(0.25 * t_0) * Float64(-0.5 / l)), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l, -1e-309], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(t$95$0 * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(N[(0.25 * t$95$0), $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(D \cdot \frac{M}{d}\right)}^{2}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(t\_0 \cdot -0.125\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, \left(0.25 \cdot t\_0\right) \cdot \frac{-0.5}{\ell}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.000000000000002e-309Initial program 72.4%
Simplified73.7%
associate-*r/72.4%
*-un-lft-identity72.4%
times-frac73.7%
associate-/l/73.7%
*-commutative73.7%
times-frac72.4%
*-commutative72.4%
*-un-lft-identity72.4%
frac-times73.7%
clear-num73.7%
frac-times73.7%
*-un-lft-identity73.7%
Applied egg-rr73.7%
Taylor expanded in h around 0 41.9%
associate-*r/41.9%
associate-*r*45.6%
associate-*r*45.6%
times-frac47.6%
associate-*r/47.6%
associate-/l*48.3%
unpow248.3%
unpow248.3%
unpow248.3%
times-frac59.0%
swap-sqr73.7%
unpow273.7%
Simplified73.7%
frac-2neg77.6%
sqrt-div87.8%
Applied egg-rr80.9%
if -1.000000000000002e-309 < l Initial program 67.2%
Simplified66.5%
Applied egg-rr81.9%
Simplified87.9%
Final simplification84.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))) (t_1 (sqrt (/ d h))))
(if (or (<= M 1.85e-94) (and (not (<= M 2.55e-67)) (<= M 1.45e-19)))
(* t_0 t_1)
(* t_1 (* t_0 (* (/ (pow (* D (/ M d)) 2.0) l) (* h -0.125)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h));
double tmp;
if ((M <= 1.85e-94) || (!(M <= 2.55e-67) && (M <= 1.45e-19))) {
tmp = t_0 * t_1;
} else {
tmp = t_1 * (t_0 * ((pow((D * (M / d)), 2.0) / l) * (h * -0.125)));
}
return tmp;
}
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 = sqrt((d / l))
t_1 = sqrt((d / h))
if ((m <= 1.85d-94) .or. (.not. (m <= 2.55d-67)) .and. (m <= 1.45d-19)) then
tmp = t_0 * t_1
else
tmp = t_1 * (t_0 * ((((d_1 * (m / d)) ** 2.0d0) / l) * (h * (-0.125d0))))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt((d / h));
double tmp;
if ((M <= 1.85e-94) || (!(M <= 2.55e-67) && (M <= 1.45e-19))) {
tmp = t_0 * t_1;
} else {
tmp = t_1 * (t_0 * ((Math.pow((D * (M / d)), 2.0) / l) * (h * -0.125)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = math.sqrt((d / h)) tmp = 0 if (M <= 1.85e-94) or (not (M <= 2.55e-67) and (M <= 1.45e-19)): tmp = t_0 * t_1 else: tmp = t_1 * (t_0 * ((math.pow((D * (M / d)), 2.0) / l) * (h * -0.125))) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(d / h)) tmp = 0.0 if ((M <= 1.85e-94) || (!(M <= 2.55e-67) && (M <= 1.45e-19))) tmp = Float64(t_0 * t_1); else tmp = Float64(t_1 * Float64(t_0 * Float64(Float64((Float64(D * Float64(M / d)) ^ 2.0) / l) * Float64(h * -0.125)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); t_1 = sqrt((d / h)); tmp = 0.0; if ((M <= 1.85e-94) || (~((M <= 2.55e-67)) && (M <= 1.45e-19))) tmp = t_0 * t_1; else tmp = t_1 * (t_0 * ((((D * (M / d)) ^ 2.0) / l) * (h * -0.125))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[M, 1.85e-94], And[N[Not[LessEqual[M, 2.55e-67]], $MachinePrecision], LessEqual[M, 1.45e-19]]], N[(t$95$0 * t$95$1), $MachinePrecision], N[(t$95$1 * N[(t$95$0 * N[(N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision] * N[(h * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;M \leq 1.85 \cdot 10^{-94} \lor \neg \left(M \leq 2.55 \cdot 10^{-67}\right) \land M \leq 1.45 \cdot 10^{-19}:\\
\;\;\;\;t\_0 \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 \cdot \left(\frac{{\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell} \cdot \left(h \cdot -0.125\right)\right)\right)\\
\end{array}
\end{array}
if M < 1.8499999999999999e-94 or 2.54999999999999991e-67 < M < 1.45e-19Initial program 71.2%
Simplified71.0%
associate-*r/71.2%
*-un-lft-identity71.2%
times-frac71.0%
associate-/l/71.0%
*-commutative71.0%
times-frac71.2%
*-commutative71.2%
*-un-lft-identity71.2%
frac-times70.6%
clear-num70.6%
frac-times71.0%
*-un-lft-identity71.0%
Applied egg-rr71.0%
sqrt-div40.8%
Applied egg-rr40.8%
Taylor expanded in d around inf 47.0%
if 1.8499999999999999e-94 < M < 2.54999999999999991e-67 or 1.45e-19 < M Initial program 66.9%
Simplified69.6%
Taylor expanded in M around inf 30.2%
associate-*r/30.2%
associate-*r*31.8%
associate-*r*31.8%
associate-*l/33.1%
associate-*r/33.1%
*-commutative33.1%
associate-*l*33.1%
Simplified45.4%
Final simplification46.5%
(FPCore (d h l M D) :precision binary64 (* (sqrt (/ d l)) (* (sqrt (/ d h)) (+ 1.0 (* h (* -0.125 (/ (pow (* D (/ M d)) 2.0) l)))))))
double code(double d, double h, double l, double M, double D) {
return sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (h * (-0.125 * (pow((D * (M / d)), 2.0) / 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 = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + (h * ((-0.125d0) * (((d_1 * (m / d)) ** 2.0d0) / l)))))
end function
public static double code(double d, double h, double l, double M, double D) {
return Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + (h * (-0.125 * (Math.pow((D * (M / d)), 2.0) / l)))));
}
def code(d, h, l, M, D): return math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + (h * (-0.125 * (math.pow((D * (M / d)), 2.0) / l)))))
function code(d, h, l, M, D) return Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(h * Float64(-0.125 * Float64((Float64(D * Float64(M / d)) ^ 2.0) / l)))))) end
function tmp = code(d, h, l, M, D) tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (h * (-0.125 * (((D * (M / d)) ^ 2.0) / l))))); end
code[d_, h_, l_, M_, D_] := N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(-0.125 * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \frac{{\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}\right)\right)\right)
\end{array}
Initial program 69.9%
Simplified70.3%
associate-*r/69.9%
*-un-lft-identity69.9%
times-frac70.3%
associate-/l/70.3%
*-commutative70.3%
times-frac69.9%
*-commutative69.9%
*-un-lft-identity69.9%
frac-times70.3%
clear-num70.3%
frac-times70.3%
*-un-lft-identity70.3%
Applied egg-rr70.3%
Taylor expanded in h around 0 42.8%
associate-*r/42.8%
associate-*r*45.4%
associate-*r*45.4%
times-frac47.5%
associate-*r/47.5%
associate-/l*47.9%
unpow247.9%
unpow247.9%
unpow247.9%
times-frac58.7%
swap-sqr70.3%
unpow270.3%
Simplified70.3%
associate-*r/72.0%
clear-num72.0%
Applied egg-rr72.0%
associate-/r/72.0%
associate-*l/72.0%
*-lft-identity72.0%
*-commutative72.0%
associate-/l*71.7%
associate-/l*71.7%
Simplified71.7%
Final simplification71.7%
(FPCore (d h l M D) :precision binary64 (* (sqrt (/ d l)) (* (sqrt (/ d h)) (+ 1.0 (/ (* h (* (pow (* D (/ M d)) 2.0) -0.125)) l)))))
double code(double d, double h, double l, double M, double D) {
return sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (pow((D * (M / d)), 2.0) * -0.125)) / 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 = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h * (((d_1 * (m / d)) ** 2.0d0) * (-0.125d0))) / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h * (Math.pow((D * (M / d)), 2.0) * -0.125)) / l)));
}
def code(d, h, l, M, D): return math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h * (math.pow((D * (M / d)), 2.0) * -0.125)) / l)))
function code(d, h, l, M, D) return Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64((Float64(D * Float64(M / d)) ^ 2.0) * -0.125)) / l)))) end
function tmp = code(d, h, l, M, D) tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (((D * (M / d)) ^ 2.0) * -0.125)) / l))); end
code[d_, h_, l_, M_, D_] := N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125\right)}{\ell}\right)\right)
\end{array}
Initial program 69.9%
Simplified70.3%
associate-*r/69.9%
*-un-lft-identity69.9%
times-frac70.3%
associate-/l/70.3%
*-commutative70.3%
times-frac69.9%
*-commutative69.9%
*-un-lft-identity69.9%
frac-times70.3%
clear-num70.3%
frac-times70.3%
*-un-lft-identity70.3%
Applied egg-rr70.3%
Taylor expanded in h around 0 42.8%
associate-*r/42.8%
associate-*r*45.4%
associate-*r*45.4%
times-frac47.5%
associate-*r/47.5%
associate-/l*47.9%
unpow247.9%
unpow247.9%
unpow247.9%
times-frac58.7%
swap-sqr70.3%
unpow270.3%
Simplified70.3%
associate-*r/72.0%
Applied egg-rr72.0%
Final simplification72.0%
(FPCore (d h l M D)
:precision binary64
(if (<= d -2.7e-8)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d -1e-309)
(* d (log1p (expm1 (pow (* l h) -0.5))))
(* d (/ (pow h -0.5) (sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.7e-8) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= -1e-309) {
tmp = d * log1p(expm1(pow((l * h), -0.5)));
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.7e-8) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (d <= -1e-309) {
tmp = d * Math.log1p(Math.expm1(Math.pow((l * h), -0.5)));
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -2.7e-8: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif d <= -1e-309: tmp = d * math.log1p(math.expm1(math.pow((l * h), -0.5))) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -2.7e-8) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= -1e-309) tmp = Float64(d * log1p(expm1((Float64(l * h) ^ -0.5)))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -2.7e-8], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-309], N[(d * N[Log[1 + N[(Exp[N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.7 \cdot 10^{-8}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\
\;\;\;\;d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\left(\ell \cdot h\right)}^{-0.5}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.70000000000000002e-8Initial program 85.7%
Simplified88.3%
associate-*r/85.7%
*-un-lft-identity85.7%
times-frac88.3%
associate-/l/88.3%
*-commutative88.3%
times-frac85.7%
*-commutative85.7%
*-un-lft-identity85.7%
frac-times88.5%
clear-num88.5%
frac-times88.2%
*-un-lft-identity88.2%
Applied egg-rr88.2%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 70.9%
if -2.70000000000000002e-8 < d < -1.000000000000002e-309Initial program 58.4%
Simplified58.3%
Taylor expanded in d around inf 15.2%
log1p-expm1-u39.0%
pow1/239.0%
inv-pow39.0%
pow-pow39.0%
*-commutative39.0%
metadata-eval39.0%
Applied egg-rr39.0%
if -1.000000000000002e-309 < d Initial program 67.2%
Simplified66.5%
Taylor expanded in d around inf 43.2%
associate-/r*43.2%
Simplified43.2%
sqrt-div47.8%
div-inv47.7%
inv-pow47.7%
sqrt-pow147.7%
metadata-eval47.7%
Applied egg-rr47.7%
associate-*r/47.8%
*-rgt-identity47.8%
Simplified47.8%
Final simplification51.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* d (- (sqrt (/ (/ 1.0 h) l))))))
(if (<= d -1.95e-125)
t_0
(if (<= d -4.4e-262)
(* d (pow (pow (* l h) 2.0) -0.25))
(if (<= d 3.1e-214) t_0 (* d (/ (pow h -0.5) (sqrt l))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = d * -sqrt(((1.0 / h) / l));
double tmp;
if (d <= -1.95e-125) {
tmp = t_0;
} else if (d <= -4.4e-262) {
tmp = d * pow(pow((l * h), 2.0), -0.25);
} else if (d <= 3.1e-214) {
tmp = t_0;
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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(((1.0d0 / h) / l))
if (d <= (-1.95d-125)) then
tmp = t_0
else if (d <= (-4.4d-262)) then
tmp = d * (((l * h) ** 2.0d0) ** (-0.25d0))
else if (d <= 3.1d-214) then
tmp = t_0
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d * -Math.sqrt(((1.0 / h) / l));
double tmp;
if (d <= -1.95e-125) {
tmp = t_0;
} else if (d <= -4.4e-262) {
tmp = d * Math.pow(Math.pow((l * h), 2.0), -0.25);
} else if (d <= 3.1e-214) {
tmp = t_0;
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = d * -math.sqrt(((1.0 / h) / l)) tmp = 0 if d <= -1.95e-125: tmp = t_0 elif d <= -4.4e-262: tmp = d * math.pow(math.pow((l * h), 2.0), -0.25) elif d <= 3.1e-214: tmp = t_0 else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))) tmp = 0.0 if (d <= -1.95e-125) tmp = t_0; elseif (d <= -4.4e-262) tmp = Float64(d * ((Float64(l * h) ^ 2.0) ^ -0.25)); elseif (d <= 3.1e-214) tmp = t_0; else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = d * -sqrt(((1.0 / h) / l)); tmp = 0.0; if (d <= -1.95e-125) tmp = t_0; elseif (d <= -4.4e-262) tmp = d * (((l * h) ^ 2.0) ^ -0.25); elseif (d <= 3.1e-214) tmp = t_0; else tmp = d * ((h ^ -0.5) / sqrt(l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -1.95e-125], t$95$0, If[LessEqual[d, -4.4e-262], N[(d * N[Power[N[Power[N[(l * h), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.1e-214], t$95$0, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{if}\;d \leq -1.95 \cdot 10^{-125}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq -4.4 \cdot 10^{-262}:\\
\;\;\;\;d \cdot {\left({\left(\ell \cdot h\right)}^{2}\right)}^{-0.25}\\
\mathbf{elif}\;d \leq 3.1 \cdot 10^{-214}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.94999999999999991e-125 or -4.39999999999999977e-262 < d < 3.10000000000000004e-214Initial program 69.7%
Simplified71.2%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.6%
neg-mul-144.6%
Simplified44.6%
if -1.94999999999999991e-125 < d < -4.39999999999999977e-262Initial program 56.7%
Simplified56.7%
Taylor expanded in d around inf 17.7%
associate-/r*17.7%
Simplified17.7%
associate-/l/17.7%
inv-pow17.7%
metadata-eval17.7%
metadata-eval17.7%
pow-sqr17.7%
pow-prod-up17.7%
pow-prod-up17.7%
sqrt-unprod17.7%
add-sqr-sqrt17.7%
pow-prod-down33.0%
pow233.0%
Applied egg-rr33.0%
if 3.10000000000000004e-214 < d Initial program 74.5%
Simplified73.6%
Taylor expanded in d around inf 51.5%
associate-/r*51.5%
Simplified51.5%
sqrt-div57.1%
div-inv57.1%
inv-pow57.1%
sqrt-pow157.1%
metadata-eval57.1%
Applied egg-rr57.1%
associate-*r/57.1%
*-rgt-identity57.1%
Simplified57.1%
Final simplification47.9%
(FPCore (d h l M D)
:precision binary64
(if (<= l -1.45e-226)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= l 1.6e-282)
(* d (sqrt (/ (/ 1.0 l) h)))
(* d (* (pow h -0.5) (pow l -0.5))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.45e-226) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (l <= 1.6e-282) {
tmp = d * sqrt(((1.0 / l) / h));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
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 <= (-1.45d-226)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (l <= 1.6d-282) then
tmp = d * sqrt(((1.0d0 / l) / h))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.45e-226) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (l <= 1.6e-282) {
tmp = d * Math.sqrt(((1.0 / l) / h));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -1.45e-226: tmp = d * -math.sqrt(((1.0 / h) / l)) elif l <= 1.6e-282: tmp = d * math.sqrt(((1.0 / l) / h)) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -1.45e-226) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (l <= 1.6e-282) tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -1.45e-226) tmp = d * -sqrt(((1.0 / h) / l)); elseif (l <= 1.6e-282) tmp = d * sqrt(((1.0 / l) / h)); else tmp = d * ((h ^ -0.5) * (l ^ -0.5)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.45e-226], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 1.6e-282], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.45 \cdot 10^{-226}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq 1.6 \cdot 10^{-282}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.45000000000000001e-226Initial program 69.6%
Simplified71.2%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt45.2%
neg-mul-145.2%
Simplified45.2%
if -1.45000000000000001e-226 < l < 1.59999999999999991e-282Initial program 71.3%
Simplified71.3%
Taylor expanded in d around inf 50.6%
associate-/r*50.6%
Simplified50.6%
Taylor expanded in h around 0 50.6%
associate-/l/50.6%
Simplified50.6%
if 1.59999999999999991e-282 < l Initial program 70.0%
Simplified69.1%
frac-2neg69.1%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 43.9%
*-commutative43.9%
unpow-143.9%
metadata-eval43.9%
pow-sqr44.0%
rem-sqrt-square44.4%
rem-square-sqrt44.3%
fabs-sqr44.3%
rem-square-sqrt44.4%
Simplified44.4%
unpow-prod-down48.9%
Applied egg-rr48.9%
Final simplification47.4%
(FPCore (d h l M D)
:precision binary64
(if (<= d -1.9e-138)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d -1e-309)
(* d (pow (pow (* l h) 2.0) -0.25))
(* d (/ (pow h -0.5) (sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1.9e-138) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= -1e-309) {
tmp = d * pow(pow((l * h), 2.0), -0.25);
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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 <= (-1.9d-138)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (d <= (-1d-309)) then
tmp = d * (((l * h) ** 2.0d0) ** (-0.25d0))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1.9e-138) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (d <= -1e-309) {
tmp = d * Math.pow(Math.pow((l * h), 2.0), -0.25);
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -1.9e-138: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif d <= -1e-309: tmp = d * math.pow(math.pow((l * h), 2.0), -0.25) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -1.9e-138) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= -1e-309) tmp = Float64(d * ((Float64(l * h) ^ 2.0) ^ -0.25)); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= -1.9e-138) tmp = sqrt((d / l)) * sqrt((d / h)); elseif (d <= -1e-309) tmp = d * (((l * h) ^ 2.0) ^ -0.25); else tmp = d * ((h ^ -0.5) / sqrt(l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -1.9e-138], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-309], N[(d * N[Power[N[Power[N[(l * h), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.9 \cdot 10^{-138}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\
\;\;\;\;d \cdot {\left({\left(\ell \cdot h\right)}^{2}\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.9000000000000001e-138Initial program 85.9%
Simplified87.8%
associate-*r/85.9%
*-un-lft-identity85.9%
times-frac87.8%
associate-/l/87.8%
*-commutative87.8%
times-frac85.9%
*-commutative85.9%
*-un-lft-identity85.9%
frac-times88.0%
clear-num88.1%
frac-times87.8%
*-un-lft-identity87.8%
Applied egg-rr87.8%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 59.9%
if -1.9000000000000001e-138 < d < -1.000000000000002e-309Initial program 43.3%
Simplified43.1%
Taylor expanded in d around inf 17.0%
associate-/r*17.0%
Simplified17.0%
associate-/l/17.0%
inv-pow17.0%
metadata-eval17.0%
metadata-eval17.0%
pow-sqr17.0%
pow-prod-up17.0%
pow-prod-up17.0%
sqrt-unprod17.0%
add-sqr-sqrt17.0%
pow-prod-down26.1%
pow226.1%
Applied egg-rr26.1%
if -1.000000000000002e-309 < d Initial program 67.2%
Simplified66.5%
Taylor expanded in d around inf 43.2%
associate-/r*43.2%
Simplified43.2%
sqrt-div47.8%
div-inv47.7%
inv-pow47.7%
sqrt-pow147.7%
metadata-eval47.7%
Applied egg-rr47.7%
associate-*r/47.8%
*-rgt-identity47.8%
Simplified47.8%
Final simplification48.5%
(FPCore (d h l M D)
:precision binary64
(if (<= l -1.15e-226)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= l 2.95e-294)
(* d (sqrt (/ (/ 1.0 l) h)))
(* d (/ (pow h -0.5) (sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.15e-226) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (l <= 2.95e-294) {
tmp = d * sqrt(((1.0 / l) / h));
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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 <= (-1.15d-226)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (l <= 2.95d-294) then
tmp = d * sqrt(((1.0d0 / l) / h))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.15e-226) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (l <= 2.95e-294) {
tmp = d * Math.sqrt(((1.0 / l) / h));
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -1.15e-226: tmp = d * -math.sqrt(((1.0 / h) / l)) elif l <= 2.95e-294: tmp = d * math.sqrt(((1.0 / l) / h)) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -1.15e-226) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (l <= 2.95e-294) tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -1.15e-226) tmp = d * -sqrt(((1.0 / h) / l)); elseif (l <= 2.95e-294) tmp = d * sqrt(((1.0 / l) / h)); else tmp = d * ((h ^ -0.5) / sqrt(l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.15e-226], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 2.95e-294], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.15 \cdot 10^{-226}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq 2.95 \cdot 10^{-294}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.15e-226Initial program 69.6%
Simplified71.2%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt45.2%
neg-mul-145.2%
Simplified45.2%
if -1.15e-226 < l < 2.94999999999999997e-294Initial program 82.5%
Simplified82.5%
Taylor expanded in d around inf 57.0%
associate-/r*57.0%
Simplified57.0%
Taylor expanded in h around 0 57.0%
associate-/l/57.1%
Simplified57.1%
if 2.94999999999999997e-294 < l Initial program 67.8%
Simplified67.0%
Taylor expanded in d around inf 43.0%
associate-/r*43.0%
Simplified43.0%
sqrt-div47.7%
div-inv47.6%
inv-pow47.6%
sqrt-pow147.6%
metadata-eval47.6%
Applied egg-rr47.6%
associate-*r/47.7%
*-rgt-identity47.7%
Simplified47.7%
Final simplification47.4%
(FPCore (d h l M D) :precision binary64 (if (<= l -3e-227) (* d (- (sqrt (/ (/ 1.0 h) l)))) (* d (/ 1.0 (sqrt (* l h))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3e-227) {
tmp = d * -sqrt(((1.0 / h) / l));
} else {
tmp = d * (1.0 / sqrt((l * h)));
}
return tmp;
}
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 <= (-3d-227)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else
tmp = d * (1.0d0 / sqrt((l * h)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3e-227) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else {
tmp = d * (1.0 / Math.sqrt((l * h)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -3e-227: tmp = d * -math.sqrt(((1.0 / h) / l)) else: tmp = d * (1.0 / math.sqrt((l * h))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -3e-227) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); else tmp = Float64(d * Float64(1.0 / sqrt(Float64(l * h)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -3e-227) tmp = d * -sqrt(((1.0 / h) / l)); else tmp = d * (1.0 / sqrt((l * h))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -3e-227], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3 \cdot 10^{-227}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if l < -3e-227Initial program 69.6%
Simplified71.2%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt45.2%
neg-mul-145.2%
Simplified45.2%
if -3e-227 < l Initial program 70.2%
Simplified69.6%
Taylor expanded in d around inf 45.3%
sqrt-div45.7%
metadata-eval45.7%
*-commutative45.7%
Applied egg-rr45.7%
Final simplification45.5%
(FPCore (d h l M D) :precision binary64 (if (<= l -4.8e-227) (* d (- (pow (* l h) -0.5))) (* d (/ 1.0 (sqrt (* l h))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.8e-227) {
tmp = d * -pow((l * h), -0.5);
} else {
tmp = d * (1.0 / sqrt((l * h)));
}
return tmp;
}
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 <= (-4.8d-227)) then
tmp = d * -((l * h) ** (-0.5d0))
else
tmp = d * (1.0d0 / sqrt((l * h)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.8e-227) {
tmp = d * -Math.pow((l * h), -0.5);
} else {
tmp = d * (1.0 / Math.sqrt((l * h)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -4.8e-227: tmp = d * -math.pow((l * h), -0.5) else: tmp = d * (1.0 / math.sqrt((l * h))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -4.8e-227) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); else tmp = Float64(d * Float64(1.0 / sqrt(Float64(l * h)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -4.8e-227) tmp = d * -((l * h) ^ -0.5); else tmp = d * (1.0 / sqrt((l * h))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -4.8e-227], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.8 \cdot 10^{-227}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if l < -4.7999999999999999e-227Initial program 69.6%
Simplified71.2%
Taylor expanded in d around inf 5.2%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.8%
neg-mul-144.8%
Simplified44.8%
if -4.7999999999999999e-227 < l Initial program 70.2%
Simplified69.6%
Taylor expanded in d around inf 45.3%
sqrt-div45.7%
metadata-eval45.7%
*-commutative45.7%
Applied egg-rr45.7%
Final simplification45.3%
(FPCore (d h l M D) :precision binary64 (* d (/ 1.0 (sqrt (* l h)))))
double code(double d, double h, double l, double M, double D) {
return d * (1.0 / sqrt((l * h)));
}
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 * (1.0d0 / sqrt((l * h)))
end function
public static double code(double d, double h, double l, double M, double D) {
return d * (1.0 / Math.sqrt((l * h)));
}
def code(d, h, l, M, D): return d * (1.0 / math.sqrt((l * h)))
function code(d, h, l, M, D) return Float64(d * Float64(1.0 / sqrt(Float64(l * h)))) end
function tmp = code(d, h, l, M, D) tmp = d * (1.0 / sqrt((l * h))); end
code[d_, h_, l_, M_, D_] := N[(d * N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d \cdot \frac{1}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 69.9%
Simplified70.3%
Taylor expanded in d around inf 27.1%
sqrt-div27.3%
metadata-eval27.3%
*-commutative27.3%
Applied egg-rr27.3%
Final simplification27.3%
(FPCore (d h l M D) :precision binary64 (* d (pow (* l h) -0.5)))
double code(double d, double h, double l, double M, double D) {
return d * pow((l * h), -0.5);
}
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 * ((l * h) ** (-0.5d0))
end function
public static double code(double d, double h, double l, double M, double D) {
return d * Math.pow((l * h), -0.5);
}
def code(d, h, l, M, D): return d * math.pow((l * h), -0.5)
function code(d, h, l, M, D) return Float64(d * (Float64(l * h) ^ -0.5)) end
function tmp = code(d, h, l, M, D) tmp = d * ((l * h) ^ -0.5); end
code[d_, h_, l_, M_, D_] := N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 69.9%
Simplified70.3%
frac-2neg70.3%
sqrt-div40.9%
Applied egg-rr40.9%
Taylor expanded in d around inf 27.1%
*-commutative27.1%
unpow-127.1%
metadata-eval27.1%
pow-sqr27.1%
rem-sqrt-square27.3%
rem-square-sqrt27.3%
fabs-sqr27.3%
rem-square-sqrt27.3%
Simplified27.3%
Final simplification27.3%
herbie shell --seed 2024096
(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)))))