
(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}
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (- d))) (t_1 (* M_m (* D (/ 0.5 d)))))
(if (<= l -1e-310)
(*
(/ t_0 (sqrt (- h)))
(*
(/ 1.0 (/ (sqrt (- l)) t_0))
(+ 1.0 (* (/ h l) (* (pow (* (/ M_m 2.0) (/ D d)) 2.0) -0.5)))))
(*
(/ (sqrt d) (sqrt h))
(* (/ (sqrt d) (sqrt l)) (+ 1.0 (* h (* (/ t_1 l) (/ t_1 -2.0)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt(-d);
double t_1 = M_m * (D * (0.5 / d));
double tmp;
if (l <= -1e-310) {
tmp = (t_0 / sqrt(-h)) * ((1.0 / (sqrt(-l) / t_0)) * (1.0 + ((h / l) * (pow(((M_m / 2.0) * (D / d)), 2.0) * -0.5))));
} else {
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0 + (h * ((t_1 / l) * (t_1 / -2.0)))));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt(-d)
t_1 = m_m * (d_1 * (0.5d0 / d))
if (l <= (-1d-310)) then
tmp = (t_0 / sqrt(-h)) * ((1.0d0 / (sqrt(-l) / t_0)) * (1.0d0 + ((h / l) * ((((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (-0.5d0)))))
else
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0d0 + (h * ((t_1 / l) * (t_1 / (-2.0d0))))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt(-d);
double t_1 = M_m * (D * (0.5 / d));
double tmp;
if (l <= -1e-310) {
tmp = (t_0 / Math.sqrt(-h)) * ((1.0 / (Math.sqrt(-l) / t_0)) * (1.0 + ((h / l) * (Math.pow(((M_m / 2.0) * (D / d)), 2.0) * -0.5))));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 + (h * ((t_1 / l) * (t_1 / -2.0)))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt(-d) t_1 = M_m * (D * (0.5 / d)) tmp = 0 if l <= -1e-310: tmp = (t_0 / math.sqrt(-h)) * ((1.0 / (math.sqrt(-l) / t_0)) * (1.0 + ((h / l) * (math.pow(((M_m / 2.0) * (D / d)), 2.0) * -0.5)))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * ((math.sqrt(d) / math.sqrt(l)) * (1.0 + (h * ((t_1 / l) * (t_1 / -2.0))))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(-d)) t_1 = Float64(M_m * Float64(D * Float64(0.5 / d))) tmp = 0.0 if (l <= -1e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(Float64(1.0 / Float64(sqrt(Float64(-l)) / t_0)) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0) * -0.5))))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 + Float64(h * Float64(Float64(t_1 / l) * Float64(t_1 / -2.0)))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt(-d);
t_1 = M_m * (D * (0.5 / d));
tmp = 0.0;
if (l <= -1e-310)
tmp = (t_0 / sqrt(-h)) * ((1.0 / (sqrt(-l) / t_0)) * (1.0 + ((h / l) * ((((M_m / 2.0) * (D / d)) ^ 2.0) * -0.5))));
else
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0 + (h * ((t_1 / l) * (t_1 / -2.0)))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(M$95$m * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1e-310], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(N[Sqrt[(-l)], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(t$95$1 / l), $MachinePrecision] * N[(t$95$1 / -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
t_1 := M_m \cdot \left(D \cdot \frac{0.5}{d}\right)\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{t_0}{\sqrt{-h}} \cdot \left(\frac{1}{\frac{\sqrt{-\ell}}{t_0}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M_m}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 + h \cdot \left(\frac{t_1}{\ell} \cdot \frac{t_1}{-2}\right)\right)\right)\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 66.4%
Simplified64.3%
clear-num64.3%
sqrt-div64.2%
metadata-eval64.2%
Applied egg-rr64.2%
frac-2neg64.2%
sqrt-div69.5%
Applied egg-rr69.5%
frac-2neg69.5%
sqrt-div83.6%
Applied egg-rr83.6%
if -9.999999999999969e-311 < l Initial program 69.2%
Simplified69.2%
Applied egg-rr39.5%
expm1-def39.5%
expm1-log1p69.2%
associate-*l/69.4%
*-commutative69.4%
associate-*l/68.6%
*-commutative68.6%
associate-/l*68.6%
associate-*r*68.6%
*-commutative68.6%
*-rgt-identity68.6%
associate-*r/68.6%
associate-*r*68.6%
*-commutative68.6%
associate-*l*68.6%
associate-*r/68.6%
metadata-eval68.6%
Simplified68.6%
unpow268.6%
div-inv68.6%
metadata-eval68.6%
metadata-eval68.6%
times-frac69.4%
*-commutative69.4%
associate-*r*69.4%
*-commutative69.4%
associate-*r*69.4%
metadata-eval69.4%
Applied egg-rr69.4%
sqrt-div80.4%
div-inv80.3%
Applied egg-rr80.3%
associate-*r/80.4%
*-rgt-identity80.4%
Simplified80.4%
sqrt-div91.1%
div-inv91.1%
Applied egg-rr91.1%
associate-*r/91.1%
*-rgt-identity91.1%
Simplified91.1%
Final simplification87.0%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* M_m (* D (/ 0.5 d))))
(t_1 (+ 1.0 (* h (* (/ t_0 l) (/ t_0 -2.0)))))
(t_2 (sqrt (/ d l))))
(if (<= l -1e-310)
(* (/ (sqrt (- d)) (sqrt (- h))) (* t_1 t_2))
(if (<= l 3.8e+82)
(*
(/ 1.0 (/ (sqrt h) (sqrt d)))
(* (+ 1.0 (* (/ h l) (* (pow (* (/ M_m 2.0) (/ D d)) 2.0) -0.5))) t_2))
(* (* (/ (sqrt d) (sqrt l)) t_1) (sqrt (/ d h)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = M_m * (D * (0.5 / d));
double t_1 = 1.0 + (h * ((t_0 / l) * (t_0 / -2.0)));
double t_2 = sqrt((d / l));
double tmp;
if (l <= -1e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (t_1 * t_2);
} else if (l <= 3.8e+82) {
tmp = (1.0 / (sqrt(h) / sqrt(d))) * ((1.0 + ((h / l) * (pow(((M_m / 2.0) * (D / d)), 2.0) * -0.5))) * t_2);
} else {
tmp = ((sqrt(d) / sqrt(l)) * t_1) * sqrt((d / h));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = m_m * (d_1 * (0.5d0 / d))
t_1 = 1.0d0 + (h * ((t_0 / l) * (t_0 / (-2.0d0))))
t_2 = sqrt((d / l))
if (l <= (-1d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * (t_1 * t_2)
else if (l <= 3.8d+82) then
tmp = (1.0d0 / (sqrt(h) / sqrt(d))) * ((1.0d0 + ((h / l) * ((((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (-0.5d0)))) * t_2)
else
tmp = ((sqrt(d) / sqrt(l)) * t_1) * sqrt((d / h))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = M_m * (D * (0.5 / d));
double t_1 = 1.0 + (h * ((t_0 / l) * (t_0 / -2.0)));
double t_2 = Math.sqrt((d / l));
double tmp;
if (l <= -1e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_1 * t_2);
} else if (l <= 3.8e+82) {
tmp = (1.0 / (Math.sqrt(h) / Math.sqrt(d))) * ((1.0 + ((h / l) * (Math.pow(((M_m / 2.0) * (D / d)), 2.0) * -0.5))) * t_2);
} else {
tmp = ((Math.sqrt(d) / Math.sqrt(l)) * t_1) * Math.sqrt((d / h));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = M_m * (D * (0.5 / d)) t_1 = 1.0 + (h * ((t_0 / l) * (t_0 / -2.0))) t_2 = math.sqrt((d / l)) tmp = 0 if l <= -1e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (t_1 * t_2) elif l <= 3.8e+82: tmp = (1.0 / (math.sqrt(h) / math.sqrt(d))) * ((1.0 + ((h / l) * (math.pow(((M_m / 2.0) * (D / d)), 2.0) * -0.5))) * t_2) else: tmp = ((math.sqrt(d) / math.sqrt(l)) * t_1) * math.sqrt((d / h)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(M_m * Float64(D * Float64(0.5 / d))) t_1 = Float64(1.0 + Float64(h * Float64(Float64(t_0 / l) * Float64(t_0 / -2.0)))) t_2 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -1e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_1 * t_2)); elseif (l <= 3.8e+82) tmp = Float64(Float64(1.0 / Float64(sqrt(h) / sqrt(d))) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0) * -0.5))) * t_2)); else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(l)) * t_1) * sqrt(Float64(d / h))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = M_m * (D * (0.5 / d));
t_1 = 1.0 + (h * ((t_0 / l) * (t_0 / -2.0)));
t_2 = sqrt((d / l));
tmp = 0.0;
if (l <= -1e-310)
tmp = (sqrt(-d) / sqrt(-h)) * (t_1 * t_2);
elseif (l <= 3.8e+82)
tmp = (1.0 / (sqrt(h) / sqrt(d))) * ((1.0 + ((h / l) * ((((M_m / 2.0) * (D / d)) ^ 2.0) * -0.5))) * t_2);
else
tmp = ((sqrt(d) / sqrt(l)) * t_1) * sqrt((d / h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(M$95$m * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(h * N[(N[(t$95$0 / l), $MachinePrecision] * N[(t$95$0 / -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.8e+82], N[(N[(1.0 / N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := M_m \cdot \left(D \cdot \frac{0.5}{d}\right)\\
t_1 := 1 + h \cdot \left(\frac{t_0}{\ell} \cdot \frac{t_0}{-2}\right)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t_1 \cdot t_2\right)\\
\mathbf{elif}\;\ell \leq 3.8 \cdot 10^{+82}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{h}}{\sqrt{d}}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M_m}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot t_2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_1\right) \cdot \sqrt{\frac{d}{h}}\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 66.4%
Simplified64.3%
Applied egg-rr30.6%
expm1-def30.6%
expm1-log1p64.3%
associate-*l/65.9%
*-commutative65.9%
associate-*l/66.6%
*-commutative66.6%
associate-/l*66.6%
associate-*r*66.6%
*-commutative66.6%
*-rgt-identity66.6%
associate-*r/66.6%
associate-*r*68.6%
*-commutative68.6%
associate-*l*68.6%
associate-*r/68.6%
metadata-eval68.6%
Simplified68.6%
unpow268.6%
div-inv68.6%
metadata-eval68.6%
metadata-eval68.6%
times-frac70.0%
*-commutative70.0%
associate-*r*67.3%
*-commutative67.3%
associate-*r*68.0%
metadata-eval68.0%
Applied egg-rr68.0%
frac-2neg69.5%
sqrt-div83.6%
Applied egg-rr80.5%
if -9.999999999999969e-311 < l < 3.80000000000000033e82Initial program 73.4%
Simplified73.5%
sqrt-div88.1%
clear-num88.2%
Applied egg-rr88.2%
if 3.80000000000000033e82 < l Initial program 61.6%
Simplified61.5%
Applied egg-rr49.1%
expm1-def49.1%
expm1-log1p61.5%
associate-*l/61.5%
*-commutative61.5%
associate-*l/61.5%
*-commutative61.5%
associate-/l*61.5%
associate-*r*61.5%
*-commutative61.5%
*-rgt-identity61.5%
associate-*r/61.5%
associate-*r*61.6%
*-commutative61.6%
associate-*l*61.6%
associate-*r/61.6%
metadata-eval61.6%
Simplified61.6%
unpow261.6%
div-inv61.6%
metadata-eval61.6%
metadata-eval61.6%
times-frac63.9%
*-commutative63.9%
associate-*r*63.8%
*-commutative63.8%
associate-*r*63.8%
metadata-eval63.8%
Applied egg-rr63.8%
sqrt-div83.0%
div-inv83.1%
Applied egg-rr78.1%
associate-*r/83.0%
*-rgt-identity83.0%
Simplified78.1%
Final simplification82.3%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* M_m (* D (/ 0.5 d))))
(t_1 (+ 1.0 (* h (* (/ t_0 l) (/ t_0 -2.0))))))
(if (<= l -1e-310)
(* (/ (sqrt (- d)) (sqrt (- h))) (* t_1 (sqrt (/ d l))))
(* (/ (sqrt d) (sqrt h)) (* (/ (sqrt d) (sqrt l)) t_1)))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = M_m * (D * (0.5 / d));
double t_1 = 1.0 + (h * ((t_0 / l) * (t_0 / -2.0)));
double tmp;
if (l <= -1e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (t_1 * sqrt((d / l)));
} else {
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * t_1);
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = m_m * (d_1 * (0.5d0 / d))
t_1 = 1.0d0 + (h * ((t_0 / l) * (t_0 / (-2.0d0))))
if (l <= (-1d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * (t_1 * sqrt((d / l)))
else
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * t_1)
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = M_m * (D * (0.5 / d));
double t_1 = 1.0 + (h * ((t_0 / l) * (t_0 / -2.0)));
double tmp;
if (l <= -1e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_1 * Math.sqrt((d / l)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((Math.sqrt(d) / Math.sqrt(l)) * t_1);
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = M_m * (D * (0.5 / d)) t_1 = 1.0 + (h * ((t_0 / l) * (t_0 / -2.0))) tmp = 0 if l <= -1e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (t_1 * math.sqrt((d / l))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * ((math.sqrt(d) / math.sqrt(l)) * t_1) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(M_m * Float64(D * Float64(0.5 / d))) t_1 = Float64(1.0 + Float64(h * Float64(Float64(t_0 / l) * Float64(t_0 / -2.0)))) tmp = 0.0 if (l <= -1e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_1 * sqrt(Float64(d / l)))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(sqrt(d) / sqrt(l)) * t_1)); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = M_m * (D * (0.5 / d));
t_1 = 1.0 + (h * ((t_0 / l) * (t_0 / -2.0)));
tmp = 0.0;
if (l <= -1e-310)
tmp = (sqrt(-d) / sqrt(-h)) * (t_1 * sqrt((d / l)));
else
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * t_1);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(M$95$m * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(h * N[(N[(t$95$0 / l), $MachinePrecision] * N[(t$95$0 / -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := M_m \cdot \left(D \cdot \frac{0.5}{d}\right)\\
t_1 := 1 + h \cdot \left(\frac{t_0}{\ell} \cdot \frac{t_0}{-2}\right)\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t_1 \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_1\right)\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 66.4%
Simplified64.3%
Applied egg-rr30.6%
expm1-def30.6%
expm1-log1p64.3%
associate-*l/65.9%
*-commutative65.9%
associate-*l/66.6%
*-commutative66.6%
associate-/l*66.6%
associate-*r*66.6%
*-commutative66.6%
*-rgt-identity66.6%
associate-*r/66.6%
associate-*r*68.6%
*-commutative68.6%
associate-*l*68.6%
associate-*r/68.6%
metadata-eval68.6%
Simplified68.6%
unpow268.6%
div-inv68.6%
metadata-eval68.6%
metadata-eval68.6%
times-frac70.0%
*-commutative70.0%
associate-*r*67.3%
*-commutative67.3%
associate-*r*68.0%
metadata-eval68.0%
Applied egg-rr68.0%
frac-2neg69.5%
sqrt-div83.6%
Applied egg-rr80.5%
if -9.999999999999969e-311 < l Initial program 69.2%
Simplified69.2%
Applied egg-rr39.5%
expm1-def39.5%
expm1-log1p69.2%
associate-*l/69.4%
*-commutative69.4%
associate-*l/68.6%
*-commutative68.6%
associate-/l*68.6%
associate-*r*68.6%
*-commutative68.6%
*-rgt-identity68.6%
associate-*r/68.6%
associate-*r*68.6%
*-commutative68.6%
associate-*l*68.6%
associate-*r/68.6%
metadata-eval68.6%
Simplified68.6%
unpow268.6%
div-inv68.6%
metadata-eval68.6%
metadata-eval68.6%
times-frac69.4%
*-commutative69.4%
associate-*r*69.4%
*-commutative69.4%
associate-*r*69.4%
metadata-eval69.4%
Applied egg-rr69.4%
sqrt-div80.4%
div-inv80.3%
Applied egg-rr80.3%
associate-*r/80.4%
*-rgt-identity80.4%
Simplified80.4%
sqrt-div91.1%
div-inv91.1%
Applied egg-rr91.1%
associate-*r/91.1%
*-rgt-identity91.1%
Simplified91.1%
Final simplification85.3%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* M_m (* D (/ 0.5 d))))
(t_1 (+ 1.0 (* h (* (/ t_0 l) (/ t_0 -2.0)))))
(t_2 (sqrt (/ d l))))
(if (<= l -1e-310)
(* (/ (sqrt (- d)) (sqrt (- h))) (* t_1 t_2))
(if (<= l 5.8e+82)
(*
(/ (sqrt d) (sqrt h))
(* (+ 1.0 (* (/ h l) (* (pow (* (/ M_m 2.0) (/ D d)) 2.0) -0.5))) t_2))
(* (* (/ (sqrt d) (sqrt l)) t_1) (sqrt (/ d h)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = M_m * (D * (0.5 / d));
double t_1 = 1.0 + (h * ((t_0 / l) * (t_0 / -2.0)));
double t_2 = sqrt((d / l));
double tmp;
if (l <= -1e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (t_1 * t_2);
} else if (l <= 5.8e+82) {
tmp = (sqrt(d) / sqrt(h)) * ((1.0 + ((h / l) * (pow(((M_m / 2.0) * (D / d)), 2.0) * -0.5))) * t_2);
} else {
tmp = ((sqrt(d) / sqrt(l)) * t_1) * sqrt((d / h));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = m_m * (d_1 * (0.5d0 / d))
t_1 = 1.0d0 + (h * ((t_0 / l) * (t_0 / (-2.0d0))))
t_2 = sqrt((d / l))
if (l <= (-1d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * (t_1 * t_2)
else if (l <= 5.8d+82) then
tmp = (sqrt(d) / sqrt(h)) * ((1.0d0 + ((h / l) * ((((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (-0.5d0)))) * t_2)
else
tmp = ((sqrt(d) / sqrt(l)) * t_1) * sqrt((d / h))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = M_m * (D * (0.5 / d));
double t_1 = 1.0 + (h * ((t_0 / l) * (t_0 / -2.0)));
double t_2 = Math.sqrt((d / l));
double tmp;
if (l <= -1e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_1 * t_2);
} else if (l <= 5.8e+82) {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((1.0 + ((h / l) * (Math.pow(((M_m / 2.0) * (D / d)), 2.0) * -0.5))) * t_2);
} else {
tmp = ((Math.sqrt(d) / Math.sqrt(l)) * t_1) * Math.sqrt((d / h));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = M_m * (D * (0.5 / d)) t_1 = 1.0 + (h * ((t_0 / l) * (t_0 / -2.0))) t_2 = math.sqrt((d / l)) tmp = 0 if l <= -1e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (t_1 * t_2) elif l <= 5.8e+82: tmp = (math.sqrt(d) / math.sqrt(h)) * ((1.0 + ((h / l) * (math.pow(((M_m / 2.0) * (D / d)), 2.0) * -0.5))) * t_2) else: tmp = ((math.sqrt(d) / math.sqrt(l)) * t_1) * math.sqrt((d / h)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(M_m * Float64(D * Float64(0.5 / d))) t_1 = Float64(1.0 + Float64(h * Float64(Float64(t_0 / l) * Float64(t_0 / -2.0)))) t_2 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -1e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_1 * t_2)); elseif (l <= 5.8e+82) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0) * -0.5))) * t_2)); else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(l)) * t_1) * sqrt(Float64(d / h))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = M_m * (D * (0.5 / d));
t_1 = 1.0 + (h * ((t_0 / l) * (t_0 / -2.0)));
t_2 = sqrt((d / l));
tmp = 0.0;
if (l <= -1e-310)
tmp = (sqrt(-d) / sqrt(-h)) * (t_1 * t_2);
elseif (l <= 5.8e+82)
tmp = (sqrt(d) / sqrt(h)) * ((1.0 + ((h / l) * ((((M_m / 2.0) * (D / d)) ^ 2.0) * -0.5))) * t_2);
else
tmp = ((sqrt(d) / sqrt(l)) * t_1) * sqrt((d / h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(M$95$m * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(h * N[(N[(t$95$0 / l), $MachinePrecision] * N[(t$95$0 / -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.8e+82], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := M_m \cdot \left(D \cdot \frac{0.5}{d}\right)\\
t_1 := 1 + h \cdot \left(\frac{t_0}{\ell} \cdot \frac{t_0}{-2}\right)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t_1 \cdot t_2\right)\\
\mathbf{elif}\;\ell \leq 5.8 \cdot 10^{+82}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M_m}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot t_2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_1\right) \cdot \sqrt{\frac{d}{h}}\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 66.4%
Simplified64.3%
Applied egg-rr30.6%
expm1-def30.6%
expm1-log1p64.3%
associate-*l/65.9%
*-commutative65.9%
associate-*l/66.6%
*-commutative66.6%
associate-/l*66.6%
associate-*r*66.6%
*-commutative66.6%
*-rgt-identity66.6%
associate-*r/66.6%
associate-*r*68.6%
*-commutative68.6%
associate-*l*68.6%
associate-*r/68.6%
metadata-eval68.6%
Simplified68.6%
unpow268.6%
div-inv68.6%
metadata-eval68.6%
metadata-eval68.6%
times-frac70.0%
*-commutative70.0%
associate-*r*67.3%
*-commutative67.3%
associate-*r*68.0%
metadata-eval68.0%
Applied egg-rr68.0%
frac-2neg69.5%
sqrt-div83.6%
Applied egg-rr80.5%
if -9.999999999999969e-311 < l < 5.8000000000000003e82Initial program 73.4%
Simplified73.5%
sqrt-div87.1%
div-inv87.1%
Applied egg-rr88.1%
associate-*r/87.1%
*-rgt-identity87.1%
Simplified88.1%
if 5.8000000000000003e82 < l Initial program 61.6%
Simplified61.5%
Applied egg-rr49.1%
expm1-def49.1%
expm1-log1p61.5%
associate-*l/61.5%
*-commutative61.5%
associate-*l/61.5%
*-commutative61.5%
associate-/l*61.5%
associate-*r*61.5%
*-commutative61.5%
*-rgt-identity61.5%
associate-*r/61.5%
associate-*r*61.6%
*-commutative61.6%
associate-*l*61.6%
associate-*r/61.6%
metadata-eval61.6%
Simplified61.6%
unpow261.6%
div-inv61.6%
metadata-eval61.6%
metadata-eval61.6%
times-frac63.9%
*-commutative63.9%
associate-*r*63.8%
*-commutative63.8%
associate-*r*63.8%
metadata-eval63.8%
Applied egg-rr63.8%
sqrt-div83.0%
div-inv83.1%
Applied egg-rr78.1%
associate-*r/83.0%
*-rgt-identity83.0%
Simplified78.1%
Final simplification82.3%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* M_m (* D (/ 0.5 d)))) (t_1 (sqrt (/ d h))))
(if (<= l -3.9e+162)
(* d (- (sqrt (/ 1.0 (* l h)))))
(if (<= l -1e-310)
(*
t_1
(*
(sqrt (/ d l))
(+ 1.0 (* h (* (pow (* D (/ M_m (/ d 0.5))) 2.0) (/ -0.5 l))))))
(*
(* (/ (sqrt d) (sqrt l)) (+ 1.0 (* h (* (/ t_0 l) (/ t_0 -2.0)))))
t_1)))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = M_m * (D * (0.5 / d));
double t_1 = sqrt((d / h));
double tmp;
if (l <= -3.9e+162) {
tmp = d * -sqrt((1.0 / (l * h)));
} else if (l <= -1e-310) {
tmp = t_1 * (sqrt((d / l)) * (1.0 + (h * (pow((D * (M_m / (d / 0.5))), 2.0) * (-0.5 / l)))));
} else {
tmp = ((sqrt(d) / sqrt(l)) * (1.0 + (h * ((t_0 / l) * (t_0 / -2.0))))) * t_1;
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = m_m * (d_1 * (0.5d0 / d))
t_1 = sqrt((d / h))
if (l <= (-3.9d+162)) then
tmp = d * -sqrt((1.0d0 / (l * h)))
else if (l <= (-1d-310)) then
tmp = t_1 * (sqrt((d / l)) * (1.0d0 + (h * (((d_1 * (m_m / (d / 0.5d0))) ** 2.0d0) * ((-0.5d0) / l)))))
else
tmp = ((sqrt(d) / sqrt(l)) * (1.0d0 + (h * ((t_0 / l) * (t_0 / (-2.0d0)))))) * t_1
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = M_m * (D * (0.5 / d));
double t_1 = Math.sqrt((d / h));
double tmp;
if (l <= -3.9e+162) {
tmp = d * -Math.sqrt((1.0 / (l * h)));
} else if (l <= -1e-310) {
tmp = t_1 * (Math.sqrt((d / l)) * (1.0 + (h * (Math.pow((D * (M_m / (d / 0.5))), 2.0) * (-0.5 / l)))));
} else {
tmp = ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 + (h * ((t_0 / l) * (t_0 / -2.0))))) * t_1;
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = M_m * (D * (0.5 / d)) t_1 = math.sqrt((d / h)) tmp = 0 if l <= -3.9e+162: tmp = d * -math.sqrt((1.0 / (l * h))) elif l <= -1e-310: tmp = t_1 * (math.sqrt((d / l)) * (1.0 + (h * (math.pow((D * (M_m / (d / 0.5))), 2.0) * (-0.5 / l))))) else: tmp = ((math.sqrt(d) / math.sqrt(l)) * (1.0 + (h * ((t_0 / l) * (t_0 / -2.0))))) * t_1 return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(M_m * Float64(D * Float64(0.5 / d))) t_1 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= -3.9e+162) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h))))); elseif (l <= -1e-310) tmp = Float64(t_1 * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64((Float64(D * Float64(M_m / Float64(d / 0.5))) ^ 2.0) * Float64(-0.5 / l)))))); else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 + Float64(h * Float64(Float64(t_0 / l) * Float64(t_0 / -2.0))))) * t_1); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = M_m * (D * (0.5 / d));
t_1 = sqrt((d / h));
tmp = 0.0;
if (l <= -3.9e+162)
tmp = d * -sqrt((1.0 / (l * h)));
elseif (l <= -1e-310)
tmp = t_1 * (sqrt((d / l)) * (1.0 + (h * (((D * (M_m / (d / 0.5))) ^ 2.0) * (-0.5 / l)))));
else
tmp = ((sqrt(d) / sqrt(l)) * (1.0 + (h * ((t_0 / l) * (t_0 / -2.0))))) * t_1;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(M$95$m * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3.9e+162], N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -1e-310], N[(t$95$1 * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[Power[N[(D * N[(M$95$m / N[(d / 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(t$95$0 / l), $MachinePrecision] * N[(t$95$0 / -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := M_m \cdot \left(D \cdot \frac{0.5}{d}\right)\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq -3.9 \cdot 10^{+162}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;t_1 \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left({\left(D \cdot \frac{M_m}{\frac{d}{0.5}}\right)}^{2} \cdot \frac{-0.5}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 + h \cdot \left(\frac{t_0}{\ell} \cdot \frac{t_0}{-2}\right)\right)\right) \cdot t_1\\
\end{array}
\end{array}
if l < -3.9000000000000004e162Initial program 38.7%
Simplified41.4%
Taylor expanded in h around 0 36.3%
pow1/236.3%
*-rgt-identity36.3%
pow1/236.3%
pow-prod-down25.8%
Applied egg-rr25.8%
unpow1/225.8%
*-commutative25.8%
Simplified25.8%
Taylor expanded in d around -inf 55.2%
associate-*r*55.2%
neg-mul-155.2%
Simplified55.2%
if -3.9000000000000004e162 < l < -9.999999999999969e-311Initial program 75.5%
Simplified72.7%
Applied egg-rr29.9%
expm1-def29.9%
expm1-log1p72.7%
associate-*l/75.6%
*-commutative75.6%
associate-*l/75.6%
*-commutative75.6%
associate-/l*75.6%
associate-*r*75.6%
*-commutative75.6%
*-rgt-identity75.6%
associate-*r/75.6%
associate-*r*77.5%
*-commutative77.5%
associate-*l*77.5%
associate-*r/77.5%
metadata-eval77.5%
Simplified77.5%
expm1-log1p-u77.0%
expm1-udef75.1%
div-inv75.1%
*-commutative75.1%
associate-*r*74.3%
clear-num74.3%
Applied egg-rr74.3%
expm1-def75.3%
expm1-log1p75.6%
associate-*l*77.5%
*-commutative77.5%
associate-*r/77.5%
associate-/l*77.5%
Simplified77.5%
if -9.999999999999969e-311 < l Initial program 69.2%
Simplified69.2%
Applied egg-rr39.5%
expm1-def39.5%
expm1-log1p69.2%
associate-*l/69.4%
*-commutative69.4%
associate-*l/68.6%
*-commutative68.6%
associate-/l*68.6%
associate-*r*68.6%
*-commutative68.6%
*-rgt-identity68.6%
associate-*r/68.6%
associate-*r*68.6%
*-commutative68.6%
associate-*l*68.6%
associate-*r/68.6%
metadata-eval68.6%
Simplified68.6%
unpow268.6%
div-inv68.6%
metadata-eval68.6%
metadata-eval68.6%
times-frac69.4%
*-commutative69.4%
associate-*r*69.4%
*-commutative69.4%
associate-*r*69.4%
metadata-eval69.4%
Applied egg-rr69.4%
sqrt-div91.1%
div-inv91.1%
Applied egg-rr80.0%
associate-*r/91.1%
*-rgt-identity91.1%
Simplified80.0%
Final simplification75.6%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* M_m (* D (/ 0.5 d))))
(t_1 (/ t_0 -2.0))
(t_2 (sqrt (/ d l)))
(t_3 (+ 1.0 (* h (* (/ t_0 l) t_1))))
(t_4 (sqrt (/ d h))))
(if (<= h 1e-310)
(* (* t_3 t_2) t_4)
(if (<= h 1.85e+189)
(* (* (/ (sqrt d) (sqrt l)) t_3) t_4)
(*
(/ (sqrt d) (sqrt h))
(* t_2 (+ 1.0 (* h (* t_1 (* M_m (/ (/ D (* d 2.0)) l)))))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = M_m * (D * (0.5 / d));
double t_1 = t_0 / -2.0;
double t_2 = sqrt((d / l));
double t_3 = 1.0 + (h * ((t_0 / l) * t_1));
double t_4 = sqrt((d / h));
double tmp;
if (h <= 1e-310) {
tmp = (t_3 * t_2) * t_4;
} else if (h <= 1.85e+189) {
tmp = ((sqrt(d) / sqrt(l)) * t_3) * t_4;
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_2 * (1.0 + (h * (t_1 * (M_m * ((D / (d * 2.0)) / l))))));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = m_m * (d_1 * (0.5d0 / d))
t_1 = t_0 / (-2.0d0)
t_2 = sqrt((d / l))
t_3 = 1.0d0 + (h * ((t_0 / l) * t_1))
t_4 = sqrt((d / h))
if (h <= 1d-310) then
tmp = (t_3 * t_2) * t_4
else if (h <= 1.85d+189) then
tmp = ((sqrt(d) / sqrt(l)) * t_3) * t_4
else
tmp = (sqrt(d) / sqrt(h)) * (t_2 * (1.0d0 + (h * (t_1 * (m_m * ((d_1 / (d * 2.0d0)) / l))))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = M_m * (D * (0.5 / d));
double t_1 = t_0 / -2.0;
double t_2 = Math.sqrt((d / l));
double t_3 = 1.0 + (h * ((t_0 / l) * t_1));
double t_4 = Math.sqrt((d / h));
double tmp;
if (h <= 1e-310) {
tmp = (t_3 * t_2) * t_4;
} else if (h <= 1.85e+189) {
tmp = ((Math.sqrt(d) / Math.sqrt(l)) * t_3) * t_4;
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_2 * (1.0 + (h * (t_1 * (M_m * ((D / (d * 2.0)) / l))))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = M_m * (D * (0.5 / d)) t_1 = t_0 / -2.0 t_2 = math.sqrt((d / l)) t_3 = 1.0 + (h * ((t_0 / l) * t_1)) t_4 = math.sqrt((d / h)) tmp = 0 if h <= 1e-310: tmp = (t_3 * t_2) * t_4 elif h <= 1.85e+189: tmp = ((math.sqrt(d) / math.sqrt(l)) * t_3) * t_4 else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_2 * (1.0 + (h * (t_1 * (M_m * ((D / (d * 2.0)) / l)))))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(M_m * Float64(D * Float64(0.5 / d))) t_1 = Float64(t_0 / -2.0) t_2 = sqrt(Float64(d / l)) t_3 = Float64(1.0 + Float64(h * Float64(Float64(t_0 / l) * t_1))) t_4 = sqrt(Float64(d / h)) tmp = 0.0 if (h <= 1e-310) tmp = Float64(Float64(t_3 * t_2) * t_4); elseif (h <= 1.85e+189) tmp = Float64(Float64(Float64(sqrt(d) / sqrt(l)) * t_3) * t_4); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_2 * Float64(1.0 + Float64(h * Float64(t_1 * Float64(M_m * Float64(Float64(D / Float64(d * 2.0)) / l))))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = M_m * (D * (0.5 / d));
t_1 = t_0 / -2.0;
t_2 = sqrt((d / l));
t_3 = 1.0 + (h * ((t_0 / l) * t_1));
t_4 = sqrt((d / h));
tmp = 0.0;
if (h <= 1e-310)
tmp = (t_3 * t_2) * t_4;
elseif (h <= 1.85e+189)
tmp = ((sqrt(d) / sqrt(l)) * t_3) * t_4;
else
tmp = (sqrt(d) / sqrt(h)) * (t_2 * (1.0 + (h * (t_1 * (M_m * ((D / (d * 2.0)) / l))))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(M$95$m * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / -2.0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(1.0 + N[(h * N[(N[(t$95$0 / l), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, 1e-310], N[(N[(t$95$3 * t$95$2), $MachinePrecision] * t$95$4), $MachinePrecision], If[LessEqual[h, 1.85e+189], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$4), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * N[(1.0 + N[(h * N[(t$95$1 * N[(M$95$m * N[(N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := M_m \cdot \left(D \cdot \frac{0.5}{d}\right)\\
t_1 := \frac{t_0}{-2}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := 1 + h \cdot \left(\frac{t_0}{\ell} \cdot t_1\right)\\
t_4 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;h \leq 10^{-310}:\\
\;\;\;\;\left(t_3 \cdot t_2\right) \cdot t_4\\
\mathbf{elif}\;h \leq 1.85 \cdot 10^{+189}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_3\right) \cdot t_4\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_2 \cdot \left(1 + h \cdot \left(t_1 \cdot \left(M_m \cdot \frac{\frac{D}{d \cdot 2}}{\ell}\right)\right)\right)\right)\\
\end{array}
\end{array}
if h < 9.999999999999969e-311Initial program 66.4%
Simplified64.3%
Applied egg-rr30.6%
expm1-def30.6%
expm1-log1p64.3%
associate-*l/65.9%
*-commutative65.9%
associate-*l/66.6%
*-commutative66.6%
associate-/l*66.6%
associate-*r*66.6%
*-commutative66.6%
*-rgt-identity66.6%
associate-*r/66.6%
associate-*r*68.6%
*-commutative68.6%
associate-*l*68.6%
associate-*r/68.6%
metadata-eval68.6%
Simplified68.6%
unpow268.6%
div-inv68.6%
metadata-eval68.6%
metadata-eval68.6%
times-frac70.0%
*-commutative70.0%
associate-*r*67.3%
*-commutative67.3%
associate-*r*68.0%
metadata-eval68.0%
Applied egg-rr68.0%
if 9.999999999999969e-311 < h < 1.8500000000000001e189Initial program 75.3%
Simplified75.3%
Applied egg-rr44.4%
expm1-def44.4%
expm1-log1p75.3%
associate-*l/75.6%
*-commutative75.6%
associate-*l/74.6%
*-commutative74.6%
associate-/l*74.6%
associate-*r*74.6%
*-commutative74.6%
*-rgt-identity74.6%
associate-*r/74.6%
associate-*r*74.6%
*-commutative74.6%
associate-*l*74.6%
associate-*r/74.6%
metadata-eval74.6%
Simplified74.6%
unpow274.6%
div-inv74.6%
metadata-eval74.6%
metadata-eval74.6%
times-frac75.6%
*-commutative75.6%
associate-*r*75.6%
*-commutative75.6%
associate-*r*75.6%
metadata-eval75.6%
Applied egg-rr75.6%
sqrt-div92.0%
div-inv92.0%
Applied egg-rr87.9%
associate-*r/92.0%
*-rgt-identity92.0%
Simplified88.0%
if 1.8500000000000001e189 < h Initial program 46.1%
Simplified46.0%
Applied egg-rr20.9%
expm1-def20.9%
expm1-log1p46.0%
associate-*l/46.0%
*-commutative46.0%
associate-*l/46.0%
*-commutative46.0%
associate-/l*46.0%
associate-*r*46.0%
*-commutative46.0%
*-rgt-identity46.0%
associate-*r/46.0%
associate-*r*46.1%
*-commutative46.1%
associate-*l*46.1%
associate-*r/46.1%
metadata-eval46.1%
Simplified46.1%
unpow246.1%
div-inv46.1%
metadata-eval46.1%
metadata-eval46.1%
times-frac46.1%
*-commutative46.1%
associate-*r*46.0%
*-commutative46.0%
associate-*r*46.0%
metadata-eval46.0%
Applied egg-rr46.0%
sqrt-div83.2%
div-inv83.2%
Applied egg-rr83.2%
associate-*r/83.2%
*-rgt-identity83.2%
Simplified83.2%
associate-/l*83.2%
associate-/r/83.2%
clear-num83.2%
un-div-inv83.2%
div-inv83.2%
metadata-eval83.2%
Applied egg-rr83.2%
Final simplification76.5%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* M_m (* D (/ 0.5 d))))
(t_1 (sqrt (/ d h)))
(t_2 (/ t_0 -2.0))
(t_3 (+ 1.0 (* h (* (/ t_0 l) t_2)))))
(if (<= h -5e-310)
(* t_1 (* t_3 (/ (sqrt (- d)) (sqrt (- l)))))
(if (<= h 2.4e+188)
(* (* (/ (sqrt d) (sqrt l)) t_3) t_1)
(*
(/ (sqrt d) (sqrt h))
(*
(sqrt (/ d l))
(+ 1.0 (* h (* t_2 (* M_m (/ (/ D (* d 2.0)) l)))))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = M_m * (D * (0.5 / d));
double t_1 = sqrt((d / h));
double t_2 = t_0 / -2.0;
double t_3 = 1.0 + (h * ((t_0 / l) * t_2));
double tmp;
if (h <= -5e-310) {
tmp = t_1 * (t_3 * (sqrt(-d) / sqrt(-l)));
} else if (h <= 2.4e+188) {
tmp = ((sqrt(d) / sqrt(l)) * t_3) * t_1;
} else {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 + (h * (t_2 * (M_m * ((D / (d * 2.0)) / l))))));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = m_m * (d_1 * (0.5d0 / d))
t_1 = sqrt((d / h))
t_2 = t_0 / (-2.0d0)
t_3 = 1.0d0 + (h * ((t_0 / l) * t_2))
if (h <= (-5d-310)) then
tmp = t_1 * (t_3 * (sqrt(-d) / sqrt(-l)))
else if (h <= 2.4d+188) then
tmp = ((sqrt(d) / sqrt(l)) * t_3) * t_1
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0d0 + (h * (t_2 * (m_m * ((d_1 / (d * 2.0d0)) / l))))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = M_m * (D * (0.5 / d));
double t_1 = Math.sqrt((d / h));
double t_2 = t_0 / -2.0;
double t_3 = 1.0 + (h * ((t_0 / l) * t_2));
double tmp;
if (h <= -5e-310) {
tmp = t_1 * (t_3 * (Math.sqrt(-d) / Math.sqrt(-l)));
} else if (h <= 2.4e+188) {
tmp = ((Math.sqrt(d) / Math.sqrt(l)) * t_3) * t_1;
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (Math.sqrt((d / l)) * (1.0 + (h * (t_2 * (M_m * ((D / (d * 2.0)) / l))))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = M_m * (D * (0.5 / d)) t_1 = math.sqrt((d / h)) t_2 = t_0 / -2.0 t_3 = 1.0 + (h * ((t_0 / l) * t_2)) tmp = 0 if h <= -5e-310: tmp = t_1 * (t_3 * (math.sqrt(-d) / math.sqrt(-l))) elif h <= 2.4e+188: tmp = ((math.sqrt(d) / math.sqrt(l)) * t_3) * t_1 else: tmp = (math.sqrt(d) / math.sqrt(h)) * (math.sqrt((d / l)) * (1.0 + (h * (t_2 * (M_m * ((D / (d * 2.0)) / l)))))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(M_m * Float64(D * Float64(0.5 / d))) t_1 = sqrt(Float64(d / h)) t_2 = Float64(t_0 / -2.0) t_3 = Float64(1.0 + Float64(h * Float64(Float64(t_0 / l) * t_2))) tmp = 0.0 if (h <= -5e-310) tmp = Float64(t_1 * Float64(t_3 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))))); elseif (h <= 2.4e+188) tmp = Float64(Float64(Float64(sqrt(d) / sqrt(l)) * t_3) * t_1); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(t_2 * Float64(M_m * Float64(Float64(D / Float64(d * 2.0)) / l))))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = M_m * (D * (0.5 / d));
t_1 = sqrt((d / h));
t_2 = t_0 / -2.0;
t_3 = 1.0 + (h * ((t_0 / l) * t_2));
tmp = 0.0;
if (h <= -5e-310)
tmp = t_1 * (t_3 * (sqrt(-d) / sqrt(-l)));
elseif (h <= 2.4e+188)
tmp = ((sqrt(d) / sqrt(l)) * t_3) * t_1;
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 + (h * (t_2 * (M_m * ((D / (d * 2.0)) / l))))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(M$95$m * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 / -2.0), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 + N[(h * N[(N[(t$95$0 / l), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(t$95$1 * N[(t$95$3 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.4e+188], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(t$95$2 * N[(M$95$m * N[(N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := M_m \cdot \left(D \cdot \frac{0.5}{d}\right)\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \frac{t_0}{-2}\\
t_3 := 1 + h \cdot \left(\frac{t_0}{\ell} \cdot t_2\right)\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t_1 \cdot \left(t_3 \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\
\mathbf{elif}\;h \leq 2.4 \cdot 10^{+188}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_3\right) \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(t_2 \cdot \left(M_m \cdot \frac{\frac{D}{d \cdot 2}}{\ell}\right)\right)\right)\right)\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 66.4%
Simplified64.3%
Applied egg-rr30.6%
expm1-def30.6%
expm1-log1p64.3%
associate-*l/65.9%
*-commutative65.9%
associate-*l/66.6%
*-commutative66.6%
associate-/l*66.6%
associate-*r*66.6%
*-commutative66.6%
*-rgt-identity66.6%
associate-*r/66.6%
associate-*r*68.6%
*-commutative68.6%
associate-*l*68.6%
associate-*r/68.6%
metadata-eval68.6%
Simplified68.6%
unpow268.6%
div-inv68.6%
metadata-eval68.6%
metadata-eval68.6%
times-frac70.0%
*-commutative70.0%
associate-*r*67.3%
*-commutative67.3%
associate-*r*68.0%
metadata-eval68.0%
Applied egg-rr68.0%
frac-2neg68.0%
sqrt-div75.2%
Applied egg-rr75.2%
if -4.999999999999985e-310 < h < 2.3999999999999999e188Initial program 75.3%
Simplified75.3%
Applied egg-rr44.4%
expm1-def44.4%
expm1-log1p75.3%
associate-*l/75.6%
*-commutative75.6%
associate-*l/74.6%
*-commutative74.6%
associate-/l*74.6%
associate-*r*74.6%
*-commutative74.6%
*-rgt-identity74.6%
associate-*r/74.6%
associate-*r*74.6%
*-commutative74.6%
associate-*l*74.6%
associate-*r/74.6%
metadata-eval74.6%
Simplified74.6%
unpow274.6%
div-inv74.6%
metadata-eval74.6%
metadata-eval74.6%
times-frac75.6%
*-commutative75.6%
associate-*r*75.6%
*-commutative75.6%
associate-*r*75.6%
metadata-eval75.6%
Applied egg-rr75.6%
sqrt-div92.0%
div-inv92.0%
Applied egg-rr87.9%
associate-*r/92.0%
*-rgt-identity92.0%
Simplified88.0%
if 2.3999999999999999e188 < h Initial program 46.1%
Simplified46.0%
Applied egg-rr20.9%
expm1-def20.9%
expm1-log1p46.0%
associate-*l/46.0%
*-commutative46.0%
associate-*l/46.0%
*-commutative46.0%
associate-/l*46.0%
associate-*r*46.0%
*-commutative46.0%
*-rgt-identity46.0%
associate-*r/46.0%
associate-*r*46.1%
*-commutative46.1%
associate-*l*46.1%
associate-*r/46.1%
metadata-eval46.1%
Simplified46.1%
unpow246.1%
div-inv46.1%
metadata-eval46.1%
metadata-eval46.1%
times-frac46.1%
*-commutative46.1%
associate-*r*46.0%
*-commutative46.0%
associate-*r*46.0%
metadata-eval46.0%
Applied egg-rr46.0%
sqrt-div83.2%
div-inv83.2%
Applied egg-rr83.2%
associate-*r/83.2%
*-rgt-identity83.2%
Simplified83.2%
associate-/l*83.2%
associate-/r/83.2%
clear-num83.2%
un-div-inv83.2%
div-inv83.2%
metadata-eval83.2%
Applied egg-rr83.2%
Final simplification80.5%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* M_m (* D (/ 0.5 d))))
(t_1 (/ t_0 -2.0))
(t_2 (+ 1.0 (* h (* (/ t_0 l) t_1))))
(t_3 (sqrt (/ d l))))
(if (<= h -5e-310)
(* (/ (sqrt (- d)) (sqrt (- h))) (* t_2 t_3))
(if (<= h 4.8e+188)
(* (* (/ (sqrt d) (sqrt l)) t_2) (sqrt (/ d h)))
(*
(/ (sqrt d) (sqrt h))
(* t_3 (+ 1.0 (* h (* t_1 (* M_m (/ (/ D (* d 2.0)) l)))))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = M_m * (D * (0.5 / d));
double t_1 = t_0 / -2.0;
double t_2 = 1.0 + (h * ((t_0 / l) * t_1));
double t_3 = sqrt((d / l));
double tmp;
if (h <= -5e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (t_2 * t_3);
} else if (h <= 4.8e+188) {
tmp = ((sqrt(d) / sqrt(l)) * t_2) * sqrt((d / h));
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_3 * (1.0 + (h * (t_1 * (M_m * ((D / (d * 2.0)) / l))))));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = m_m * (d_1 * (0.5d0 / d))
t_1 = t_0 / (-2.0d0)
t_2 = 1.0d0 + (h * ((t_0 / l) * t_1))
t_3 = sqrt((d / l))
if (h <= (-5d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * (t_2 * t_3)
else if (h <= 4.8d+188) then
tmp = ((sqrt(d) / sqrt(l)) * t_2) * sqrt((d / h))
else
tmp = (sqrt(d) / sqrt(h)) * (t_3 * (1.0d0 + (h * (t_1 * (m_m * ((d_1 / (d * 2.0d0)) / l))))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = M_m * (D * (0.5 / d));
double t_1 = t_0 / -2.0;
double t_2 = 1.0 + (h * ((t_0 / l) * t_1));
double t_3 = Math.sqrt((d / l));
double tmp;
if (h <= -5e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_2 * t_3);
} else if (h <= 4.8e+188) {
tmp = ((Math.sqrt(d) / Math.sqrt(l)) * t_2) * Math.sqrt((d / h));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_3 * (1.0 + (h * (t_1 * (M_m * ((D / (d * 2.0)) / l))))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = M_m * (D * (0.5 / d)) t_1 = t_0 / -2.0 t_2 = 1.0 + (h * ((t_0 / l) * t_1)) t_3 = math.sqrt((d / l)) tmp = 0 if h <= -5e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (t_2 * t_3) elif h <= 4.8e+188: tmp = ((math.sqrt(d) / math.sqrt(l)) * t_2) * math.sqrt((d / h)) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_3 * (1.0 + (h * (t_1 * (M_m * ((D / (d * 2.0)) / l)))))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(M_m * Float64(D * Float64(0.5 / d))) t_1 = Float64(t_0 / -2.0) t_2 = Float64(1.0 + Float64(h * Float64(Float64(t_0 / l) * t_1))) t_3 = sqrt(Float64(d / l)) tmp = 0.0 if (h <= -5e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_2 * t_3)); elseif (h <= 4.8e+188) tmp = Float64(Float64(Float64(sqrt(d) / sqrt(l)) * t_2) * sqrt(Float64(d / h))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_3 * Float64(1.0 + Float64(h * Float64(t_1 * Float64(M_m * Float64(Float64(D / Float64(d * 2.0)) / l))))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = M_m * (D * (0.5 / d));
t_1 = t_0 / -2.0;
t_2 = 1.0 + (h * ((t_0 / l) * t_1));
t_3 = sqrt((d / l));
tmp = 0.0;
if (h <= -5e-310)
tmp = (sqrt(-d) / sqrt(-h)) * (t_2 * t_3);
elseif (h <= 4.8e+188)
tmp = ((sqrt(d) / sqrt(l)) * t_2) * sqrt((d / h));
else
tmp = (sqrt(d) / sqrt(h)) * (t_3 * (1.0 + (h * (t_1 * (M_m * ((D / (d * 2.0)) / l))))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(M$95$m * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / -2.0), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(h * N[(N[(t$95$0 / l), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 4.8e+188], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$3 * N[(1.0 + N[(h * N[(t$95$1 * N[(M$95$m * N[(N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := M_m \cdot \left(D \cdot \frac{0.5}{d}\right)\\
t_1 := \frac{t_0}{-2}\\
t_2 := 1 + h \cdot \left(\frac{t_0}{\ell} \cdot t_1\right)\\
t_3 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t_2 \cdot t_3\right)\\
\mathbf{elif}\;h \leq 4.8 \cdot 10^{+188}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_2\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_3 \cdot \left(1 + h \cdot \left(t_1 \cdot \left(M_m \cdot \frac{\frac{D}{d \cdot 2}}{\ell}\right)\right)\right)\right)\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 66.4%
Simplified64.3%
Applied egg-rr30.6%
expm1-def30.6%
expm1-log1p64.3%
associate-*l/65.9%
*-commutative65.9%
associate-*l/66.6%
*-commutative66.6%
associate-/l*66.6%
associate-*r*66.6%
*-commutative66.6%
*-rgt-identity66.6%
associate-*r/66.6%
associate-*r*68.6%
*-commutative68.6%
associate-*l*68.6%
associate-*r/68.6%
metadata-eval68.6%
Simplified68.6%
unpow268.6%
div-inv68.6%
metadata-eval68.6%
metadata-eval68.6%
times-frac70.0%
*-commutative70.0%
associate-*r*67.3%
*-commutative67.3%
associate-*r*68.0%
metadata-eval68.0%
Applied egg-rr68.0%
frac-2neg69.5%
sqrt-div83.6%
Applied egg-rr80.5%
if -4.999999999999985e-310 < h < 4.7999999999999999e188Initial program 75.3%
Simplified75.3%
Applied egg-rr44.4%
expm1-def44.4%
expm1-log1p75.3%
associate-*l/75.6%
*-commutative75.6%
associate-*l/74.6%
*-commutative74.6%
associate-/l*74.6%
associate-*r*74.6%
*-commutative74.6%
*-rgt-identity74.6%
associate-*r/74.6%
associate-*r*74.6%
*-commutative74.6%
associate-*l*74.6%
associate-*r/74.6%
metadata-eval74.6%
Simplified74.6%
unpow274.6%
div-inv74.6%
metadata-eval74.6%
metadata-eval74.6%
times-frac75.6%
*-commutative75.6%
associate-*r*75.6%
*-commutative75.6%
associate-*r*75.6%
metadata-eval75.6%
Applied egg-rr75.6%
sqrt-div92.0%
div-inv92.0%
Applied egg-rr87.9%
associate-*r/92.0%
*-rgt-identity92.0%
Simplified88.0%
if 4.7999999999999999e188 < h Initial program 46.1%
Simplified46.0%
Applied egg-rr20.9%
expm1-def20.9%
expm1-log1p46.0%
associate-*l/46.0%
*-commutative46.0%
associate-*l/46.0%
*-commutative46.0%
associate-/l*46.0%
associate-*r*46.0%
*-commutative46.0%
*-rgt-identity46.0%
associate-*r/46.0%
associate-*r*46.1%
*-commutative46.1%
associate-*l*46.1%
associate-*r/46.1%
metadata-eval46.1%
Simplified46.1%
unpow246.1%
div-inv46.1%
metadata-eval46.1%
metadata-eval46.1%
times-frac46.1%
*-commutative46.1%
associate-*r*46.0%
*-commutative46.0%
associate-*r*46.0%
metadata-eval46.0%
Applied egg-rr46.0%
sqrt-div83.2%
div-inv83.2%
Applied egg-rr83.2%
associate-*r/83.2%
*-rgt-identity83.2%
Simplified83.2%
associate-/l*83.2%
associate-/r/83.2%
clear-num83.2%
un-div-inv83.2%
div-inv83.2%
metadata-eval83.2%
Applied egg-rr83.2%
Final simplification83.4%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= d -2.9e+175)
(* d (- (sqrt (/ 1.0 (* l h)))))
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(+
1.0
(*
h
(* (/ (* M_m (* D (/ 0.5 d))) l) (/ (* 0.5 (/ D (/ d M_m))) -2.0))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -2.9e+175) {
tmp = d * -sqrt((1.0 / (l * h)));
} else {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * (((M_m * (D * (0.5 / d))) / l) * ((0.5 * (D / (d / M_m))) / -2.0)))));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-2.9d+175)) then
tmp = d * -sqrt((1.0d0 / (l * h)))
else
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + (h * (((m_m * (d_1 * (0.5d0 / d))) / l) * ((0.5d0 * (d_1 / (d / m_m))) / (-2.0d0))))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -2.9e+175) {
tmp = d * -Math.sqrt((1.0 / (l * h)));
} else {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + (h * (((M_m * (D * (0.5 / d))) / l) * ((0.5 * (D / (d / M_m))) / -2.0)))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= -2.9e+175: tmp = d * -math.sqrt((1.0 / (l * h))) else: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + (h * (((M_m * (D * (0.5 / d))) / l) * ((0.5 * (D / (d / M_m))) / -2.0))))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -2.9e+175) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h))))); else tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(Float64(Float64(M_m * Float64(D * Float64(0.5 / d))) / l) * Float64(Float64(0.5 * Float64(D / Float64(d / M_m))) / -2.0)))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= -2.9e+175)
tmp = d * -sqrt((1.0 / (l * h)));
else
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * (((M_m * (D * (0.5 / d))) / l) * ((0.5 * (D / (d / M_m))) / -2.0)))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -2.9e+175], N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[(N[(M$95$m * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(0.5 * N[(D / N[(d / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.9 \cdot 10^{+175}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(\frac{M_m \cdot \left(D \cdot \frac{0.5}{d}\right)}{\ell} \cdot \frac{0.5 \cdot \frac{D}{\frac{d}{M_m}}}{-2}\right)\right)\right)\\
\end{array}
\end{array}
if d < -2.9e175Initial program 56.1%
Simplified59.0%
Taylor expanded in h around 0 34.6%
pow1/234.6%
*-rgt-identity34.6%
pow1/234.6%
pow-prod-down28.9%
Applied egg-rr28.9%
unpow1/228.9%
*-commutative28.9%
Simplified28.9%
Taylor expanded in d around -inf 68.7%
associate-*r*68.7%
neg-mul-168.7%
Simplified68.7%
if -2.9e175 < d Initial program 69.3%
Simplified68.4%
Applied egg-rr34.7%
expm1-def34.7%
expm1-log1p68.4%
associate-*l/69.9%
*-commutative69.9%
associate-*l/69.4%
*-commutative69.4%
associate-/l*69.4%
associate-*r*69.4%
*-commutative69.4%
*-rgt-identity69.4%
associate-*r/69.4%
associate-*r*69.9%
*-commutative69.9%
associate-*l*69.9%
associate-*r/69.9%
metadata-eval69.9%
Simplified69.9%
unpow269.9%
div-inv69.9%
metadata-eval69.9%
metadata-eval69.9%
times-frac71.2%
*-commutative71.2%
associate-*r*70.3%
*-commutative70.3%
associate-*r*70.7%
metadata-eval70.7%
Applied egg-rr70.7%
Taylor expanded in D around 0 70.7%
associate-/l*70.6%
Simplified70.6%
Final simplification70.3%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -1.5e+220)
(* d (- (sqrt (/ 1.0 (* l h)))))
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(+
1.0
(*
h
(* (/ (* M_m (* D (/ 0.5 d))) l) (/ (* 0.5 (/ (* M_m D) d)) -2.0))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1.5e+220) {
tmp = d * -sqrt((1.0 / (l * h)));
} else {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * (((M_m * (D * (0.5 / d))) / l) * ((0.5 * ((M_m * D) / d)) / -2.0)))));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-1.5d+220)) then
tmp = d * -sqrt((1.0d0 / (l * h)))
else
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + (h * (((m_m * (d_1 * (0.5d0 / d))) / l) * ((0.5d0 * ((m_m * d_1) / d)) / (-2.0d0))))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1.5e+220) {
tmp = d * -Math.sqrt((1.0 / (l * h)));
} else {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + (h * (((M_m * (D * (0.5 / d))) / l) * ((0.5 * ((M_m * D) / d)) / -2.0)))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -1.5e+220: tmp = d * -math.sqrt((1.0 / (l * h))) else: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + (h * (((M_m * (D * (0.5 / d))) / l) * ((0.5 * ((M_m * D) / d)) / -2.0))))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -1.5e+220) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h))))); else tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(Float64(Float64(M_m * Float64(D * Float64(0.5 / d))) / l) * Float64(Float64(0.5 * Float64(Float64(M_m * D) / d)) / -2.0)))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -1.5e+220)
tmp = d * -sqrt((1.0 / (l * h)));
else
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * (((M_m * (D * (0.5 / d))) / l) * ((0.5 * ((M_m * D) / d)) / -2.0)))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -1.5e+220], N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[(N[(M$95$m * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(0.5 * N[(N[(M$95$m * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.5 \cdot 10^{+220}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(\frac{M_m \cdot \left(D \cdot \frac{0.5}{d}\right)}{\ell} \cdot \frac{0.5 \cdot \frac{M_m \cdot D}{d}}{-2}\right)\right)\right)\\
\end{array}
\end{array}
if l < -1.50000000000000012e220Initial program 9.1%
Simplified15.0%
Taylor expanded in h around 0 9.5%
pow1/29.5%
*-rgt-identity9.5%
pow1/29.5%
pow-prod-down9.5%
Applied egg-rr9.5%
unpow1/29.5%
*-commutative9.5%
Simplified9.5%
Taylor expanded in d around -inf 50.7%
associate-*r*50.7%
neg-mul-150.7%
Simplified50.7%
if -1.50000000000000012e220 < l Initial program 71.5%
Simplified69.9%
Applied egg-rr36.4%
expm1-def36.4%
expm1-log1p69.9%
associate-*l/71.3%
*-commutative71.3%
associate-*l/70.9%
*-commutative70.9%
associate-/l*70.9%
associate-*r*70.9%
*-commutative70.9%
*-rgt-identity70.9%
associate-*r/70.9%
associate-*r*72.2%
*-commutative72.2%
associate-*l*72.2%
associate-*r/72.2%
metadata-eval72.2%
Simplified72.2%
unpow272.2%
div-inv72.2%
metadata-eval72.2%
metadata-eval72.2%
times-frac73.0%
*-commutative73.0%
associate-*r*71.3%
*-commutative71.3%
associate-*r*71.7%
metadata-eval71.7%
Applied egg-rr71.7%
Taylor expanded in D around 0 71.7%
Final simplification70.4%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* d (- (sqrt (/ 1.0 (* l h)))))))
(if (<= d -7.2e+126)
t_0
(if (<= d -3.9e-86)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d 7.1e-245) t_0 (/ d (* (sqrt h) (sqrt l))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = d * -sqrt((1.0 / (l * h)));
double tmp;
if (d <= -7.2e+126) {
tmp = t_0;
} else if (d <= -3.9e-86) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= 7.1e-245) {
tmp = t_0;
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = d * -sqrt((1.0d0 / (l * h)))
if (d <= (-7.2d+126)) then
tmp = t_0
else if (d <= (-3.9d-86)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (d <= 7.1d-245) then
tmp = t_0
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = d * -Math.sqrt((1.0 / (l * h)));
double tmp;
if (d <= -7.2e+126) {
tmp = t_0;
} else if (d <= -3.9e-86) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (d <= 7.1e-245) {
tmp = t_0;
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = d * -math.sqrt((1.0 / (l * h))) tmp = 0 if d <= -7.2e+126: tmp = t_0 elif d <= -3.9e-86: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif d <= 7.1e-245: tmp = t_0 else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h))))) tmp = 0.0 if (d <= -7.2e+126) tmp = t_0; elseif (d <= -3.9e-86) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= 7.1e-245) tmp = t_0; else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = d * -sqrt((1.0 / (l * h)));
tmp = 0.0;
if (d <= -7.2e+126)
tmp = t_0;
elseif (d <= -3.9e-86)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (d <= 7.1e-245)
tmp = t_0;
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -7.2e+126], t$95$0, If[LessEqual[d, -3.9e-86], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.1e-245], t$95$0, N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\
\mathbf{if}\;d \leq -7.2 \cdot 10^{+126}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -3.9 \cdot 10^{-86}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq 7.1 \cdot 10^{-245}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -7.2000000000000001e126 or -3.9000000000000002e-86 < d < 7.10000000000000016e-245Initial program 56.1%
Simplified56.6%
Taylor expanded in h around 0 22.0%
pow1/222.0%
*-rgt-identity22.0%
pow1/222.0%
pow-prod-down16.8%
Applied egg-rr16.8%
unpow1/216.8%
*-commutative16.8%
Simplified16.8%
Taylor expanded in d around -inf 39.5%
associate-*r*39.5%
neg-mul-139.5%
Simplified39.5%
if -7.2000000000000001e126 < d < -3.9000000000000002e-86Initial program 83.6%
Simplified83.6%
Taylor expanded in h around 0 50.1%
pow1/250.1%
*-rgt-identity50.1%
pow1/250.1%
pow-prod-down36.6%
Applied egg-rr36.6%
unpow1/236.6%
*-commutative36.6%
Simplified36.6%
sqrt-prod50.1%
Applied egg-rr50.1%
if 7.10000000000000016e-245 < d Initial program 72.2%
Simplified72.2%
Taylor expanded in h around 0 44.2%
*-rgt-identity44.2%
*-commutative44.2%
sqrt-div51.4%
sqrt-div54.9%
frac-times54.9%
add-sqr-sqrt55.0%
Applied egg-rr55.0%
Final simplification47.7%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* d (- (sqrt (/ 1.0 (* l h)))))))
(if (<= d -1.9e+116)
t_0
(if (<= d -5.3e-86)
(/ (sqrt (/ d l)) (sqrt (/ h d)))
(if (<= d 6.6e-245) t_0 (/ d (* (sqrt h) (sqrt l))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = d * -sqrt((1.0 / (l * h)));
double tmp;
if (d <= -1.9e+116) {
tmp = t_0;
} else if (d <= -5.3e-86) {
tmp = sqrt((d / l)) / sqrt((h / d));
} else if (d <= 6.6e-245) {
tmp = t_0;
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = d * -sqrt((1.0d0 / (l * h)))
if (d <= (-1.9d+116)) then
tmp = t_0
else if (d <= (-5.3d-86)) then
tmp = sqrt((d / l)) / sqrt((h / d))
else if (d <= 6.6d-245) then
tmp = t_0
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = d * -Math.sqrt((1.0 / (l * h)));
double tmp;
if (d <= -1.9e+116) {
tmp = t_0;
} else if (d <= -5.3e-86) {
tmp = Math.sqrt((d / l)) / Math.sqrt((h / d));
} else if (d <= 6.6e-245) {
tmp = t_0;
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = d * -math.sqrt((1.0 / (l * h))) tmp = 0 if d <= -1.9e+116: tmp = t_0 elif d <= -5.3e-86: tmp = math.sqrt((d / l)) / math.sqrt((h / d)) elif d <= 6.6e-245: tmp = t_0 else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h))))) tmp = 0.0 if (d <= -1.9e+116) tmp = t_0; elseif (d <= -5.3e-86) tmp = Float64(sqrt(Float64(d / l)) / sqrt(Float64(h / d))); elseif (d <= 6.6e-245) tmp = t_0; else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = d * -sqrt((1.0 / (l * h)));
tmp = 0.0;
if (d <= -1.9e+116)
tmp = t_0;
elseif (d <= -5.3e-86)
tmp = sqrt((d / l)) / sqrt((h / d));
elseif (d <= 6.6e-245)
tmp = t_0;
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -1.9e+116], t$95$0, If[LessEqual[d, -5.3e-86], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.6e-245], t$95$0, N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\
\mathbf{if}\;d \leq -1.9 \cdot 10^{+116}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -5.3 \cdot 10^{-86}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\
\mathbf{elif}\;d \leq 6.6 \cdot 10^{-245}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.8999999999999999e116 or -5.2999999999999997e-86 < d < 6.6000000000000002e-245Initial program 57.7%
Simplified58.1%
Taylor expanded in h around 0 24.0%
pow1/224.0%
*-rgt-identity24.0%
pow1/224.0%
pow-prod-down18.9%
Applied egg-rr18.9%
unpow1/218.9%
*-commutative18.9%
Simplified18.9%
Taylor expanded in d around -inf 40.8%
associate-*r*40.8%
neg-mul-140.8%
Simplified40.8%
if -1.8999999999999999e116 < d < -5.2999999999999997e-86Initial program 82.1%
Simplified82.1%
Taylor expanded in h around 0 47.9%
clear-num48.0%
sqrt-div49.2%
metadata-eval49.2%
Applied egg-rr49.2%
expm1-log1p-u46.8%
expm1-udef27.6%
*-rgt-identity27.6%
associate-*l/27.6%
*-un-lft-identity27.6%
Applied egg-rr27.6%
expm1-def46.9%
expm1-log1p49.1%
Simplified49.1%
if 6.6000000000000002e-245 < d Initial program 72.2%
Simplified72.2%
Taylor expanded in h around 0 44.2%
*-rgt-identity44.2%
*-commutative44.2%
sqrt-div51.4%
sqrt-div54.9%
frac-times54.9%
add-sqr-sqrt55.0%
Applied egg-rr55.0%
Final simplification47.9%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* d (- (sqrt (/ 1.0 (* l h)))))))
(if (<= d -1.18e+117)
t_0
(if (<= d -1.15e-87)
(* (sqrt (/ d l)) (/ 1.0 (sqrt (/ h d))))
(if (<= d 1.16e-244) t_0 (/ d (* (sqrt h) (sqrt l))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = d * -sqrt((1.0 / (l * h)));
double tmp;
if (d <= -1.18e+117) {
tmp = t_0;
} else if (d <= -1.15e-87) {
tmp = sqrt((d / l)) * (1.0 / sqrt((h / d)));
} else if (d <= 1.16e-244) {
tmp = t_0;
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = d * -sqrt((1.0d0 / (l * h)))
if (d <= (-1.18d+117)) then
tmp = t_0
else if (d <= (-1.15d-87)) then
tmp = sqrt((d / l)) * (1.0d0 / sqrt((h / d)))
else if (d <= 1.16d-244) then
tmp = t_0
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = d * -Math.sqrt((1.0 / (l * h)));
double tmp;
if (d <= -1.18e+117) {
tmp = t_0;
} else if (d <= -1.15e-87) {
tmp = Math.sqrt((d / l)) * (1.0 / Math.sqrt((h / d)));
} else if (d <= 1.16e-244) {
tmp = t_0;
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = d * -math.sqrt((1.0 / (l * h))) tmp = 0 if d <= -1.18e+117: tmp = t_0 elif d <= -1.15e-87: tmp = math.sqrt((d / l)) * (1.0 / math.sqrt((h / d))) elif d <= 1.16e-244: tmp = t_0 else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h))))) tmp = 0.0 if (d <= -1.18e+117) tmp = t_0; elseif (d <= -1.15e-87) tmp = Float64(sqrt(Float64(d / l)) * Float64(1.0 / sqrt(Float64(h / d)))); elseif (d <= 1.16e-244) tmp = t_0; else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = d * -sqrt((1.0 / (l * h)));
tmp = 0.0;
if (d <= -1.18e+117)
tmp = t_0;
elseif (d <= -1.15e-87)
tmp = sqrt((d / l)) * (1.0 / sqrt((h / d)));
elseif (d <= 1.16e-244)
tmp = t_0;
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -1.18e+117], t$95$0, If[LessEqual[d, -1.15e-87], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.16e-244], t$95$0, N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\
\mathbf{if}\;d \leq -1.18 \cdot 10^{+117}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -1.15 \cdot 10^{-87}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\
\mathbf{elif}\;d \leq 1.16 \cdot 10^{-244}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.18e117 or -1.1500000000000001e-87 < d < 1.16e-244Initial program 57.7%
Simplified58.1%
Taylor expanded in h around 0 24.0%
pow1/224.0%
*-rgt-identity24.0%
pow1/224.0%
pow-prod-down18.9%
Applied egg-rr18.9%
unpow1/218.9%
*-commutative18.9%
Simplified18.9%
Taylor expanded in d around -inf 40.8%
associate-*r*40.8%
neg-mul-140.8%
Simplified40.8%
if -1.18e117 < d < -1.1500000000000001e-87Initial program 82.1%
Simplified82.1%
Taylor expanded in h around 0 47.9%
pow1/247.9%
*-rgt-identity47.9%
pow1/247.9%
pow-prod-down33.1%
Applied egg-rr33.1%
unpow1/233.1%
*-commutative33.1%
Simplified33.1%
sqrt-prod47.9%
Applied egg-rr47.9%
clear-num48.0%
sqrt-div49.2%
metadata-eval49.2%
Applied egg-rr49.2%
if 1.16e-244 < d Initial program 72.2%
Simplified72.2%
Taylor expanded in h around 0 44.2%
*-rgt-identity44.2%
*-commutative44.2%
sqrt-div51.4%
sqrt-div54.9%
frac-times54.9%
add-sqr-sqrt55.0%
Applied egg-rr55.0%
Final simplification47.9%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* d (- (sqrt (/ 1.0 (* l h)))))))
(if (<= d -1.35e+131)
t_0
(if (<= d -5.8e-86)
(* (sqrt (/ d l)) (pow (/ h d) -0.5))
(if (<= d 6.5e-245) t_0 (/ d (* (sqrt h) (sqrt l))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = d * -sqrt((1.0 / (l * h)));
double tmp;
if (d <= -1.35e+131) {
tmp = t_0;
} else if (d <= -5.8e-86) {
tmp = sqrt((d / l)) * pow((h / d), -0.5);
} else if (d <= 6.5e-245) {
tmp = t_0;
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = d * -sqrt((1.0d0 / (l * h)))
if (d <= (-1.35d+131)) then
tmp = t_0
else if (d <= (-5.8d-86)) then
tmp = sqrt((d / l)) * ((h / d) ** (-0.5d0))
else if (d <= 6.5d-245) then
tmp = t_0
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = d * -Math.sqrt((1.0 / (l * h)));
double tmp;
if (d <= -1.35e+131) {
tmp = t_0;
} else if (d <= -5.8e-86) {
tmp = Math.sqrt((d / l)) * Math.pow((h / d), -0.5);
} else if (d <= 6.5e-245) {
tmp = t_0;
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = d * -math.sqrt((1.0 / (l * h))) tmp = 0 if d <= -1.35e+131: tmp = t_0 elif d <= -5.8e-86: tmp = math.sqrt((d / l)) * math.pow((h / d), -0.5) elif d <= 6.5e-245: tmp = t_0 else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h))))) tmp = 0.0 if (d <= -1.35e+131) tmp = t_0; elseif (d <= -5.8e-86) tmp = Float64(sqrt(Float64(d / l)) * (Float64(h / d) ^ -0.5)); elseif (d <= 6.5e-245) tmp = t_0; else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = d * -sqrt((1.0 / (l * h)));
tmp = 0.0;
if (d <= -1.35e+131)
tmp = t_0;
elseif (d <= -5.8e-86)
tmp = sqrt((d / l)) * ((h / d) ^ -0.5);
elseif (d <= 6.5e-245)
tmp = t_0;
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -1.35e+131], t$95$0, If[LessEqual[d, -5.8e-86], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Power[N[(h / d), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.5e-245], t$95$0, N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\
\mathbf{if}\;d \leq -1.35 \cdot 10^{+131}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -5.8 \cdot 10^{-86}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot {\left(\frac{h}{d}\right)}^{-0.5}\\
\mathbf{elif}\;d \leq 6.5 \cdot 10^{-245}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.35000000000000002e131 or -5.7999999999999998e-86 < d < 6.5000000000000004e-245Initial program 55.2%
Simplified55.7%
Taylor expanded in h around 0 20.5%
pow1/220.5%
*-rgt-identity20.5%
pow1/220.5%
pow-prod-down15.2%
Applied egg-rr15.2%
unpow1/215.2%
*-commutative15.2%
Simplified15.2%
Taylor expanded in d around -inf 38.4%
associate-*r*38.4%
neg-mul-138.4%
Simplified38.4%
if -1.35000000000000002e131 < d < -5.7999999999999998e-86Initial program 84.2%
Simplified84.2%
Taylor expanded in h around 0 52.1%
clear-num52.2%
sqrt-div53.2%
metadata-eval53.2%
Applied egg-rr53.2%
expm1-log1p-u51.2%
expm1-udef33.3%
pow1/233.3%
pow-flip33.3%
metadata-eval33.3%
Applied egg-rr33.3%
expm1-def51.2%
expm1-log1p53.3%
Simplified53.3%
if 6.5000000000000004e-245 < d Initial program 72.2%
Simplified72.2%
Taylor expanded in h around 0 44.2%
*-rgt-identity44.2%
*-commutative44.2%
sqrt-div51.4%
sqrt-div54.9%
frac-times54.9%
add-sqr-sqrt55.0%
Applied egg-rr55.0%
Final simplification47.9%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= d 1.8e-244) (* d (- (sqrt (/ 1.0 (* l h))))) (/ d (* (sqrt h) (sqrt l)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= 1.8e-244) {
tmp = d * -sqrt((1.0 / (l * h)));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= 1.8d-244) then
tmp = d * -sqrt((1.0d0 / (l * h)))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= 1.8e-244) {
tmp = d * -Math.sqrt((1.0 / (l * h)));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= 1.8e-244: tmp = d * -math.sqrt((1.0 / (l * h))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= 1.8e-244) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= 1.8e-244)
tmp = d * -sqrt((1.0 / (l * h)));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, 1.8e-244], N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.8 \cdot 10^{-244}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < 1.79999999999999987e-244Initial program 64.7%
Simplified65.0%
Taylor expanded in h around 0 30.8%
pow1/230.8%
*-rgt-identity30.8%
pow1/230.8%
pow-prod-down23.0%
Applied egg-rr23.0%
unpow1/223.0%
*-commutative23.0%
Simplified23.0%
Taylor expanded in d around -inf 37.4%
associate-*r*37.4%
neg-mul-137.4%
Simplified37.4%
if 1.79999999999999987e-244 < d Initial program 72.2%
Simplified72.2%
Taylor expanded in h around 0 44.2%
*-rgt-identity44.2%
*-commutative44.2%
sqrt-div51.4%
sqrt-div54.9%
frac-times54.9%
add-sqr-sqrt55.0%
Applied egg-rr55.0%
Final simplification44.4%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (let* ((t_0 (sqrt (/ 1.0 (* l h))))) (if (<= l -1.95e-241) (* d (- t_0)) (* d t_0))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((1.0 / (l * h)));
double tmp;
if (l <= -1.95e-241) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((1.0d0 / (l * h)))
if (l <= (-1.95d-241)) then
tmp = d * -t_0
else
tmp = d * t_0
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((1.0 / (l * h)));
double tmp;
if (l <= -1.95e-241) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((1.0 / (l * h))) tmp = 0 if l <= -1.95e-241: tmp = d * -t_0 else: tmp = d * t_0 return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(1.0 / Float64(l * h))) tmp = 0.0 if (l <= -1.95e-241) tmp = Float64(d * Float64(-t_0)); else tmp = Float64(d * t_0); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((1.0 / (l * h)));
tmp = 0.0;
if (l <= -1.95e-241)
tmp = d * -t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.95e-241], N[(d * (-t$95$0)), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{if}\;\ell \leq -1.95 \cdot 10^{-241}:\\
\;\;\;\;d \cdot \left(-t_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t_0\\
\end{array}
\end{array}
if l < -1.9499999999999999e-241Initial program 63.7%
Simplified64.1%
Taylor expanded in h around 0 33.7%
pow1/233.7%
*-rgt-identity33.7%
pow1/233.7%
pow-prod-down25.8%
Applied egg-rr25.8%
unpow1/225.8%
*-commutative25.8%
Simplified25.8%
Taylor expanded in d around -inf 41.6%
associate-*r*41.6%
neg-mul-141.6%
Simplified41.6%
if -1.9499999999999999e-241 < l Initial program 71.5%
Simplified71.6%
Taylor expanded in h around 0 38.5%
Taylor expanded in d around 0 40.7%
*-commutative40.7%
Simplified40.7%
Final simplification41.1%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= d -1.1e-68) (sqrt (* (/ d l) (/ d h))) (* d (sqrt (/ 1.0 (* l h))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -1.1e-68) {
tmp = sqrt(((d / l) * (d / h)));
} else {
tmp = d * sqrt((1.0 / (l * h)));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-1.1d-68)) then
tmp = sqrt(((d / l) * (d / h)))
else
tmp = d * sqrt((1.0d0 / (l * h)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -1.1e-68) {
tmp = Math.sqrt(((d / l) * (d / h)));
} else {
tmp = d * Math.sqrt((1.0 / (l * h)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= -1.1e-68: tmp = math.sqrt(((d / l) * (d / h))) else: tmp = d * math.sqrt((1.0 / (l * h))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -1.1e-68) tmp = sqrt(Float64(Float64(d / l) * Float64(d / h))); else tmp = Float64(d * sqrt(Float64(1.0 / Float64(l * h)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= -1.1e-68)
tmp = sqrt(((d / l) * (d / h)));
else
tmp = d * sqrt((1.0 / (l * h)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -1.1e-68], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.1 \cdot 10^{-68}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\end{array}
\end{array}
if d < -1.10000000000000001e-68Initial program 71.6%
Simplified72.7%
Taylor expanded in h around 0 44.3%
pow1/244.3%
*-rgt-identity44.3%
pow1/244.3%
pow-prod-down34.4%
Applied egg-rr34.4%
unpow1/234.4%
*-commutative34.4%
Simplified34.4%
if -1.10000000000000001e-68 < d Initial program 65.7%
Simplified65.5%
Taylor expanded in h around 0 32.2%
Taylor expanded in d around 0 33.9%
*-commutative33.9%
Simplified33.9%
Final simplification34.1%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (sqrt (* (/ d l) (/ d h))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
return sqrt(((d / l) * (d / h)));
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
code = sqrt(((d / l) * (d / h)))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
return Math.sqrt(((d / l) * (d / h)));
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): return math.sqrt(((d / l) * (d / h)))
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) return sqrt(Float64(Float64(d / l) * Float64(d / h))) end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
tmp = sqrt(((d / l) * (d / h)));
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}
\end{array}
Initial program 67.6%
Simplified67.9%
Taylor expanded in h around 0 36.1%
pow1/236.1%
*-rgt-identity36.1%
pow1/236.1%
pow-prod-down27.8%
Applied egg-rr27.8%
unpow1/227.8%
*-commutative27.8%
Simplified27.8%
Final simplification27.8%
herbie shell --seed 2024024
(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)))))