
(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 14 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 (+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D d)) 2.0) -0.5)))))
(if (<= l -2e-310)
(* (/ (sqrt (- d)) (sqrt (- h))) (* (sqrt (/ d l)) t_0))
(* (/ (sqrt d) (sqrt h)) (* t_0 (/ (sqrt d) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 + ((h / l) * (pow(((M / 2.0) * (D / d)), 2.0) * -0.5));
double tmp;
if (l <= -2e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * t_0);
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (sqrt(d) / 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 = 1.0d0 + ((h / l) * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (-0.5d0)))
if (l <= (-2d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * t_0)
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (sqrt(d) / 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 = 1.0 + ((h / l) * (Math.pow(((M / 2.0) * (D / d)), 2.0) * -0.5));
double tmp;
if (l <= -2e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (Math.sqrt((d / l)) * t_0);
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * (Math.sqrt(d) / Math.sqrt(l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = 1.0 + ((h / l) * (math.pow(((M / 2.0) * (D / d)), 2.0) * -0.5)) tmp = 0 if l <= -2e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (math.sqrt((d / l)) * t_0) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * (math.sqrt(d) / math.sqrt(l))) return tmp
function code(d, h, l, M, D) t_0 = Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * -0.5))) tmp = 0.0 if (l <= -2e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * t_0)); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(sqrt(d) / sqrt(l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = 1.0 + ((h / l) * ((((M / 2.0) * (D / d)) ^ 2.0) * -0.5)); tmp = 0.0; if (l <= -2e-310) tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * t_0); else tmp = (sqrt(d) / sqrt(h)) * (t_0 * (sqrt(d) / sqrt(l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t_0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 70.7%
Simplified69.9%
frac-2neg69.9%
sqrt-div82.5%
Applied egg-rr82.5%
if -1.999999999999994e-310 < l Initial program 72.8%
Simplified74.3%
sqrt-div84.4%
div-inv84.3%
Applied egg-rr84.3%
associate-*r/84.4%
*-rgt-identity84.4%
Simplified84.4%
sqrt-div87.1%
div-inv87.1%
Applied egg-rr87.1%
associate-*r/87.1%
*-rgt-identity87.1%
Simplified87.1%
Final simplification84.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l -2.5e+150)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(if (<= l 8.8e-275)
(*
(sqrt (/ d h))
(* t_0 (+ 1.0 (* h (* (pow (* M (* D (/ 0.5 d))) 2.0) (/ -0.5 l))))))
(*
(* t_0 (+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D d)) 2.0) -0.5))))
(/ (sqrt d) (sqrt h)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -2.5e+150) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else if (l <= 8.8e-275) {
tmp = sqrt((d / h)) * (t_0 * (1.0 + (h * (pow((M * (D * (0.5 / d))), 2.0) * (-0.5 / l)))));
} else {
tmp = (t_0 * (1.0 + ((h / l) * (pow(((M / 2.0) * (D / d)), 2.0) * -0.5)))) * (sqrt(d) / sqrt(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) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (l <= (-2.5d+150)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else if (l <= 8.8d-275) then
tmp = sqrt((d / h)) * (t_0 * (1.0d0 + (h * (((m * (d_1 * (0.5d0 / d))) ** 2.0d0) * ((-0.5d0) / l)))))
else
tmp = (t_0 * (1.0d0 + ((h / l) * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (-0.5d0))))) * (sqrt(d) / sqrt(h))
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 tmp;
if (l <= -2.5e+150) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else if (l <= 8.8e-275) {
tmp = Math.sqrt((d / h)) * (t_0 * (1.0 + (h * (Math.pow((M * (D * (0.5 / d))), 2.0) * (-0.5 / l)))));
} else {
tmp = (t_0 * (1.0 + ((h / l) * (Math.pow(((M / 2.0) * (D / d)), 2.0) * -0.5)))) * (Math.sqrt(d) / Math.sqrt(h));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -2.5e+150: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 elif l <= 8.8e-275: tmp = math.sqrt((d / h)) * (t_0 * (1.0 + (h * (math.pow((M * (D * (0.5 / d))), 2.0) * (-0.5 / l))))) else: tmp = (t_0 * (1.0 + ((h / l) * (math.pow(((M / 2.0) * (D / d)), 2.0) * -0.5)))) * (math.sqrt(d) / math.sqrt(h)) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -2.5e+150) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); elseif (l <= 8.8e-275) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(1.0 + Float64(h * Float64((Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0) * Float64(-0.5 / l)))))); else tmp = Float64(Float64(t_0 * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * -0.5)))) * Float64(sqrt(d) / sqrt(h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); tmp = 0.0; if (l <= -2.5e+150) tmp = (sqrt(-d) / sqrt(-h)) * t_0; elseif (l <= 8.8e-275) tmp = sqrt((d / h)) * (t_0 * (1.0 + (h * (((M * (D * (0.5 / d))) ^ 2.0) * (-0.5 / l))))); else tmp = (t_0 * (1.0 + ((h / l) * ((((M / 2.0) * (D / d)) ^ 2.0) * -0.5)))) * (sqrt(d) / sqrt(h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2.5e+150], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, 8.8e-275], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(h * N[(N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -2.5 \cdot 10^{+150}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t_0\\
\mathbf{elif}\;\ell \leq 8.8 \cdot 10^{-275}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \left(1 + h \cdot \left({\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2} \cdot \frac{-0.5}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -2.50000000000000004e150Initial program 53.0%
Simplified53.3%
Taylor expanded in h around 0 50.4%
frac-2neg53.3%
sqrt-div69.6%
Applied egg-rr66.6%
if -2.50000000000000004e150 < l < 8.79999999999999955e-275Initial program 76.5%
Simplified75.6%
expm1-log1p-u24.4%
expm1-udef24.4%
Applied egg-rr24.4%
expm1-def24.4%
expm1-log1p75.6%
associate-*l/76.6%
*-commutative76.6%
associate-*l/77.6%
*-commutative77.6%
*-commutative77.6%
associate-/l*77.6%
associate-*r/79.6%
*-commutative79.6%
associate-*r/79.6%
associate-*r/79.6%
Simplified79.6%
expm1-log1p-u75.3%
expm1-udef68.1%
associate-*r*67.1%
div-inv67.1%
metadata-eval67.1%
Applied egg-rr67.1%
expm1-def74.3%
expm1-log1p79.5%
*-rgt-identity79.5%
associate-*r/79.5%
*-commutative79.5%
associate-*r*77.6%
*-commutative77.6%
associate-/r*77.6%
metadata-eval77.6%
Simplified77.6%
if 8.79999999999999955e-275 < l Initial program 72.3%
Simplified73.8%
sqrt-div84.4%
div-inv84.4%
Applied egg-rr84.4%
associate-*r/84.4%
*-rgt-identity84.4%
Simplified84.4%
Final simplification79.7%
(FPCore (d h l M D)
:precision binary64
(if (<= l -2e-310)
(*
(* (sqrt (/ d h)) (/ (sqrt (- d)) (sqrt (- l))))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D 2.0) (/ M d)) 2.0)))))
(*
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D d)) 2.0) -0.5))))
(/ (sqrt d) (sqrt h)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2e-310) {
tmp = (sqrt((d / h)) * (sqrt(-d) / sqrt(-l))) * (1.0 - (0.5 * ((h / l) * pow(((D / 2.0) * (M / d)), 2.0))));
} else {
tmp = (sqrt((d / l)) * (1.0 + ((h / l) * (pow(((M / 2.0) * (D / d)), 2.0) * -0.5)))) * (sqrt(d) / sqrt(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 <= (-2d-310)) then
tmp = (sqrt((d / h)) * (sqrt(-d) / sqrt(-l))) * (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / 2.0d0) * (m / d)) ** 2.0d0))))
else
tmp = (sqrt((d / l)) * (1.0d0 + ((h / l) * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (-0.5d0))))) * (sqrt(d) / sqrt(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 <= -2e-310) {
tmp = (Math.sqrt((d / h)) * (Math.sqrt(-d) / Math.sqrt(-l))) * (1.0 - (0.5 * ((h / l) * Math.pow(((D / 2.0) * (M / d)), 2.0))));
} else {
tmp = (Math.sqrt((d / l)) * (1.0 + ((h / l) * (Math.pow(((M / 2.0) * (D / d)), 2.0) * -0.5)))) * (Math.sqrt(d) / Math.sqrt(h));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -2e-310: tmp = (math.sqrt((d / h)) * (math.sqrt(-d) / math.sqrt(-l))) * (1.0 - (0.5 * ((h / l) * math.pow(((D / 2.0) * (M / d)), 2.0)))) else: tmp = (math.sqrt((d / l)) * (1.0 + ((h / l) * (math.pow(((M / 2.0) * (D / d)), 2.0) * -0.5)))) * (math.sqrt(d) / math.sqrt(h)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -2e-310) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / 2.0) * Float64(M / d)) ^ 2.0))))); else tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * -0.5)))) * Float64(sqrt(d) / sqrt(h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -2e-310) tmp = (sqrt((d / h)) * (sqrt(-d) / sqrt(-l))) * (1.0 - (0.5 * ((h / l) * (((D / 2.0) * (M / d)) ^ 2.0)))); else tmp = (sqrt((d / l)) * (1.0 + ((h / l) * ((((M / 2.0) * (D / d)) ^ 2.0) * -0.5)))) * (sqrt(d) / sqrt(h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2e-310], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / 2.0), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 70.7%
Simplified69.9%
frac-2neg69.9%
sqrt-div73.7%
Applied egg-rr73.7%
if -1.999999999999994e-310 < l Initial program 72.8%
Simplified74.3%
sqrt-div84.4%
div-inv84.3%
Applied egg-rr84.3%
associate-*r/84.4%
*-rgt-identity84.4%
Simplified84.4%
Final simplification79.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D d)) 2.0) -0.5))))))
(if (<= l -2e-310)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(* t_0 (/ (sqrt d) (sqrt h))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l)) * (1.0 + ((h / l) * (pow(((M / 2.0) * (D / d)), 2.0) * -0.5)));
double tmp;
if (l <= -2e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else {
tmp = t_0 * (sqrt(d) / sqrt(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) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l)) * (1.0d0 + ((h / l) * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (-0.5d0))))
if (l <= (-2d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else
tmp = t_0 * (sqrt(d) / sqrt(h))
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)) * (1.0 + ((h / l) * (Math.pow(((M / 2.0) * (D / d)), 2.0) * -0.5)));
double tmp;
if (l <= -2e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else {
tmp = t_0 * (Math.sqrt(d) / Math.sqrt(h));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) * (1.0 + ((h / l) * (math.pow(((M / 2.0) * (D / d)), 2.0) * -0.5))) tmp = 0 if l <= -2e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 else: tmp = t_0 * (math.sqrt(d) / math.sqrt(h)) return tmp
function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * -0.5)))) tmp = 0.0 if (l <= -2e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); else tmp = Float64(t_0 * Float64(sqrt(d) / sqrt(h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)) * (1.0 + ((h / l) * ((((M / 2.0) * (D / d)) ^ 2.0) * -0.5))); tmp = 0.0; if (l <= -2e-310) tmp = (sqrt(-d) / sqrt(-h)) * t_0; else tmp = t_0 * (sqrt(d) / sqrt(h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 70.7%
Simplified69.9%
frac-2neg69.9%
sqrt-div82.5%
Applied egg-rr82.5%
if -1.999999999999994e-310 < l Initial program 72.8%
Simplified74.3%
sqrt-div84.4%
div-inv84.3%
Applied egg-rr84.3%
associate-*r/84.4%
*-rgt-identity84.4%
Simplified84.4%
Final simplification83.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l -5.5e+152)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(*
(sqrt (/ d h))
(* t_0 (+ 1.0 (* h (* (pow (* M (* D (/ 0.5 d))) 2.0) (/ -0.5 l)))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -5.5e+152) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else {
tmp = sqrt((d / h)) * (t_0 * (1.0 + (h * (pow((M * (D * (0.5 / d))), 2.0) * (-0.5 / 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 = sqrt((d / l))
if (l <= (-5.5d+152)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else
tmp = sqrt((d / h)) * (t_0 * (1.0d0 + (h * (((m * (d_1 * (0.5d0 / d))) ** 2.0d0) * ((-0.5d0) / l)))))
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 tmp;
if (l <= -5.5e+152) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else {
tmp = Math.sqrt((d / h)) * (t_0 * (1.0 + (h * (Math.pow((M * (D * (0.5 / d))), 2.0) * (-0.5 / l)))));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -5.5e+152: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 else: tmp = math.sqrt((d / h)) * (t_0 * (1.0 + (h * (math.pow((M * (D * (0.5 / d))), 2.0) * (-0.5 / l))))) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -5.5e+152) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); else tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(1.0 + Float64(h * Float64((Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0) * Float64(-0.5 / l)))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); tmp = 0.0; if (l <= -5.5e+152) tmp = (sqrt(-d) / sqrt(-h)) * t_0; else tmp = sqrt((d / h)) * (t_0 * (1.0 + (h * (((M * (D * (0.5 / d))) ^ 2.0) * (-0.5 / l))))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5.5e+152], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(h * N[(N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -5.5 \cdot 10^{+152}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \left(1 + h \cdot \left({\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2} \cdot \frac{-0.5}{\ell}\right)\right)\right)\\
\end{array}
\end{array}
if l < -5.4999999999999999e152Initial program 53.0%
Simplified53.3%
Taylor expanded in h around 0 50.4%
frac-2neg53.3%
sqrt-div69.6%
Applied egg-rr66.6%
if -5.4999999999999999e152 < l Initial program 74.2%
Simplified74.6%
expm1-log1p-u29.9%
expm1-udef29.9%
Applied egg-rr29.9%
expm1-def29.9%
expm1-log1p74.6%
associate-*l/73.9%
*-commutative73.9%
associate-*l/76.0%
*-commutative76.0%
*-commutative76.0%
associate-/l*76.0%
associate-*r/76.0%
*-commutative76.0%
associate-*r/76.4%
associate-*r/76.4%
Simplified76.4%
expm1-log1p-u56.8%
expm1-udef51.0%
associate-*r*50.6%
div-inv50.6%
metadata-eval50.6%
Applied egg-rr50.6%
expm1-def55.9%
expm1-log1p76.0%
*-rgt-identity76.0%
associate-*r/76.0%
*-commutative76.0%
associate-*r*76.0%
*-commutative76.0%
associate-/r*76.0%
metadata-eval76.0%
Simplified76.0%
Final simplification74.9%
(FPCore (d h l M D)
:precision binary64
(if (<= l -6.4e+79)
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(*
(sqrt (* (/ d l) (/ d h)))
(fma (/ h l) (* (pow (* (/ M 2.0) (/ D d)) 2.0) -0.5) 1.0))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -6.4e+79) {
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
} else {
tmp = sqrt(((d / l) * (d / h))) * fma((h / l), (pow(((M / 2.0) * (D / d)), 2.0) * -0.5), 1.0);
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (l <= -6.4e+79) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))); else tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * fma(Float64(h / l), Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * -0.5), 1.0)); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -6.4e+79], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.4 \cdot 10^{+79}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5, 1\right)\\
\end{array}
\end{array}
if l < -6.40000000000000005e79Initial program 60.2%
Simplified60.3%
Taylor expanded in h around 0 46.6%
frac-2neg60.4%
sqrt-div78.0%
Applied egg-rr64.2%
if -6.40000000000000005e79 < l Initial program 74.5%
Simplified75.0%
sqrt-div54.2%
div-inv54.2%
Applied egg-rr54.2%
associate-*r/54.2%
*-rgt-identity54.2%
Simplified54.2%
expm1-log1p-u27.1%
expm1-udef19.4%
Applied egg-rr19.6%
expm1-def26.6%
expm1-log1p66.4%
unpow1/266.4%
times-frac66.8%
Simplified66.8%
Final simplification66.3%
(FPCore (d h l M D)
:precision binary64
(if (<= l -1.1e+67)
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (* (/ h l) (* 0.5 (pow (* (/ M d) (* D 0.5)) 2.0)))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.1e+67) {
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
} else {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((h / l) * (0.5 * pow(((M / d) * (D * 0.5)), 2.0))));
}
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.1d+67)) then
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l))
else
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - ((h / l) * (0.5d0 * (((m / d) * (d_1 * 0.5d0)) ** 2.0d0))))
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.1e+67) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * Math.sqrt((d / l));
} else {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - ((h / l) * (0.5 * Math.pow(((M / d) * (D * 0.5)), 2.0))));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -1.1e+67: tmp = (math.sqrt(-d) / math.sqrt(-h)) * math.sqrt((d / l)) else: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - ((h / l) * (0.5 * math.pow(((M / d) * (D * 0.5)), 2.0)))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -1.1e+67) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))); else tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M / d) * Float64(D * 0.5)) ^ 2.0))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -1.1e+67) tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l)); else tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((h / l) * (0.5 * (((M / d) * (D * 0.5)) ^ 2.0)))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.1e+67], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.1 \cdot 10^{+67}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < -1.1e67Initial program 60.2%
Simplified60.3%
Taylor expanded in h around 0 46.6%
frac-2neg60.4%
sqrt-div78.0%
Applied egg-rr64.2%
if -1.1e67 < l Initial program 74.5%
Simplified75.0%
sqrt-div54.2%
div-inv54.2%
Applied egg-rr52.7%
expm1-log1p-u27.1%
expm1-udef19.4%
Applied egg-rr19.6%
expm1-def26.6%
expm1-log1p66.9%
unpow1/266.9%
*-commutative66.9%
Simplified66.9%
Final simplification66.4%
(FPCore (d h l M D)
:precision binary64
(if (<= D 1.95e+62)
(* (sqrt (/ d l)) (/ 1.0 (sqrt (/ h d))))
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (* (/ h l) (* 0.5 (pow (* (/ M d) (* D 0.5)) 2.0)))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (D <= 1.95e+62) {
tmp = sqrt((d / l)) * (1.0 / sqrt((h / d)));
} else {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((h / l) * (0.5 * pow(((M / d) * (D * 0.5)), 2.0))));
}
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 <= 1.95d+62) then
tmp = sqrt((d / l)) * (1.0d0 / sqrt((h / d)))
else
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - ((h / l) * (0.5d0 * (((m / d) * (d_1 * 0.5d0)) ** 2.0d0))))
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.95e+62) {
tmp = Math.sqrt((d / l)) * (1.0 / Math.sqrt((h / d)));
} else {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - ((h / l) * (0.5 * Math.pow(((M / d) * (D * 0.5)), 2.0))));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if D <= 1.95e+62: tmp = math.sqrt((d / l)) * (1.0 / math.sqrt((h / d))) else: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - ((h / l) * (0.5 * math.pow(((M / d) * (D * 0.5)), 2.0)))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (D <= 1.95e+62) tmp = Float64(sqrt(Float64(d / l)) * Float64(1.0 / sqrt(Float64(h / d)))); else tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M / d) * Float64(D * 0.5)) ^ 2.0))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (D <= 1.95e+62) tmp = sqrt((d / l)) * (1.0 / sqrt((h / d))); else tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((h / l) * (0.5 * (((M / d) * (D * 0.5)) ^ 2.0)))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[D, 1.95e+62], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \leq 1.95 \cdot 10^{+62}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if D < 1.95e62Initial program 71.5%
Simplified71.5%
Taylor expanded in h around 0 39.0%
clear-num38.6%
sqrt-div39.8%
metadata-eval39.8%
Applied egg-rr39.8%
if 1.95e62 < D Initial program 73.1%
Simplified73.2%
sqrt-div45.6%
div-inv45.5%
Applied egg-rr43.2%
expm1-log1p-u10.9%
expm1-udef8.8%
Applied egg-rr7.2%
expm1-def11.5%
expm1-log1p64.3%
unpow1/264.3%
*-commutative64.3%
Simplified64.3%
Final simplification44.0%
(FPCore (d h l M D)
:precision binary64
(if (<= h -1.05e+74)
(/ (pow (* (- d) (/ d h)) 0.5) (sqrt (- l)))
(if (<= h -5.5e-291)
(* (- d) (sqrt (/ 1.0 (* l h))))
(* d (pow (* l h) -0.5)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -1.05e+74) {
tmp = pow((-d * (d / h)), 0.5) / sqrt(-l);
} else if (h <= -5.5e-291) {
tmp = -d * sqrt((1.0 / (l * h)));
} else {
tmp = d * pow((l * h), -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 (h <= (-1.05d+74)) then
tmp = ((-d * (d / h)) ** 0.5d0) / sqrt(-l)
else if (h <= (-5.5d-291)) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else
tmp = d * ((l * h) ** (-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 (h <= -1.05e+74) {
tmp = Math.pow((-d * (d / h)), 0.5) / Math.sqrt(-l);
} else if (h <= -5.5e-291) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = d * Math.pow((l * h), -0.5);
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if h <= -1.05e+74: tmp = math.pow((-d * (d / h)), 0.5) / math.sqrt(-l) elif h <= -5.5e-291: tmp = -d * math.sqrt((1.0 / (l * h))) else: tmp = d * math.pow((l * h), -0.5) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (h <= -1.05e+74) tmp = Float64((Float64(Float64(-d) * Float64(d / h)) ^ 0.5) / sqrt(Float64(-l))); elseif (h <= -5.5e-291) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = Float64(d * (Float64(l * h) ^ -0.5)); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (h <= -1.05e+74) tmp = ((-d * (d / h)) ^ 0.5) / sqrt(-l); elseif (h <= -5.5e-291) tmp = -d * sqrt((1.0 / (l * h))); else tmp = d * ((l * h) ^ -0.5); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, -1.05e+74], N[(N[Power[N[((-d) * N[(d / h), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5.5e-291], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.05 \cdot 10^{+74}:\\
\;\;\;\;\frac{{\left(\left(-d\right) \cdot \frac{d}{h}\right)}^{0.5}}{\sqrt{-\ell}}\\
\mathbf{elif}\;h \leq -5.5 \cdot 10^{-291}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\end{array}
\end{array}
if h < -1.0499999999999999e74Initial program 69.9%
Simplified69.9%
Taylor expanded in h around 0 30.3%
add-log-exp8.1%
*-rgt-identity8.1%
*-commutative8.1%
pow1/28.1%
pow1/28.1%
pow-prod-down8.1%
Applied egg-rr8.1%
rem-log-exp27.7%
*-commutative27.7%
unpow-prod-down30.3%
pow1/230.3%
pow1/230.3%
frac-2neg30.3%
sqrt-undiv34.4%
associate-*r/34.5%
pow1/234.5%
pow1/234.5%
pow-prod-down32.3%
Applied egg-rr32.3%
if -1.0499999999999999e74 < h < -5.5000000000000002e-291Initial program 70.4%
Simplified70.5%
Taylor expanded in h around 0 32.9%
add-log-exp13.6%
*-rgt-identity13.6%
*-commutative13.6%
pow1/213.6%
pow1/213.6%
pow-prod-down13.6%
Applied egg-rr13.6%
Taylor expanded in d around -inf 50.4%
associate-*r*50.4%
neg-mul-150.4%
Simplified50.4%
if -5.5000000000000002e-291 < h Initial program 73.2%
Simplified73.2%
Taylor expanded in h around 0 37.4%
Taylor expanded in d around 0 43.6%
*-commutative43.6%
Simplified43.6%
Taylor expanded in d around 0 43.6%
associate-/l/43.6%
unpow1/243.6%
associate-/l/43.6%
rem-exp-log41.6%
exp-neg41.6%
exp-prod41.6%
distribute-lft-neg-out41.6%
distribute-rgt-neg-in41.6%
metadata-eval41.6%
exp-to-pow43.6%
Simplified43.6%
Final simplification43.5%
(FPCore (d h l M D) :precision binary64 (if (<= l -9.2e-134) (* (- d) (sqrt (/ 1.0 (* l h)))) (* d (pow (* l h) -0.5))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -9.2e-134) {
tmp = -d * sqrt((1.0 / (l * h)));
} else {
tmp = d * pow((l * h), -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 <= (-9.2d-134)) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else
tmp = d * ((l * h) ** (-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 <= -9.2e-134) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = d * Math.pow((l * h), -0.5);
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -9.2e-134: tmp = -d * math.sqrt((1.0 / (l * h))) else: tmp = d * math.pow((l * h), -0.5) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -9.2e-134) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = Float64(d * (Float64(l * h) ^ -0.5)); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -9.2e-134) tmp = -d * sqrt((1.0 / (l * h))); else tmp = d * ((l * h) ^ -0.5); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -9.2e-134], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -9.2 \cdot 10^{-134}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\end{array}
\end{array}
if l < -9.2000000000000001e-134Initial program 67.1%
Simplified67.2%
Taylor expanded in h around 0 35.1%
add-log-exp10.4%
*-rgt-identity10.4%
*-commutative10.4%
pow1/210.4%
pow1/210.4%
pow-prod-down10.4%
Applied egg-rr10.4%
Taylor expanded in d around -inf 42.1%
associate-*r*42.1%
neg-mul-142.1%
Simplified42.1%
if -9.2000000000000001e-134 < l Initial program 74.4%
Simplified74.4%
Taylor expanded in h around 0 34.6%
Taylor expanded in d around 0 41.7%
*-commutative41.7%
Simplified41.7%
Taylor expanded in d around 0 41.7%
associate-/l/41.7%
unpow1/241.7%
associate-/l/41.7%
rem-exp-log40.1%
exp-neg40.1%
exp-prod40.1%
distribute-lft-neg-out40.1%
distribute-rgt-neg-in40.1%
metadata-eval40.1%
exp-to-pow41.7%
Simplified41.7%
Final simplification41.8%
(FPCore (d h l M D) :precision binary64 (if (<= l -3.6e-134) (sqrt (* (/ d l) (/ d h))) (* d (pow (* l h) -0.5))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3.6e-134) {
tmp = sqrt(((d / l) * (d / h)));
} else {
tmp = d * pow((l * h), -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 <= (-3.6d-134)) then
tmp = sqrt(((d / l) * (d / h)))
else
tmp = d * ((l * h) ** (-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 <= -3.6e-134) {
tmp = Math.sqrt(((d / l) * (d / h)));
} else {
tmp = d * Math.pow((l * h), -0.5);
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -3.6e-134: tmp = math.sqrt(((d / l) * (d / h))) else: tmp = d * math.pow((l * h), -0.5) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -3.6e-134) tmp = sqrt(Float64(Float64(d / l) * Float64(d / h))); else tmp = Float64(d * (Float64(l * h) ^ -0.5)); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -3.6e-134) tmp = sqrt(((d / l) * (d / h))); else tmp = d * ((l * h) ^ -0.5); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -3.6e-134], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.6 \cdot 10^{-134}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\end{array}
\end{array}
if l < -3.5999999999999999e-134Initial program 67.1%
Simplified67.2%
Taylor expanded in h around 0 35.1%
expm1-log1p-u34.4%
expm1-udef21.1%
*-rgt-identity21.1%
*-commutative21.1%
pow1/221.1%
pow1/221.1%
pow-prod-down20.1%
Applied egg-rr20.1%
expm1-def30.1%
expm1-log1p30.8%
unpow1/230.8%
Simplified30.8%
if -3.5999999999999999e-134 < l Initial program 74.4%
Simplified74.4%
Taylor expanded in h around 0 34.6%
Taylor expanded in d around 0 41.7%
*-commutative41.7%
Simplified41.7%
Taylor expanded in d around 0 41.7%
associate-/l/41.7%
unpow1/241.7%
associate-/l/41.7%
rem-exp-log40.1%
exp-neg40.1%
exp-prod40.1%
distribute-lft-neg-out40.1%
distribute-rgt-neg-in40.1%
metadata-eval40.1%
exp-to-pow41.7%
Simplified41.7%
Final simplification37.8%
(FPCore (d h l M D) :precision binary64 (let* ((t_0 (pow (* l h) -0.5))) (if (<= l -1.75e-132) (* d (- t_0)) (* d t_0))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((l * h), -0.5);
double tmp;
if (l <= -1.75e-132) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
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 = (l * h) ** (-0.5d0)
if (l <= (-1.75d-132)) then
tmp = d * -t_0
else
tmp = d * t_0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((l * h), -0.5);
double tmp;
if (l <= -1.75e-132) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.pow((l * h), -0.5) tmp = 0 if l <= -1.75e-132: tmp = d * -t_0 else: tmp = d * t_0 return tmp
function code(d, h, l, M, D) t_0 = Float64(l * h) ^ -0.5 tmp = 0.0 if (l <= -1.75e-132) tmp = Float64(d * Float64(-t_0)); else tmp = Float64(d * t_0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (l * h) ^ -0.5; tmp = 0.0; if (l <= -1.75e-132) tmp = d * -t_0; else tmp = d * t_0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, -1.75e-132], N[(d * (-t$95$0)), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -1.75 \cdot 10^{-132}:\\
\;\;\;\;d \cdot \left(-t_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t_0\\
\end{array}
\end{array}
if l < -1.75e-132Initial program 67.1%
Simplified67.2%
Taylor expanded in h around 0 35.1%
add-log-exp10.4%
*-rgt-identity10.4%
*-commutative10.4%
pow1/210.4%
pow1/210.4%
pow-prod-down10.4%
Applied egg-rr10.4%
Taylor expanded in d around -inf 42.1%
mul-1-neg42.1%
*-commutative42.1%
distribute-rgt-neg-in42.1%
associate-/l/42.1%
unpow1/242.1%
associate-/l/42.1%
rem-exp-log39.9%
exp-neg39.9%
exp-prod39.9%
distribute-lft-neg-out39.9%
distribute-rgt-neg-in39.9%
metadata-eval39.9%
exp-to-pow42.1%
Simplified42.1%
if -1.75e-132 < l Initial program 74.4%
Simplified74.4%
Taylor expanded in h around 0 34.6%
Taylor expanded in d around 0 41.7%
*-commutative41.7%
Simplified41.7%
Taylor expanded in d around 0 41.7%
associate-/l/41.7%
unpow1/241.7%
associate-/l/41.7%
rem-exp-log40.1%
exp-neg40.1%
exp-prod40.1%
distribute-lft-neg-out40.1%
distribute-rgt-neg-in40.1%
metadata-eval40.1%
exp-to-pow41.7%
Simplified41.7%
Final simplification41.8%
(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 71.8%
Simplified71.8%
Taylor expanded in h around 0 34.8%
Taylor expanded in d around 0 28.8%
*-commutative28.8%
Simplified28.8%
Taylor expanded in d around 0 28.8%
associate-/l/28.8%
unpow1/228.8%
associate-/l/28.8%
rem-exp-log27.8%
exp-neg27.8%
exp-prod27.8%
distribute-lft-neg-out27.8%
distribute-rgt-neg-in27.8%
metadata-eval27.8%
exp-to-pow28.8%
Simplified28.8%
Final simplification28.8%
(FPCore (d h l M D) :precision binary64 0.0)
double code(double d, double h, double l, double M, double D) {
return 0.0;
}
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 = 0.0d0
end function
public static double code(double d, double h, double l, double M, double D) {
return 0.0;
}
def code(d, h, l, M, D): return 0.0
function code(d, h, l, M, D) return 0.0 end
function tmp = code(d, h, l, M, D) tmp = 0.0; end
code[d_, h_, l_, M_, D_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 71.8%
Simplified71.8%
Taylor expanded in h around 0 34.8%
add-log-exp13.0%
*-rgt-identity13.0%
*-commutative13.0%
pow1/213.0%
pow1/213.0%
pow-prod-down13.0%
Applied egg-rr13.0%
Taylor expanded in d around 0 6.5%
Final simplification6.5%
herbie shell --seed 2023339
(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)))))