
(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 19 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
(if (<= d -5.8e-304)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(- 1.0 (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
(*
(/ (fma (* h (pow (/ (* M_m (/ D d)) 2.0) 2.0)) (/ -0.5 l) 1.0) (sqrt h))
(/ d (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 <= -5.8e-304) {
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
} else {
tmp = (fma((h * pow(((M_m * (D / d)) / 2.0), 2.0)), (-0.5 / l), 1.0) / sqrt(h)) * (d / 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 <= -5.8e-304) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))); else tmp = Float64(Float64(fma(Float64(h * (Float64(Float64(M_m * Float64(D / d)) / 2.0) ^ 2.0)), Float64(-0.5 / l), 1.0) / sqrt(h)) * Float64(d / sqrt(l))); end return 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, -5.8e-304], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(h * N[Power[N[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(d / 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 -5.8 \cdot 10^{-304}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(h \cdot {\left(\frac{M\_m \cdot \frac{D}{d}}{2}\right)}^{2}, \frac{-0.5}{\ell}, 1\right)}{\sqrt{h}} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -5.8e-304Initial program 73.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6473.7
Applied rewrites73.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6484.8
Applied rewrites84.8%
if -5.8e-304 < d Initial program 63.3%
Applied rewrites58.5%
Applied rewrites66.7%
Applied rewrites66.6%
Applied rewrites83.8%
Final simplification84.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
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_1 (sqrt (/ d h)))
(t_2 (sqrt (/ d l))))
(if (<= t_0 -2e+40)
(* (* (* (* -0.125 (/ (/ (* D D) d) d)) (* h (/ (* M_m M_m) l))) t_1) t_2)
(if (<= t_0 INFINITY)
(* t_1 t_2)
(/
(/
(fma
(* -0.25 (sqrt h))
(* (* (* M_m M_m) D) D)
(* (* l d) (sqrt (pow h -1.0))))
l)
(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 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = sqrt((d / h));
double t_2 = sqrt((d / l));
double tmp;
if (t_0 <= -2e+40) {
tmp = (((-0.125 * (((D * D) / d) / d)) * (h * ((M_m * M_m) / l))) * t_1) * t_2;
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_1 * t_2;
} else {
tmp = (fma((-0.25 * sqrt(h)), (((M_m * M_m) * D) * D), ((l * d) * sqrt(pow(h, -1.0)))) / l) / 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(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = sqrt(Float64(d / h)) t_2 = sqrt(Float64(d / l)) tmp = 0.0 if (t_0 <= -2e+40) tmp = Float64(Float64(Float64(Float64(-0.125 * Float64(Float64(Float64(D * D) / d) / d)) * Float64(h * Float64(Float64(M_m * M_m) / l))) * t_1) * t_2); elseif (t_0 <= Inf) tmp = Float64(t_1 * t_2); else tmp = Float64(Float64(fma(Float64(-0.25 * sqrt(h)), Float64(Float64(Float64(M_m * M_m) * D) * D), Float64(Float64(l * d) * sqrt((h ^ -1.0)))) / l) / sqrt(l)); end return 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[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -2e+40], N[(N[(N[(N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(t$95$1 * t$95$2), $MachinePrecision], N[(N[(N[(N[(-0.25 * N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] + N[(N[(l * d), $MachinePrecision] * N[Sqrt[N[Power[h, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / N[Sqrt[l], $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 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+40}:\\
\;\;\;\;\left(\left(\left(-0.125 \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \left(h \cdot \frac{M\_m \cdot M\_m}{\ell}\right)\right) \cdot t\_1\right) \cdot t\_2\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(-0.25 \cdot \sqrt{h}, \left(\left(M\_m \cdot M\_m\right) \cdot D\right) \cdot D, \left(\ell \cdot d\right) \cdot \sqrt{{h}^{-1}}\right)}{\ell}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000006e40Initial program 91.5%
Applied rewrites43.7%
Applied rewrites93.6%
Applied rewrites93.6%
Taylor expanded in d around 0
times-fracN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6472.6
Applied rewrites72.6%
if -2.00000000000000006e40 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 76.4%
Applied rewrites67.9%
Applied rewrites75.0%
Applied rewrites75.0%
Taylor expanded in d around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
lower-sqrt.f64N/A
lower-/.f6473.6
Applied rewrites73.6%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f640.0
Applied rewrites0.0%
Applied rewrites10.0%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites29.9%
Final simplification66.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 (<=
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
-5e+76)
(*
(* (* -0.125 (/ (/ (* D D) d) d)) (* h (/ (* M_m M_m) l)))
(/ d (sqrt (* l h))))
(* (sqrt (/ d h)) (sqrt (/ d 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 (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e+76) {
tmp = ((-0.125 * (((D * D) / d) / d)) * (h * ((M_m * M_m) / l))) * (d / sqrt((l * h)));
} else {
tmp = sqrt((d / h)) * sqrt((d / 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 / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m_m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= (-5d+76)) then
tmp = (((-0.125d0) * (((d_1 * d_1) / d) / d)) * (h * ((m_m * m_m) / l))) * (d / sqrt((l * h)))
else
tmp = sqrt((d / h)) * sqrt((d / 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 (((Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e+76) {
tmp = ((-0.125 * (((D * D) / d) / d)) * (h * ((M_m * M_m) / l))) * (d / Math.sqrt((l * h)));
} else {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / 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 ((math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e+76: tmp = ((-0.125 * (((D * D) / d) / d)) * (h * ((M_m * M_m) / l))) * (d / math.sqrt((l * h))) else: tmp = math.sqrt((d / h)) * math.sqrt((d / 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 (Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -5e+76) tmp = Float64(Float64(Float64(-0.125 * Float64(Float64(Float64(D * D) / d) / d)) * Float64(h * Float64(Float64(M_m * M_m) / l))) * Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / 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 / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M_m * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= -5e+76)
tmp = ((-0.125 * (((D * D) / d) / d)) * (h * ((M_m * M_m) / l))) * (d / sqrt((l * h)));
else
tmp = sqrt((d / h)) * sqrt((d / 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[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e+76], N[(N[(N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / 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}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{+76}:\\
\;\;\;\;\left(\left(-0.125 \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \left(h \cdot \frac{M\_m \cdot M\_m}{\ell}\right)\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -4.99999999999999991e76Initial program 91.4%
Applied rewrites44.3%
Applied rewrites93.6%
Applied rewrites49.0%
Taylor expanded in d around 0
times-fracN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6442.5
Applied rewrites42.5%
if -4.99999999999999991e76 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 58.5%
Applied rewrites55.2%
Applied rewrites60.4%
Applied rewrites60.4%
Taylor expanded in d around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
lower-sqrt.f64N/A
lower-/.f6459.7
Applied rewrites59.7%
Final simplification54.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
(if (<=
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
-5e+76)
(* (* (* M_m M_m) (* (/ (* D D) d) -0.125)) (/ (sqrt (/ h l)) (fabs l)))
(* (sqrt (/ d h)) (sqrt (/ d 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 (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e+76) {
tmp = ((M_m * M_m) * (((D * D) / d) * -0.125)) * (sqrt((h / l)) / fabs(l));
} else {
tmp = sqrt((d / h)) * sqrt((d / 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 / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m_m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= (-5d+76)) then
tmp = ((m_m * m_m) * (((d_1 * d_1) / d) * (-0.125d0))) * (sqrt((h / l)) / abs(l))
else
tmp = sqrt((d / h)) * sqrt((d / 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 (((Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e+76) {
tmp = ((M_m * M_m) * (((D * D) / d) * -0.125)) * (Math.sqrt((h / l)) / Math.abs(l));
} else {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / 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 ((math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e+76: tmp = ((M_m * M_m) * (((D * D) / d) * -0.125)) * (math.sqrt((h / l)) / math.fabs(l)) else: tmp = math.sqrt((d / h)) * math.sqrt((d / 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 (Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -5e+76) tmp = Float64(Float64(Float64(M_m * M_m) * Float64(Float64(Float64(D * D) / d) * -0.125)) * Float64(sqrt(Float64(h / l)) / abs(l))); else tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / 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 / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M_m * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= -5e+76)
tmp = ((M_m * M_m) * (((D * D) / d) * -0.125)) * (sqrt((h / l)) / abs(l));
else
tmp = sqrt((d / h)) * sqrt((d / 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[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e+76], N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / N[Abs[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / 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}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{+76}:\\
\;\;\;\;\left(\left(M\_m \cdot M\_m\right) \cdot \left(\frac{D \cdot D}{d} \cdot -0.125\right)\right) \cdot \frac{\sqrt{\frac{h}{\ell}}}{\left|\ell\right|}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -4.99999999999999991e76Initial program 91.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6491.4
Applied rewrites91.4%
Taylor expanded in d around 0
*-commutativeN/A
associate-*l/N/A
*-commutativeN/A
associate-*l*N/A
associate-*r/N/A
associate-*l/N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites39.9%
Applied rewrites43.7%
if -4.99999999999999991e76 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 58.5%
Applied rewrites55.2%
Applied rewrites60.4%
Applied rewrites60.4%
Taylor expanded in d around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
lower-sqrt.f64N/A
lower-/.f6459.7
Applied rewrites59.7%
Final simplification54.8%
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 (<= h -3.75e-180)
(*
(*
(fma (/ (* (pow (/ (* (/ D d) M_m) 2.0) 2.0) 0.5) (- l)) h 1.0)
(sqrt (/ d h)))
(/ (sqrt (- d)) (sqrt (- l))))
(if (<= h -2e-310)
(* (- d) (sqrt (pow (* l h) -1.0)))
(*
(/ (fma (* h (pow (/ (* M_m (/ D d)) 2.0) 2.0)) (/ -0.5 l) 1.0) (sqrt h))
(/ d (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 (h <= -3.75e-180) {
tmp = (fma(((pow((((D / d) * M_m) / 2.0), 2.0) * 0.5) / -l), h, 1.0) * sqrt((d / h))) * (sqrt(-d) / sqrt(-l));
} else if (h <= -2e-310) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = (fma((h * pow(((M_m * (D / d)) / 2.0), 2.0)), (-0.5 / l), 1.0) / sqrt(h)) * (d / 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 (h <= -3.75e-180) tmp = Float64(Float64(fma(Float64(Float64((Float64(Float64(Float64(D / d) * M_m) / 2.0) ^ 2.0) * 0.5) / Float64(-l)), h, 1.0) * sqrt(Float64(d / h))) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))); elseif (h <= -2e-310) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64(Float64(fma(Float64(h * (Float64(Float64(M_m * Float64(D / d)) / 2.0) ^ 2.0)), Float64(-0.5 / l), 1.0) / sqrt(h)) * Float64(d / sqrt(l))); end return 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[h, -3.75e-180], N[(N[(N[(N[(N[(N[Power[N[(N[(N[(D / d), $MachinePrecision] * M$95$m), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision] / (-l)), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(h * N[Power[N[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(d / 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}\;h \leq -3.75 \cdot 10^{-180}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{{\left(\frac{\frac{D}{d} \cdot M\_m}{2}\right)}^{2} \cdot 0.5}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(h \cdot {\left(\frac{M\_m \cdot \frac{D}{d}}{2}\right)}^{2}, \frac{-0.5}{\ell}, 1\right)}{\sqrt{h}} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if h < -3.75000000000000008e-180Initial program 79.1%
Applied rewrites45.3%
Applied rewrites80.0%
Applied rewrites80.0%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f6486.2
Applied rewrites86.2%
if -3.75000000000000008e-180 < h < -1.999999999999994e-310Initial program 50.6%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6450.6
Applied rewrites50.6%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6481.6
Applied rewrites81.6%
if -1.999999999999994e-310 < h Initial program 63.8%
Applied rewrites59.0%
Applied rewrites67.2%
Applied rewrites67.2%
Applied rewrites84.5%
Final simplification84.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 (<= h -6.5e-180)
(*
(*
(fma (/ (* (pow (/ (/ (* M_m D) d) 2.0) 2.0) 0.5) (- l)) h 1.0)
(sqrt (/ d h)))
(sqrt (/ d l)))
(if (<= h -2e-310)
(* (- d) (sqrt (pow (* l h) -1.0)))
(*
(/ (fma (* h (pow (/ (* M_m (/ D d)) 2.0) 2.0)) (/ -0.5 l) 1.0) (sqrt h))
(/ d (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 (h <= -6.5e-180) {
tmp = (fma(((pow((((M_m * D) / d) / 2.0), 2.0) * 0.5) / -l), h, 1.0) * sqrt((d / h))) * sqrt((d / l));
} else if (h <= -2e-310) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = (fma((h * pow(((M_m * (D / d)) / 2.0), 2.0)), (-0.5 / l), 1.0) / sqrt(h)) * (d / 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 (h <= -6.5e-180) tmp = Float64(Float64(fma(Float64(Float64((Float64(Float64(Float64(M_m * D) / d) / 2.0) ^ 2.0) * 0.5) / Float64(-l)), h, 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); elseif (h <= -2e-310) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64(Float64(fma(Float64(h * (Float64(Float64(M_m * Float64(D / d)) / 2.0) ^ 2.0)), Float64(-0.5 / l), 1.0) / sqrt(h)) * Float64(d / sqrt(l))); end return 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[h, -6.5e-180], N[(N[(N[(N[(N[(N[Power[N[(N[(N[(M$95$m * D), $MachinePrecision] / d), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision] / (-l)), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(h * N[Power[N[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(d / 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}\;h \leq -6.5 \cdot 10^{-180}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{{\left(\frac{\frac{M\_m \cdot D}{d}}{2}\right)}^{2} \cdot 0.5}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(h \cdot {\left(\frac{M\_m \cdot \frac{D}{d}}{2}\right)}^{2}, \frac{-0.5}{\ell}, 1\right)}{\sqrt{h}} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if h < -6.50000000000000013e-180Initial program 79.1%
Applied rewrites45.3%
Applied rewrites80.0%
Applied rewrites80.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lower-/.f6480.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.0
Applied rewrites80.0%
if -6.50000000000000013e-180 < h < -1.999999999999994e-310Initial program 50.6%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6450.6
Applied rewrites50.6%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6481.6
Applied rewrites81.6%
if -1.999999999999994e-310 < h Initial program 63.8%
Applied rewrites59.0%
Applied rewrites67.2%
Applied rewrites67.2%
Applied rewrites84.5%
Final simplification82.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 (/ (* M_m (/ D d)) 2.0)))
(if (<= h -6.5e-180)
(*
(* (fma (* t_0 (* t_0 (/ -0.5 l))) h 1.0) (sqrt (/ d h)))
(sqrt (/ d l)))
(if (<= h -2e-310)
(* (- d) (sqrt (pow (* l h) -1.0)))
(*
(/ (fma (* h (pow t_0 2.0)) (/ -0.5 l) 1.0) (sqrt h))
(/ d (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 = (M_m * (D / d)) / 2.0;
double tmp;
if (h <= -6.5e-180) {
tmp = (fma((t_0 * (t_0 * (-0.5 / l))), h, 1.0) * sqrt((d / h))) * sqrt((d / l));
} else if (h <= -2e-310) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = (fma((h * pow(t_0, 2.0)), (-0.5 / l), 1.0) / sqrt(h)) * (d / 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(Float64(M_m * Float64(D / d)) / 2.0) tmp = 0.0 if (h <= -6.5e-180) tmp = Float64(Float64(fma(Float64(t_0 * Float64(t_0 * Float64(-0.5 / l))), h, 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); elseif (h <= -2e-310) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64(Float64(fma(Float64(h * (t_0 ^ 2.0)), Float64(-0.5 / l), 1.0) / sqrt(h)) * Float64(d / sqrt(l))); end return 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[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[h, -6.5e-180], N[(N[(N[(N[(t$95$0 * N[(t$95$0 * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(h * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(d / 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 := \frac{M\_m \cdot \frac{D}{d}}{2}\\
\mathbf{if}\;h \leq -6.5 \cdot 10^{-180}:\\
\;\;\;\;\left(\mathsf{fma}\left(t\_0 \cdot \left(t\_0 \cdot \frac{-0.5}{\ell}\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(h \cdot {t\_0}^{2}, \frac{-0.5}{\ell}, 1\right)}{\sqrt{h}} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if h < -6.50000000000000013e-180Initial program 79.1%
Applied rewrites45.3%
Applied rewrites80.0%
Applied rewrites80.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-eval80.2
Applied rewrites80.2%
if -6.50000000000000013e-180 < h < -1.999999999999994e-310Initial program 50.6%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6450.6
Applied rewrites50.6%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6481.6
Applied rewrites81.6%
if -1.999999999999994e-310 < h Initial program 63.8%
Applied rewrites59.0%
Applied rewrites67.2%
Applied rewrites67.2%
Applied rewrites84.5%
Final simplification82.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 (sqrt (/ d h))))
(if (<= h -2.3e-142)
(/ (* (* 1.0 t_0) (sqrt (- d))) (sqrt (- l)))
(if (<= h -2e-310)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= h 2.7e+71)
(/
(*
(* (fma (* D M_m) (* (* D M_m) (* (/ h (* l d)) -0.25)) 1.0) t_0)
(sqrt d))
(sqrt l))
(/
(/
(fma
(* -0.25 (sqrt h))
(* (* (* M_m M_m) D) D)
(* (* l d) (sqrt (pow h -1.0))))
l)
(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 = sqrt((d / h));
double tmp;
if (h <= -2.3e-142) {
tmp = ((1.0 * t_0) * sqrt(-d)) / sqrt(-l);
} else if (h <= -2e-310) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (h <= 2.7e+71) {
tmp = ((fma((D * M_m), ((D * M_m) * ((h / (l * d)) * -0.25)), 1.0) * t_0) * sqrt(d)) / sqrt(l);
} else {
tmp = (fma((-0.25 * sqrt(h)), (((M_m * M_m) * D) * D), ((l * d) * sqrt(pow(h, -1.0)))) / l) / 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 = sqrt(Float64(d / h)) tmp = 0.0 if (h <= -2.3e-142) tmp = Float64(Float64(Float64(1.0 * t_0) * sqrt(Float64(-d))) / sqrt(Float64(-l))); elseif (h <= -2e-310) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (h <= 2.7e+71) tmp = Float64(Float64(Float64(fma(Float64(D * M_m), Float64(Float64(D * M_m) * Float64(Float64(h / Float64(l * d)) * -0.25)), 1.0) * t_0) * sqrt(d)) / sqrt(l)); else tmp = Float64(Float64(fma(Float64(-0.25 * sqrt(h)), Float64(Float64(Float64(M_m * M_m) * D) * D), Float64(Float64(l * d) * sqrt((h ^ -1.0)))) / l) / sqrt(l)); end return 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[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -2.3e-142], N[(N[(N[(1.0 * t$95$0), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.7e+71], N[(N[(N[(N[(N[(D * M$95$m), $MachinePrecision] * N[(N[(D * M$95$m), $MachinePrecision] * N[(N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(-0.25 * N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] + N[(N[(l * d), $MachinePrecision] * N[Sqrt[N[Power[h, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / N[Sqrt[l], $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{\frac{d}{h}}\\
\mathbf{if}\;h \leq -2.3 \cdot 10^{-142}:\\
\;\;\;\;\frac{\left(1 \cdot t\_0\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;h \leq 2.7 \cdot 10^{+71}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(D \cdot M\_m, \left(D \cdot M\_m\right) \cdot \left(\frac{h}{\ell \cdot d} \cdot -0.25\right), 1\right) \cdot t\_0\right) \cdot \sqrt{d}}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(-0.25 \cdot \sqrt{h}, \left(\left(M\_m \cdot M\_m\right) \cdot D\right) \cdot D, \left(\ell \cdot d\right) \cdot \sqrt{{h}^{-1}}\right)}{\ell}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if h < -2.30000000000000002e-142Initial program 80.2%
Taylor expanded in d around inf
Applied rewrites50.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
associate-*r*N/A
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
Applied rewrites55.1%
if -2.30000000000000002e-142 < h < -1.999999999999994e-310Initial program 58.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6458.0
Applied rewrites58.0%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6473.4
Applied rewrites73.4%
if -1.999999999999994e-310 < h < 2.69999999999999997e71Initial program 75.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6475.8
Applied rewrites75.8%
Applied rewrites69.7%
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6474.0
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6471.3
Applied rewrites71.3%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6474.0
Applied rewrites74.0%
if 2.69999999999999997e71 < h Initial program 47.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6447.1
Applied rewrites47.1%
Applied rewrites47.6%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites63.7%
Final simplification65.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 (<= h -2.3e-142)
(/ (* (* 1.0 (sqrt (/ d h))) (sqrt (- d))) (sqrt (- l)))
(if (<= h 5e-309)
(* (- d) (sqrt (pow (* l h) -1.0)))
(/
(/
(fma
(* -0.25 (sqrt h))
(* (* (* M_m M_m) D) D)
(* (* l d) (sqrt (pow h -1.0))))
l)
(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 (h <= -2.3e-142) {
tmp = ((1.0 * sqrt((d / h))) * sqrt(-d)) / sqrt(-l);
} else if (h <= 5e-309) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = (fma((-0.25 * sqrt(h)), (((M_m * M_m) * D) * D), ((l * d) * sqrt(pow(h, -1.0)))) / l) / 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 (h <= -2.3e-142) tmp = Float64(Float64(Float64(1.0 * sqrt(Float64(d / h))) * sqrt(Float64(-d))) / sqrt(Float64(-l))); elseif (h <= 5e-309) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64(Float64(fma(Float64(-0.25 * sqrt(h)), Float64(Float64(Float64(M_m * M_m) * D) * D), Float64(Float64(l * d) * sqrt((h ^ -1.0)))) / l) / sqrt(l)); end return 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[h, -2.3e-142], N[(N[(N[(1.0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 5e-309], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(-0.25 * N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] + N[(N[(l * d), $MachinePrecision] * N[Sqrt[N[Power[h, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / N[Sqrt[l], $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}\;h \leq -2.3 \cdot 10^{-142}:\\
\;\;\;\;\frac{\left(1 \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}\\
\mathbf{elif}\;h \leq 5 \cdot 10^{-309}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(-0.25 \cdot \sqrt{h}, \left(\left(M\_m \cdot M\_m\right) \cdot D\right) \cdot D, \left(\ell \cdot d\right) \cdot \sqrt{{h}^{-1}}\right)}{\ell}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if h < -2.30000000000000002e-142Initial program 80.2%
Taylor expanded in d around inf
Applied rewrites50.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
associate-*r*N/A
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
Applied rewrites55.1%
if -2.30000000000000002e-142 < h < 4.9999999999999995e-309Initial program 58.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6458.0
Applied rewrites58.0%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6473.4
Applied rewrites73.4%
if 4.9999999999999995e-309 < h Initial program 63.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6463.8
Applied rewrites63.8%
Applied rewrites60.5%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites64.3%
Final simplification62.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 (sqrt (- d))))
(if (<= d -7.5e-63)
(/ (* (* 1.0 (sqrt (/ d l))) t_0) (sqrt (- h)))
(if (<= d -5e-310)
(/ (* (* 1.0 (sqrt (/ d h))) t_0) (sqrt (- l)))
(if (<= d 1.15e-35)
(/ (* (* -0.25 (sqrt h)) (* (/ (* M_m M_m) l) (* D D))) (sqrt l))
(* (pow (* (sqrt l) (sqrt h)) -1.0) d))))))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 tmp;
if (d <= -7.5e-63) {
tmp = ((1.0 * sqrt((d / l))) * t_0) / sqrt(-h);
} else if (d <= -5e-310) {
tmp = ((1.0 * sqrt((d / h))) * t_0) / sqrt(-l);
} else if (d <= 1.15e-35) {
tmp = ((-0.25 * sqrt(h)) * (((M_m * M_m) / l) * (D * D))) / sqrt(l);
} else {
tmp = pow((sqrt(l) * sqrt(h)), -1.0) * d;
}
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(-d)
if (d <= (-7.5d-63)) then
tmp = ((1.0d0 * sqrt((d / l))) * t_0) / sqrt(-h)
else if (d <= (-5d-310)) then
tmp = ((1.0d0 * sqrt((d / h))) * t_0) / sqrt(-l)
else if (d <= 1.15d-35) then
tmp = (((-0.25d0) * sqrt(h)) * (((m_m * m_m) / l) * (d_1 * d_1))) / sqrt(l)
else
tmp = ((sqrt(l) * sqrt(h)) ** (-1.0d0)) * d
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 tmp;
if (d <= -7.5e-63) {
tmp = ((1.0 * Math.sqrt((d / l))) * t_0) / Math.sqrt(-h);
} else if (d <= -5e-310) {
tmp = ((1.0 * Math.sqrt((d / h))) * t_0) / Math.sqrt(-l);
} else if (d <= 1.15e-35) {
tmp = ((-0.25 * Math.sqrt(h)) * (((M_m * M_m) / l) * (D * D))) / Math.sqrt(l);
} else {
tmp = Math.pow((Math.sqrt(l) * Math.sqrt(h)), -1.0) * d;
}
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) tmp = 0 if d <= -7.5e-63: tmp = ((1.0 * math.sqrt((d / l))) * t_0) / math.sqrt(-h) elif d <= -5e-310: tmp = ((1.0 * math.sqrt((d / h))) * t_0) / math.sqrt(-l) elif d <= 1.15e-35: tmp = ((-0.25 * math.sqrt(h)) * (((M_m * M_m) / l) * (D * D))) / math.sqrt(l) else: tmp = math.pow((math.sqrt(l) * math.sqrt(h)), -1.0) * d 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)) tmp = 0.0 if (d <= -7.5e-63) tmp = Float64(Float64(Float64(1.0 * sqrt(Float64(d / l))) * t_0) / sqrt(Float64(-h))); elseif (d <= -5e-310) tmp = Float64(Float64(Float64(1.0 * sqrt(Float64(d / h))) * t_0) / sqrt(Float64(-l))); elseif (d <= 1.15e-35) tmp = Float64(Float64(Float64(-0.25 * sqrt(h)) * Float64(Float64(Float64(M_m * M_m) / l) * Float64(D * D))) / sqrt(l)); else tmp = Float64((Float64(sqrt(l) * sqrt(h)) ^ -1.0) * d); 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);
tmp = 0.0;
if (d <= -7.5e-63)
tmp = ((1.0 * sqrt((d / l))) * t_0) / sqrt(-h);
elseif (d <= -5e-310)
tmp = ((1.0 * sqrt((d / h))) * t_0) / sqrt(-l);
elseif (d <= 1.15e-35)
tmp = ((-0.25 * sqrt(h)) * (((M_m * M_m) / l) * (D * D))) / sqrt(l);
else
tmp = ((sqrt(l) * sqrt(h)) ^ -1.0) * d;
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]}, If[LessEqual[d, -7.5e-63], N[(N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(N[(1.0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e-35], N[(N[(N[(-0.25 * N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * d), $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}\\
\mathbf{if}\;d \leq -7.5 \cdot 10^{-63}:\\
\;\;\;\;\frac{\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_0}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\left(1 \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_0}{\sqrt{-\ell}}\\
\mathbf{elif}\;d \leq 1.15 \cdot 10^{-35}:\\
\;\;\;\;\frac{\left(-0.25 \cdot \sqrt{h}\right) \cdot \left(\frac{M\_m \cdot M\_m}{\ell} \cdot \left(D \cdot D\right)\right)}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\
\end{array}
\end{array}
if d < -7.5000000000000003e-63Initial program 79.2%
Taylor expanded in d around inf
Applied rewrites56.5%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
Applied rewrites68.7%
if -7.5000000000000003e-63 < d < -4.999999999999985e-310Initial program 62.3%
Taylor expanded in d around inf
Applied rewrites34.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
associate-*r*N/A
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
Applied rewrites44.9%
if -4.999999999999985e-310 < d < 1.1499999999999999e-35Initial program 56.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6456.1
Applied rewrites56.1%
Applied rewrites54.3%
Taylor expanded in d around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6443.8
Applied rewrites43.8%
if 1.1499999999999999e-35 < d Initial program 71.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6471.5
Applied rewrites71.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6461.1
Applied rewrites61.1%
Applied rewrites61.0%
Applied rewrites63.8%
Final simplification57.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 (<= h -2.3e-142)
(/ (* (* 1.0 (sqrt (/ d h))) (sqrt (- d))) (sqrt (- l)))
(if (<= h -2e-310)
(* (- d) (sqrt (pow (* l h) -1.0)))
(* (pow (* (sqrt l) (sqrt h)) -1.0) d))))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 (h <= -2.3e-142) {
tmp = ((1.0 * sqrt((d / h))) * sqrt(-d)) / sqrt(-l);
} else if (h <= -2e-310) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = pow((sqrt(l) * sqrt(h)), -1.0) * d;
}
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 (h <= (-2.3d-142)) then
tmp = ((1.0d0 * sqrt((d / h))) * sqrt(-d)) / sqrt(-l)
else if (h <= (-2d-310)) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else
tmp = ((sqrt(l) * sqrt(h)) ** (-1.0d0)) * d
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 (h <= -2.3e-142) {
tmp = ((1.0 * Math.sqrt((d / h))) * Math.sqrt(-d)) / Math.sqrt(-l);
} else if (h <= -2e-310) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else {
tmp = Math.pow((Math.sqrt(l) * Math.sqrt(h)), -1.0) * d;
}
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 h <= -2.3e-142: tmp = ((1.0 * math.sqrt((d / h))) * math.sqrt(-d)) / math.sqrt(-l) elif h <= -2e-310: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) else: tmp = math.pow((math.sqrt(l) * math.sqrt(h)), -1.0) * d 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 (h <= -2.3e-142) tmp = Float64(Float64(Float64(1.0 * sqrt(Float64(d / h))) * sqrt(Float64(-d))) / sqrt(Float64(-l))); elseif (h <= -2e-310) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64((Float64(sqrt(l) * sqrt(h)) ^ -1.0) * d); 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 (h <= -2.3e-142)
tmp = ((1.0 * sqrt((d / h))) * sqrt(-d)) / sqrt(-l);
elseif (h <= -2e-310)
tmp = -d * sqrt(((l * h) ^ -1.0));
else
tmp = ((sqrt(l) * sqrt(h)) ^ -1.0) * d;
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[h, -2.3e-142], N[(N[(N[(1.0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * d), $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}\;h \leq -2.3 \cdot 10^{-142}:\\
\;\;\;\;\frac{\left(1 \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\
\end{array}
\end{array}
if h < -2.30000000000000002e-142Initial program 80.2%
Taylor expanded in d around inf
Applied rewrites50.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
associate-*r*N/A
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
Applied rewrites55.1%
if -2.30000000000000002e-142 < h < -1.999999999999994e-310Initial program 58.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6458.0
Applied rewrites58.0%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6473.4
Applied rewrites73.4%
if -1.999999999999994e-310 < h Initial program 63.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6463.8
Applied rewrites63.8%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6443.5
Applied rewrites43.5%
Applied rewrites43.5%
Applied rewrites46.8%
Final simplification53.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 (<= h -8.2e-144)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= h -2e-310)
(* (- d) (sqrt (pow (* l h) -1.0)))
(* (pow (* (sqrt l) (sqrt h)) -1.0) d))))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 (h <= -8.2e-144) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (h <= -2e-310) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = pow((sqrt(l) * sqrt(h)), -1.0) * d;
}
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 (h <= (-8.2d-144)) then
tmp = sqrt((d / h)) * sqrt((d / l))
else if (h <= (-2d-310)) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else
tmp = ((sqrt(l) * sqrt(h)) ** (-1.0d0)) * d
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 (h <= -8.2e-144) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (h <= -2e-310) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else {
tmp = Math.pow((Math.sqrt(l) * Math.sqrt(h)), -1.0) * d;
}
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 h <= -8.2e-144: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) elif h <= -2e-310: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) else: tmp = math.pow((math.sqrt(l) * math.sqrt(h)), -1.0) * d 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 (h <= -8.2e-144) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (h <= -2e-310) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64((Float64(sqrt(l) * sqrt(h)) ^ -1.0) * d); 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 (h <= -8.2e-144)
tmp = sqrt((d / h)) * sqrt((d / l));
elseif (h <= -2e-310)
tmp = -d * sqrt(((l * h) ^ -1.0));
else
tmp = ((sqrt(l) * sqrt(h)) ^ -1.0) * d;
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[h, -8.2e-144], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * d), $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}\;h \leq -8.2 \cdot 10^{-144}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\
\end{array}
\end{array}
if h < -8.2e-144Initial program 80.4%
Applied rewrites46.1%
Applied rewrites81.4%
Applied rewrites81.4%
Taylor expanded in d around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
lower-sqrt.f64N/A
lower-/.f6450.6
Applied rewrites50.6%
if -8.2e-144 < h < -1.999999999999994e-310Initial program 57.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6457.0
Applied rewrites57.0%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6472.8
Applied rewrites72.8%
if -1.999999999999994e-310 < h Initial program 63.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6463.8
Applied rewrites63.8%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6443.5
Applied rewrites43.5%
Applied rewrites43.5%
Applied rewrites46.8%
Final simplification52.2%
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 d)) 2.0))
(t_1 (fma (* t_0 (* t_0 (/ -0.5 l))) h 1.0)))
(if (<= h -6.5e-180)
(* (* t_1 (sqrt (/ d h))) (sqrt (/ d l)))
(if (<= h -2e-310)
(* (- d) (sqrt (pow (* l h) -1.0)))
(* t_1 (/ d (sqrt (* 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 t_0 = (M_m * (D / d)) / 2.0;
double t_1 = fma((t_0 * (t_0 * (-0.5 / l))), h, 1.0);
double tmp;
if (h <= -6.5e-180) {
tmp = (t_1 * sqrt((d / h))) * sqrt((d / l));
} else if (h <= -2e-310) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = t_1 * (d / sqrt((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) t_0 = Float64(Float64(M_m * Float64(D / d)) / 2.0) t_1 = fma(Float64(t_0 * Float64(t_0 * Float64(-0.5 / l))), h, 1.0) tmp = 0.0 if (h <= -6.5e-180) tmp = Float64(Float64(t_1 * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); elseif (h <= -2e-310) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64(t_1 * Float64(d / sqrt(Float64(l * h)))); end return 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[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[(t$95$0 * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision]}, If[LessEqual[h, -6.5e-180], N[(N[(t$95$1 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(d / N[Sqrt[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}
t_0 := \frac{M\_m \cdot \frac{D}{d}}{2}\\
t_1 := \mathsf{fma}\left(t\_0 \cdot \left(t\_0 \cdot \frac{-0.5}{\ell}\right), h, 1\right)\\
\mathbf{if}\;h \leq -6.5 \cdot 10^{-180}:\\
\;\;\;\;\left(t\_1 \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if h < -6.50000000000000013e-180Initial program 79.1%
Applied rewrites45.3%
Applied rewrites80.0%
Applied rewrites80.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-eval80.2
Applied rewrites80.2%
if -6.50000000000000013e-180 < h < -1.999999999999994e-310Initial program 50.6%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6450.6
Applied rewrites50.6%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6481.6
Applied rewrites81.6%
if -1.999999999999994e-310 < h Initial program 63.8%
Applied rewrites59.0%
Applied rewrites67.2%
Applied rewrites79.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-eval80.9
Applied rewrites80.9%
Final simplification80.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 (if (<= d 6.6e-164) (* (- d) (sqrt (pow (* l h) -1.0))) (* (pow (* (sqrt l) (sqrt h)) -1.0) d)))
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 <= 6.6e-164) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = pow((sqrt(l) * sqrt(h)), -1.0) * d;
}
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 <= 6.6d-164) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else
tmp = ((sqrt(l) * sqrt(h)) ** (-1.0d0)) * d
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 <= 6.6e-164) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else {
tmp = Math.pow((Math.sqrt(l) * Math.sqrt(h)), -1.0) * d;
}
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 <= 6.6e-164: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) else: tmp = math.pow((math.sqrt(l) * math.sqrt(h)), -1.0) * d 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 <= 6.6e-164) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64((Float64(sqrt(l) * sqrt(h)) ^ -1.0) * d); 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 <= 6.6e-164)
tmp = -d * sqrt(((l * h) ^ -1.0));
else
tmp = ((sqrt(l) * sqrt(h)) ^ -1.0) * d;
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, 6.6e-164], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * d), $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 6.6 \cdot 10^{-164}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\
\end{array}
\end{array}
if d < 6.6e-164Initial program 69.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6469.5
Applied rewrites69.5%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.4
Applied rewrites46.4%
if 6.6e-164 < d Initial program 67.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6467.0
Applied rewrites67.0%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6448.9
Applied rewrites48.9%
Applied rewrites48.9%
Applied rewrites53.1%
Final simplification49.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 (sqrt (- d)))
(t_1 (/ (* M_m (/ D d)) 2.0))
(t_2 (sqrt (/ d h)))
(t_3 (sqrt (/ d l))))
(if (<= l -1.06e-137)
(/ (* (* 1.0 t_3) t_0) (sqrt (- h)))
(if (<= l -4.6e-202)
(*
(* (* (* -0.125 (/ (/ (* D D) d) d)) (* h (/ (* M_m M_m) l))) t_2)
t_3)
(if (<= l -1e-309)
(/ (* (* 1.0 t_2) t_0) (sqrt (- l)))
(* (fma (* t_1 (* t_1 (/ -0.5 l))) h 1.0) (/ d (sqrt (* 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 t_0 = sqrt(-d);
double t_1 = (M_m * (D / d)) / 2.0;
double t_2 = sqrt((d / h));
double t_3 = sqrt((d / l));
double tmp;
if (l <= -1.06e-137) {
tmp = ((1.0 * t_3) * t_0) / sqrt(-h);
} else if (l <= -4.6e-202) {
tmp = (((-0.125 * (((D * D) / d) / d)) * (h * ((M_m * M_m) / l))) * t_2) * t_3;
} else if (l <= -1e-309) {
tmp = ((1.0 * t_2) * t_0) / sqrt(-l);
} else {
tmp = fma((t_1 * (t_1 * (-0.5 / l))), h, 1.0) * (d / sqrt((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) t_0 = sqrt(Float64(-d)) t_1 = Float64(Float64(M_m * Float64(D / d)) / 2.0) t_2 = sqrt(Float64(d / h)) t_3 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -1.06e-137) tmp = Float64(Float64(Float64(1.0 * t_3) * t_0) / sqrt(Float64(-h))); elseif (l <= -4.6e-202) tmp = Float64(Float64(Float64(Float64(-0.125 * Float64(Float64(Float64(D * D) / d) / d)) * Float64(h * Float64(Float64(M_m * M_m) / l))) * t_2) * t_3); elseif (l <= -1e-309) tmp = Float64(Float64(Float64(1.0 * t_2) * t_0) / sqrt(Float64(-l))); else tmp = Float64(fma(Float64(t_1 * Float64(t_1 * Float64(-0.5 / l))), h, 1.0) * Float64(d / sqrt(Float64(l * h)))); end return 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[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.06e-137], N[(N[(N[(1.0 * t$95$3), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4.6e-202], N[(N[(N[(N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[l, -1e-309], N[(N[(N[(1.0 * t$95$2), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 * N[(t$95$1 * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[(d / N[Sqrt[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}
t_0 := \sqrt{-d}\\
t_1 := \frac{M\_m \cdot \frac{D}{d}}{2}\\
t_2 := \sqrt{\frac{d}{h}}\\
t_3 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -1.06 \cdot 10^{-137}:\\
\;\;\;\;\frac{\left(1 \cdot t\_3\right) \cdot t\_0}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq -4.6 \cdot 10^{-202}:\\
\;\;\;\;\left(\left(\left(-0.125 \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \cdot \left(h \cdot \frac{M\_m \cdot M\_m}{\ell}\right)\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{\left(1 \cdot t\_2\right) \cdot t\_0}{\sqrt{-\ell}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1 \cdot \left(t\_1 \cdot \frac{-0.5}{\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if l < -1.06000000000000005e-137Initial program 69.2%
Taylor expanded in d around inf
Applied rewrites56.3%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
Applied rewrites67.6%
if -1.06000000000000005e-137 < l < -4.5999999999999997e-202Initial program 76.6%
Applied rewrites12.1%
Applied rewrites81.8%
Applied rewrites81.8%
Taylor expanded in d around 0
times-fracN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6453.1
Applied rewrites53.1%
if -4.5999999999999997e-202 < l < -1.000000000000002e-309Initial program 86.4%
Taylor expanded in d around inf
Applied rewrites45.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
associate-*r*N/A
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
Applied rewrites50.1%
if -1.000000000000002e-309 < l Initial program 63.8%
Applied rewrites59.0%
Applied rewrites67.2%
Applied rewrites79.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-eval80.9
Applied rewrites80.9%
Final simplification71.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 (sqrt (pow (* l h) -1.0)))) (if (<= d -6.2e-259) (* (- d) t_0) (* t_0 d))))
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(pow((l * h), -1.0));
double tmp;
if (d <= -6.2e-259) {
tmp = -d * t_0;
} else {
tmp = t_0 * d;
}
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(((l * h) ** (-1.0d0)))
if (d <= (-6.2d-259)) then
tmp = -d * t_0
else
tmp = t_0 * d
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(Math.pow((l * h), -1.0));
double tmp;
if (d <= -6.2e-259) {
tmp = -d * t_0;
} else {
tmp = t_0 * d;
}
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(math.pow((l * h), -1.0)) tmp = 0 if d <= -6.2e-259: tmp = -d * t_0 else: tmp = t_0 * d 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(l * h) ^ -1.0)) tmp = 0.0 if (d <= -6.2e-259) tmp = Float64(Float64(-d) * t_0); else tmp = Float64(t_0 * d); 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(((l * h) ^ -1.0));
tmp = 0.0;
if (d <= -6.2e-259)
tmp = -d * t_0;
else
tmp = t_0 * d;
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[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -6.2e-259], N[((-d) * t$95$0), $MachinePrecision], N[(t$95$0 * d), $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{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{if}\;d \leq -6.2 \cdot 10^{-259}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot d\\
\end{array}
\end{array}
if d < -6.1999999999999995e-259Initial program 73.2%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6473.2
Applied rewrites73.2%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6452.3
Applied rewrites52.3%
if -6.1999999999999995e-259 < d Initial program 64.2%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6464.2
Applied rewrites64.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6444.3
Applied rewrites44.3%
Final simplification48.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
(let* ((t_0 (/ (* M_m (/ D d)) 2.0)) (t_1 (sqrt (/ d l))))
(if (<= d -8e-25)
(/ (* (* 1.0 t_1) (sqrt (- d))) (sqrt (- h)))
(if (<= d -1.15e-280)
(*
(*
(fma (/ (* (* 0.125 (* D D)) (/ (/ (* M_m M_m) d) d)) (- l)) h 1.0)
(sqrt (/ d h)))
t_1)
(* (fma (* t_0 (* t_0 (/ -0.5 l))) h 1.0) (/ d (sqrt (* 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 t_0 = (M_m * (D / d)) / 2.0;
double t_1 = sqrt((d / l));
double tmp;
if (d <= -8e-25) {
tmp = ((1.0 * t_1) * sqrt(-d)) / sqrt(-h);
} else if (d <= -1.15e-280) {
tmp = (fma((((0.125 * (D * D)) * (((M_m * M_m) / d) / d)) / -l), h, 1.0) * sqrt((d / h))) * t_1;
} else {
tmp = fma((t_0 * (t_0 * (-0.5 / l))), h, 1.0) * (d / sqrt((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) t_0 = Float64(Float64(M_m * Float64(D / d)) / 2.0) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -8e-25) tmp = Float64(Float64(Float64(1.0 * t_1) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (d <= -1.15e-280) tmp = Float64(Float64(fma(Float64(Float64(Float64(0.125 * Float64(D * D)) * Float64(Float64(Float64(M_m * M_m) / d) / d)) / Float64(-l)), h, 1.0) * sqrt(Float64(d / h))) * t_1); else tmp = Float64(fma(Float64(t_0 * Float64(t_0 * Float64(-0.5 / l))), h, 1.0) * Float64(d / sqrt(Float64(l * h)))); end return 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[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -8e-25], N[(N[(N[(1.0 * t$95$1), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.15e-280], N[(N[(N[(N[(N[(N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / (-l)), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(t$95$0 * N[(t$95$0 * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[(d / N[Sqrt[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}
t_0 := \frac{M\_m \cdot \frac{D}{d}}{2}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -8 \cdot 10^{-25}:\\
\;\;\;\;\frac{\left(1 \cdot t\_1\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq -1.15 \cdot 10^{-280}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{\frac{M\_m \cdot M\_m}{d}}{d}}{-\ell}, h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot \left(t\_0 \cdot \frac{-0.5}{\ell}\right), h, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if d < -8.00000000000000031e-25Initial program 77.6%
Taylor expanded in d around inf
Applied rewrites59.5%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
Applied rewrites72.7%
if -8.00000000000000031e-25 < d < -1.15e-280Initial program 67.2%
Applied rewrites31.6%
Applied rewrites67.2%
Applied rewrites67.3%
Taylor expanded in d around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6450.0
Applied rewrites50.0%
if -1.15e-280 < d Initial program 63.6%
Applied rewrites58.8%
Applied rewrites66.9%
Applied rewrites78.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-eval80.4
Applied rewrites80.4%
Final simplification72.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 (pow (* l h) -1.0)) d))
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(pow((l * h), -1.0)) * d;
}
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(((l * h) ** (-1.0d0))) * d
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(Math.pow((l * h), -1.0)) * d;
}
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(math.pow((l * h), -1.0)) * d
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 Float64(sqrt((Float64(l * h) ^ -1.0)) * d) 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(((l * h) ^ -1.0)) * d;
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[(N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d
\end{array}
Initial program 68.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6468.5
Applied rewrites68.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6427.8
Applied rewrites27.8%
Final simplification27.8%
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 (/ d (sqrt (* h 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) {
return d / sqrt((h * l));
}
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 = d / sqrt((h * l))
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 d / Math.sqrt((h * l));
}
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 d / math.sqrt((h * l))
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 Float64(d / sqrt(Float64(h * l))) 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 = d / sqrt((h * l));
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[(d / N[Sqrt[N[(h * 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])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 68.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6468.5
Applied rewrites68.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6427.8
Applied rewrites27.8%
Applied rewrites27.1%
Applied rewrites27.1%
herbie shell --seed 2024333
(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)))))