
(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)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
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]
\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)
Herbie found 17 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)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
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]
\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)
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* 0.5 (* D -0.5)))
(t_1
(*
(* (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)))))
(t_2 (* (* M (/ -0.5 d)) D)))
(if (<= t_1 5e+249)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* (* (/ h l) (* t_0 (/ 1.0 (/ d M)))) t_2)))
(if (<= t_1 INFINITY)
(*
(* (fabs d) (sqrt (/ 1.0 (* h l))))
(- 1.0 (* (* (/ h l) (* t_0 (/ M d))) t_2)))
(*
-0.125
(/ (* (pow D 2.0) (pow M 2.0)) (* d (* l (sqrt (/ l h))))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (D * -0.5);
double t_1 = (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 t_2 = (M * (-0.5 / d)) * D;
double tmp;
if (t_1 <= 5e+249) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (((h / l) * (t_0 * (1.0 / (d / M)))) * t_2));
} else if (t_1 <= ((double) INFINITY)) {
tmp = (fabs(d) * sqrt((1.0 / (h * l)))) * (1.0 - (((h / l) * (t_0 * (M / d))) * t_2));
} else {
tmp = -0.125 * ((pow(D, 2.0) * pow(M, 2.0)) / (d * (l * sqrt((l / h)))));
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (D * -0.5);
double t_1 = (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)));
double t_2 = (M * (-0.5 / d)) * D;
double tmp;
if (t_1 <= 5e+249) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (((h / l) * (t_0 * (1.0 / (d / M)))) * t_2));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (Math.abs(d) * Math.sqrt((1.0 / (h * l)))) * (1.0 - (((h / l) * (t_0 * (M / d))) * t_2));
} else {
tmp = -0.125 * ((Math.pow(D, 2.0) * Math.pow(M, 2.0)) / (d * (l * Math.sqrt((l / h)))));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = 0.5 * (D * -0.5) t_1 = (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))) t_2 = (M * (-0.5 / d)) * D tmp = 0 if t_1 <= 5e+249: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (((h / l) * (t_0 * (1.0 / (d / M)))) * t_2)) elif t_1 <= math.inf: tmp = (math.fabs(d) * math.sqrt((1.0 / (h * l)))) * (1.0 - (((h / l) * (t_0 * (M / d))) * t_2)) else: tmp = -0.125 * ((math.pow(D, 2.0) * math.pow(M, 2.0)) / (d * (l * math.sqrt((l / h))))) return tmp
function code(d, h, l, M, D) t_0 = Float64(0.5 * Float64(D * -0.5)) t_1 = 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)))) t_2 = Float64(Float64(M * Float64(-0.5 / d)) * D) tmp = 0.0 if (t_1 <= 5e+249) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(h / l) * Float64(t_0 * Float64(1.0 / Float64(d / M)))) * t_2))); elseif (t_1 <= Inf) tmp = Float64(Float64(abs(d) * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(Float64(h / l) * Float64(t_0 * Float64(M / d))) * t_2))); else tmp = Float64(-0.125 * Float64(Float64((D ^ 2.0) * (M ^ 2.0)) / Float64(d * Float64(l * sqrt(Float64(l / h)))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = 0.5 * (D * -0.5); t_1 = (((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))); t_2 = (M * (-0.5 / d)) * D; tmp = 0.0; if (t_1 <= 5e+249) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (((h / l) * (t_0 * (1.0 / (d / M)))) * t_2)); elseif (t_1 <= Inf) tmp = (abs(d) * sqrt((1.0 / (h * l)))) * (1.0 - (((h / l) * (t_0 * (M / d))) * t_2)); else tmp = -0.125 * (((D ^ 2.0) * (M ^ 2.0)) / (d * (l * sqrt((l / h))))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(0.5 * N[(D * -0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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]}, Block[{t$95$2 = N[(N[(M * N[(-0.5 / d), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+249], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(h / l), $MachinePrecision] * N[(t$95$0 * N[(1.0 / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[Abs[d], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(h / l), $MachinePrecision] * N[(t$95$0 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.125 * N[(N[(N[Power[D, 2.0], $MachinePrecision] * N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := 0.5 \cdot \left(D \cdot -0.5\right)\\
t_1 := \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)\\
t_2 := \left(M \cdot \frac{-0.5}{d}\right) \cdot D\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+249}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(\frac{h}{\ell} \cdot \left(t\_0 \cdot \frac{1}{\frac{d}{M}}\right)\right) \cdot t\_2\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\left(\left|d\right| \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \left(\frac{h}{\ell} \cdot \left(t\_0 \cdot \frac{M}{d}\right)\right) \cdot t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d \cdot \left(\ell \cdot \sqrt{\frac{\ell}{h}}\right)}\\
\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.9999999999999996e249Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval66.4%
Applied rewrites66.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites67.2%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6467.1%
Applied rewrites67.1%
if 4.9999999999999996e249 < (*.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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval66.4%
Applied rewrites66.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites67.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
times-fracN/A
lift-*.f64N/A
lift-*.f64N/A
mult-flipN/A
sqrt-prodN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-*.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f6471.4%
Applied rewrites71.4%
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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6426.6%
Applied rewrites26.6%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6432.5%
Applied rewrites32.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(-
1.0
(*
(* (/ h l) (* (* 0.5 (* D -0.5)) (/ M d)))
(* (* M (/ -0.5 d)) D))))
(t_1
(*
(* (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))))))
(if (<= t_1 5e+249)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) t_0)
(if (<= t_1 INFINITY)
(* (* (fabs d) (sqrt (/ 1.0 (* h l)))) t_0)
(*
-0.125
(/ (* (pow D 2.0) (pow M 2.0)) (* d (* l (sqrt (/ l h))))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (((h / l) * ((0.5 * (D * -0.5)) * (M / d))) * ((M * (-0.5 / d)) * D));
double t_1 = (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 tmp;
if (t_1 <= 5e+249) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * t_0;
} else if (t_1 <= ((double) INFINITY)) {
tmp = (fabs(d) * sqrt((1.0 / (h * l)))) * t_0;
} else {
tmp = -0.125 * ((pow(D, 2.0) * pow(M, 2.0)) / (d * (l * sqrt((l / h)))));
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (((h / l) * ((0.5 * (D * -0.5)) * (M / d))) * ((M * (-0.5 / d)) * D));
double t_1 = (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)));
double tmp;
if (t_1 <= 5e+249) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * t_0;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (Math.abs(d) * Math.sqrt((1.0 / (h * l)))) * t_0;
} else {
tmp = -0.125 * ((Math.pow(D, 2.0) * Math.pow(M, 2.0)) / (d * (l * Math.sqrt((l / h)))));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = 1.0 - (((h / l) * ((0.5 * (D * -0.5)) * (M / d))) * ((M * (-0.5 / d)) * D)) t_1 = (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))) tmp = 0 if t_1 <= 5e+249: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * t_0 elif t_1 <= math.inf: tmp = (math.fabs(d) * math.sqrt((1.0 / (h * l)))) * t_0 else: tmp = -0.125 * ((math.pow(D, 2.0) * math.pow(M, 2.0)) / (d * (l * math.sqrt((l / h))))) return tmp
function code(d, h, l, M, D) t_0 = Float64(1.0 - Float64(Float64(Float64(h / l) * Float64(Float64(0.5 * Float64(D * -0.5)) * Float64(M / d))) * Float64(Float64(M * Float64(-0.5 / d)) * D))) t_1 = 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)))) tmp = 0.0 if (t_1 <= 5e+249) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * t_0); elseif (t_1 <= Inf) tmp = Float64(Float64(abs(d) * sqrt(Float64(1.0 / Float64(h * l)))) * t_0); else tmp = Float64(-0.125 * Float64(Float64((D ^ 2.0) * (M ^ 2.0)) / Float64(d * Float64(l * sqrt(Float64(l / h)))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = 1.0 - (((h / l) * ((0.5 * (D * -0.5)) * (M / d))) * ((M * (-0.5 / d)) * D)); t_1 = (((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))); tmp = 0.0; if (t_1 <= 5e+249) tmp = (sqrt((d / l)) * sqrt((d / h))) * t_0; elseif (t_1 <= Inf) tmp = (abs(d) * sqrt((1.0 / (h * l)))) * t_0; else tmp = -0.125 * (((D ^ 2.0) * (M ^ 2.0)) / (d * (l * sqrt((l / h))))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 - N[(N[(N[(h / l), $MachinePrecision] * N[(N[(0.5 * N[(D * -0.5), $MachinePrecision]), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(-0.5 / d), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, 5e+249], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[Abs[d], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(-0.125 * N[(N[(N[Power[D, 2.0], $MachinePrecision] * N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := 1 - \left(\frac{h}{\ell} \cdot \left(\left(0.5 \cdot \left(D \cdot -0.5\right)\right) \cdot \frac{M}{d}\right)\right) \cdot \left(\left(M \cdot \frac{-0.5}{d}\right) \cdot D\right)\\
t_1 := \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)\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+249}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_0\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\left(\left|d\right| \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \frac{{D}^{2} \cdot {M}^{2}}{d \cdot \left(\ell \cdot \sqrt{\frac{\ell}{h}}\right)}\\
\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.9999999999999996e249Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval66.4%
Applied rewrites66.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites67.2%
if 4.9999999999999996e249 < (*.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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval66.4%
Applied rewrites66.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites67.2%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
times-fracN/A
lift-*.f64N/A
lift-*.f64N/A
mult-flipN/A
sqrt-prodN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-*.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f6471.4%
Applied rewrites71.4%
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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6426.6%
Applied rewrites26.6%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6432.5%
Applied rewrites32.5%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (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))))
2e+256)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(-
1.0
(*
(* (/ h l) (* (* 0.5 (* D -0.5)) (/ M d)))
(* (* M (/ -0.5 d)) D))))
(* (fabs (/ (- d) (sqrt (* h l)))) 1.0)))double code(double d, double h, double l, double M, double D) {
double tmp;
if (((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)))) <= 2e+256) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (((h / l) * ((0.5 * (D * -0.5)) * (M / d))) * ((M * (-0.5 / d)) * D)));
} else {
tmp = fabs((-d / sqrt((h * l)))) * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((d / 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)))) <= 2d+256) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (((h / l) * ((0.5d0 * (d_1 * (-0.5d0))) * (m / d))) * ((m * ((-0.5d0) / d)) * d_1)))
else
tmp = abs((-d / sqrt((h * l)))) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (((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)))) <= 2e+256) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (((h / l) * ((0.5 * (D * -0.5)) * (M / d))) * ((M * (-0.5 / d)) * D)));
} else {
tmp = Math.abs((-d / Math.sqrt((h * l)))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if ((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)))) <= 2e+256: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (((h / l) * ((0.5 * (D * -0.5)) * (M / d))) * ((M * (-0.5 / d)) * D))) else: tmp = math.fabs((-d / math.sqrt((h * l)))) * 1.0 return tmp
function code(d, h, l, M, D) tmp = 0.0 if (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)))) <= 2e+256) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(h / l) * Float64(Float64(0.5 * Float64(D * -0.5)) * Float64(M / d))) * Float64(Float64(M * Float64(-0.5 / d)) * D)))); else tmp = Float64(abs(Float64(Float64(-d) / sqrt(Float64(h * l)))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (((((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)))) <= 2e+256) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (((h / l) * ((0.5 * (D * -0.5)) * (M / d))) * ((M * (-0.5 / d)) * D))); else tmp = abs((-d / sqrt((h * l)))) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[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], 2e+256], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(h / l), $MachinePrecision] * N[(N[(0.5 * N[(D * -0.5), $MachinePrecision]), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(-0.5 / d), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\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) \leq 2 \cdot 10^{+256}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(\frac{h}{\ell} \cdot \left(\left(0.5 \cdot \left(D \cdot -0.5\right)\right) \cdot \frac{M}{d}\right)\right) \cdot \left(\left(M \cdot \frac{-0.5}{d}\right) \cdot D\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{h \cdot \ell}}\right| \cdot 1\\
\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.0000000000000001e256Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval66.4%
Applied rewrites66.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites67.2%
if 2.0000000000000001e256 < (*.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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6429.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites43.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin (fabs M) (fabs D))) (t_1 (fmax (fabs M) (fabs D))))
(if (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(*
(* (/ 1.0 2.0) (pow (/ (* t_0 t_1) (* 2.0 d)) 2.0))
(/ h l))))
2e+256)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(-
1.0
(*
(* (* (/ h l) (/ t_0 d)) (* -0.25 t_1))
(* (* t_0 (/ -0.5 d)) t_1))))
(* (fabs (/ (- d) (sqrt (* h l)))) 1.0))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(fabs(M), fabs(D));
double t_1 = fmax(fabs(M), fabs(D));
double tmp;
if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((t_0 * t_1) / (2.0 * d)), 2.0)) * (h / l)))) <= 2e+256) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((((h / l) * (t_0 / d)) * (-0.25 * t_1)) * ((t_0 * (-0.5 / d)) * t_1)));
} else {
tmp = fabs((-d / sqrt((h * l)))) * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = fmin(abs(m), abs(d_1))
t_1 = fmax(abs(m), abs(d_1))
if (((((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((t_0 * t_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= 2d+256) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((((h / l) * (t_0 / d)) * ((-0.25d0) * t_1)) * ((t_0 * ((-0.5d0) / d)) * t_1)))
else
tmp = abs((-d / sqrt((h * l)))) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(Math.abs(M), Math.abs(D));
double t_1 = fmax(Math.abs(M), Math.abs(D));
double tmp;
if (((Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((t_0 * t_1) / (2.0 * d)), 2.0)) * (h / l)))) <= 2e+256) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((((h / l) * (t_0 / d)) * (-0.25 * t_1)) * ((t_0 * (-0.5 / d)) * t_1)));
} else {
tmp = Math.abs((-d / Math.sqrt((h * l)))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = fmin(math.fabs(M), math.fabs(D)) t_1 = fmax(math.fabs(M), math.fabs(D)) tmp = 0 if ((math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((t_0 * t_1) / (2.0 * d)), 2.0)) * (h / l)))) <= 2e+256: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((((h / l) * (t_0 / d)) * (-0.25 * t_1)) * ((t_0 * (-0.5 / d)) * t_1))) else: tmp = math.fabs((-d / math.sqrt((h * l)))) * 1.0 return tmp
function code(d, h, l, M, D) t_0 = fmin(abs(M), abs(D)) t_1 = fmax(abs(M), abs(D)) tmp = 0.0 if (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(t_0 * t_1) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 2e+256) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(Float64(h / l) * Float64(t_0 / d)) * Float64(-0.25 * t_1)) * Float64(Float64(t_0 * Float64(-0.5 / d)) * t_1)))); else tmp = Float64(abs(Float64(Float64(-d) / sqrt(Float64(h * l)))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = min(abs(M), abs(D)); t_1 = max(abs(M), abs(D)); tmp = 0.0; if (((((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((t_0 * t_1) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= 2e+256) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((((h / l) * (t_0 / d)) * (-0.25 * t_1)) * ((t_0 * (-0.5 / d)) * t_1))); else tmp = abs((-d / sqrt((h * l)))) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[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[(t$95$0 * t$95$1), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+256], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(h / l), $MachinePrecision] * N[(t$95$0 / d), $MachinePrecision]), $MachinePrecision] * N[(-0.25 * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 * N[(-0.5 / d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
\mathbf{if}\;\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{t\_0 \cdot t\_1}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 2 \cdot 10^{+256}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{t\_0}{d}\right) \cdot \left(-0.25 \cdot t\_1\right)\right) \cdot \left(\left(t\_0 \cdot \frac{-0.5}{d}\right) \cdot t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{h \cdot \ell}}\right| \cdot 1\\
\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.0000000000000001e256Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval66.4%
Applied rewrites66.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites67.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6466.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
metadata-eval66.1%
Applied rewrites66.1%
if 2.0000000000000001e256 < (*.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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6429.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites43.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* h l)))
(t_1
(*
(* (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))))))
(if (<= t_1 0.0)
(*
(/ (fabs d) t_0)
(-
1.0
(*
(* (/ h l) (* (* 0.5 (* D -0.5)) (/ M d)))
(* (* M (/ -0.5 d)) D))))
(if (<= t_1 2e+256)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(* (fabs (/ (- d) t_0)) 1.0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double t_1 = (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 tmp;
if (t_1 <= 0.0) {
tmp = (fabs(d) / t_0) * (1.0 - (((h / l) * ((0.5 * (D * -0.5)) * (M / d))) * ((M * (-0.5 / d)) * D)));
} else if (t_1 <= 2e+256) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = fabs((-d / t_0)) * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((h * l))
t_1 = (((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)))
if (t_1 <= 0.0d0) then
tmp = (abs(d) / t_0) * (1.0d0 - (((h / l) * ((0.5d0 * (d_1 * (-0.5d0))) * (m / d))) * ((m * ((-0.5d0) / d)) * d_1)))
else if (t_1 <= 2d+256) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
else
tmp = abs((-d / t_0)) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h * l));
double t_1 = (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)));
double tmp;
if (t_1 <= 0.0) {
tmp = (Math.abs(d) / t_0) * (1.0 - (((h / l) * ((0.5 * (D * -0.5)) * (M / d))) * ((M * (-0.5 / d)) * D)));
} else if (t_1 <= 2e+256) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
} else {
tmp = Math.abs((-d / t_0)) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((h * l)) t_1 = (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))) tmp = 0 if t_1 <= 0.0: tmp = (math.fabs(d) / t_0) * (1.0 - (((h / l) * ((0.5 * (D * -0.5)) * (M / d))) * ((M * (-0.5 / d)) * D))) elif t_1 <= 2e+256: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 else: tmp = math.fabs((-d / t_0)) * 1.0 return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) t_1 = 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)))) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(Float64(abs(d) / t_0) * Float64(1.0 - Float64(Float64(Float64(h / l) * Float64(Float64(0.5 * Float64(D * -0.5)) * Float64(M / d))) * Float64(Float64(M * Float64(-0.5 / d)) * D)))); elseif (t_1 <= 2e+256) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = Float64(abs(Float64(Float64(-d) / t_0)) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((h * l)); t_1 = (((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))); tmp = 0.0; if (t_1 <= 0.0) tmp = (abs(d) / t_0) * (1.0 - (((h / l) * ((0.5 * (D * -0.5)) * (M / d))) * ((M * (-0.5 / d)) * D))); elseif (t_1 <= 2e+256) tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; else tmp = abs((-d / t_0)) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, 0.0], N[(N[(N[Abs[d], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(h / l), $MachinePrecision] * N[(N[(0.5 * N[(D * -0.5), $MachinePrecision]), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(-0.5 / d), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+256], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Abs[N[((-d) / t$95$0), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
t_1 := \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)\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\left|d\right|}{t\_0} \cdot \left(1 - \left(\frac{h}{\ell} \cdot \left(\left(0.5 \cdot \left(D \cdot -0.5\right)\right) \cdot \frac{M}{d}\right)\right) \cdot \left(\left(M \cdot \frac{-0.5}{d}\right) \cdot D\right)\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+256}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{t\_0}\right| \cdot 1\\
\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)))) < 0.0Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval66.4%
Applied rewrites66.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites67.2%
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f64N/A
sqrt-prodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-fabs.f6471.5%
Applied rewrites71.5%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.0000000000000001e256Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
if 2.0000000000000001e256 < (*.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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6429.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites43.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (fabs (/ (- d) (sqrt (* h l)))) 1.0))
(t_1 (* (fmin M D) (fmax M D)))
(t_2
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ t_1 (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_2 -5e-267)
(*
(fma
-0.5
(*
(/ h (* l d))
(/ (* (* (* t_1 (fmin M D)) (fmax M D)) 0.25) d))
1.0)
(sqrt (* d (/ d (* h l)))))
(if (<= t_2 0.0)
t_0
(if (<= t_2 2e+256)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
t_0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = fabs((-d / sqrt((h * l)))) * 1.0;
double t_1 = fmin(M, D) * fmax(M, D);
double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow((t_1 / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_2 <= -5e-267) {
tmp = fma(-0.5, ((h / (l * d)) * ((((t_1 * fmin(M, D)) * fmax(M, D)) * 0.25) / d)), 1.0) * sqrt((d * (d / (h * l))));
} else if (t_2 <= 0.0) {
tmp = t_0;
} else if (t_2 <= 2e+256) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = t_0;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(abs(Float64(Float64(-d) / sqrt(Float64(h * l)))) * 1.0) t_1 = Float64(fmin(M, D) * fmax(M, D)) t_2 = 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(t_1 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_2 <= -5e-267) tmp = Float64(fma(-0.5, Float64(Float64(h / Float64(l * d)) * Float64(Float64(Float64(Float64(t_1 * fmin(M, D)) * fmax(M, D)) * 0.25) / d)), 1.0) * sqrt(Float64(d * Float64(d / Float64(h * l))))); elseif (t_2 <= 0.0) tmp = t_0; elseif (t_2 <= 2e+256) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = t_0; end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Abs[N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[Min[M, D], $MachinePrecision] * N[Max[M, D], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = 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[(t$95$1 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-267], N[(N[(-0.5 * N[(N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(t$95$1 * N[Min[M, D], $MachinePrecision]), $MachinePrecision] * N[Max[M, D], $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d * N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], t$95$0, If[LessEqual[t$95$2, 2e+256], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
t_0 := \left|\frac{-d}{\sqrt{h \cdot \ell}}\right| \cdot 1\\
t_1 := \mathsf{min}\left(M, D\right) \cdot \mathsf{max}\left(M, D\right)\\
t_2 := \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{t\_1}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-267}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \frac{h}{\ell \cdot d} \cdot \frac{\left(\left(t\_1 \cdot \mathsf{min}\left(M, D\right)\right) \cdot \mathsf{max}\left(M, D\right)\right) \cdot 0.25}{d}, 1\right) \cdot \sqrt{d \cdot \frac{d}{h \cdot \ell}}\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+256}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\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.9999999999999999e-267Initial program 66.4%
Applied rewrites35.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6440.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6440.5%
Applied rewrites40.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6447.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6447.7%
Applied rewrites47.7%
if -4.9999999999999999e-267 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.0000000000000001e256 < (*.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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6429.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites43.9%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.0000000000000001e256Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* h l)))
(t_1 (* (fabs (/ (- d) t_0)) 1.0))
(t_2 (fmin (fabs M) (fabs D)))
(t_3 (fmax (fabs M) (fabs D)))
(t_4
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(*
(* (/ 1.0 2.0) (pow (/ (* t_2 t_3) (* 2.0 d)) 2.0))
(/ h l))))))
(if (<= t_4 -5e+16)
(*
(fma
(* (* (* 0.25 (* (* t_3 t_3) h)) t_2) (/ t_2 (* (* d d) l)))
-0.5
1.0)
(/ (fabs d) t_0))
(if (<= t_4 0.0)
t_1
(if (<= t_4 2e+256)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
t_1)))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double t_1 = fabs((-d / t_0)) * 1.0;
double t_2 = fmin(fabs(M), fabs(D));
double t_3 = fmax(fabs(M), fabs(D));
double t_4 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((t_2 * t_3) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_4 <= -5e+16) {
tmp = fma((((0.25 * ((t_3 * t_3) * h)) * t_2) * (t_2 / ((d * d) * l))), -0.5, 1.0) * (fabs(d) / t_0);
} else if (t_4 <= 0.0) {
tmp = t_1;
} else if (t_4 <= 2e+256) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) t_1 = Float64(abs(Float64(Float64(-d) / t_0)) * 1.0) t_2 = fmin(abs(M), abs(D)) t_3 = fmax(abs(M), abs(D)) t_4 = 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(t_2 * t_3) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_4 <= -5e+16) tmp = Float64(fma(Float64(Float64(Float64(0.25 * Float64(Float64(t_3 * t_3) * h)) * t_2) * Float64(t_2 / Float64(Float64(d * d) * l))), -0.5, 1.0) * Float64(abs(d) / t_0)); elseif (t_4 <= 0.0) tmp = t_1; elseif (t_4 <= 2e+256) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = t_1; end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[N[((-d) / t$95$0), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = 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[(t$95$2 * t$95$3), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -5e+16], N[(N[(N[(N[(N[(0.25 * N[(N[(t$95$3 * t$95$3), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(t$95$2 / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.0], t$95$1, If[LessEqual[t$95$4, 2e+256], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
t_1 := \left|\frac{-d}{t\_0}\right| \cdot 1\\
t_2 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_3 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_4 := \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{t\_2 \cdot t\_3}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_4 \leq -5 \cdot 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(0.25 \cdot \left(\left(t\_3 \cdot t\_3\right) \cdot h\right)\right) \cdot t\_2\right) \cdot \frac{t\_2}{\left(d \cdot d\right) \cdot \ell}, -0.5, 1\right) \cdot \frac{\left|d\right|}{t\_0}\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+256}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\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)))) < -5e16Initial program 66.4%
Applied rewrites35.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6436.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6435.8%
Applied rewrites35.8%
Applied rewrites55.1%
if -5e16 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.0000000000000001e256 < (*.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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6429.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites43.9%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.0000000000000001e256Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (fmin M D) (fmax M D)))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ t_0 (* 2.0 d)) 2.0)) (/ h l)))))
(t_2 (/ (- d) (sqrt (* h l))))
(t_3 (* (fabs t_2) 1.0)))
(if (<= t_1 -5e-66)
(*
(fma
-0.5
(/
(* (* (* t_0 (fmin M D)) (fmax M D)) h)
(* (* 4.0 (* d d)) l))
1.0)
t_2)
(if (<= t_1 0.0)
t_3
(if (<= t_1 2e+256)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
t_3)))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(M, D) * fmax(M, D);
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow((t_0 / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = -d / sqrt((h * l));
double t_3 = fabs(t_2) * 1.0;
double tmp;
if (t_1 <= -5e-66) {
tmp = fma(-0.5, ((((t_0 * fmin(M, D)) * fmax(M, D)) * h) / ((4.0 * (d * d)) * l)), 1.0) * t_2;
} else if (t_1 <= 0.0) {
tmp = t_3;
} else if (t_1 <= 2e+256) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = t_3;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(fmin(M, D) * fmax(M, D)) t_1 = 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(t_0 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_2 = Float64(Float64(-d) / sqrt(Float64(h * l))) t_3 = Float64(abs(t_2) * 1.0) tmp = 0.0 if (t_1 <= -5e-66) tmp = Float64(fma(-0.5, Float64(Float64(Float64(Float64(t_0 * fmin(M, D)) * fmax(M, D)) * h) / Float64(Float64(4.0 * Float64(d * d)) * l)), 1.0) * t_2); elseif (t_1 <= 0.0) tmp = t_3; elseif (t_1 <= 2e+256) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = t_3; end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Min[M, D], $MachinePrecision] * N[Max[M, D], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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[(t$95$0 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Abs[t$95$2], $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-66], N[(N[(-0.5 * N[(N[(N[(N[(t$95$0 * N[Min[M, D], $MachinePrecision]), $MachinePrecision] * N[Max[M, D], $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / N[(N[(4.0 * N[(d * d), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$3, If[LessEqual[t$95$1, 2e+256], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$3]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(M, D\right) \cdot \mathsf{max}\left(M, D\right)\\
t_1 := \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{t\_0}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := \frac{-d}{\sqrt{h \cdot \ell}}\\
t_3 := \left|t\_2\right| \cdot 1\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-66}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \frac{\left(\left(t\_0 \cdot \mathsf{min}\left(M, D\right)\right) \cdot \mathsf{max}\left(M, D\right)\right) \cdot h}{\left(4 \cdot \left(d \cdot d\right)\right) \cdot \ell}, 1\right) \cdot t\_2\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+256}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\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.9999999999999996e-66Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
lift-/.f64N/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval66.4%
Applied rewrites66.4%
Applied rewrites30.3%
if -4.9999999999999996e-66 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.0000000000000001e256 < (*.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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6429.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites43.9%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.0000000000000001e256Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (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)))))
(t_1 (* (fabs (/ (- d) (sqrt (* h l)))) 1.0)))
(if (<= t_0 -5e-267)
(*
(*
(* -1.0 (* d (sqrt (/ 1.0 (* d l)))))
(* d (sqrt (/ 1.0 (* d h)))))
1.0)
(if (<= t_0 0.0)
t_1
(if (<= t_0 2e+256)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
t_1)))))double code(double d, double h, double l, double M, double D) {
double t_0 = (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 t_1 = fabs((-d / sqrt((h * l)))) * 1.0;
double tmp;
if (t_0 <= -5e-267) {
tmp = ((-1.0 * (d * sqrt((1.0 / (d * l))))) * (d * sqrt((1.0 / (d * h))))) * 1.0;
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+256) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((d / 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)))
t_1 = abs((-d / sqrt((h * l)))) * 1.0d0
if (t_0 <= (-5d-267)) then
tmp = (((-1.0d0) * (d * sqrt((1.0d0 / (d * l))))) * (d * sqrt((1.0d0 / (d * h))))) * 1.0d0
else if (t_0 <= 0.0d0) then
tmp = t_1
else if (t_0 <= 2d+256) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((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)));
double t_1 = Math.abs((-d / Math.sqrt((h * l)))) * 1.0;
double tmp;
if (t_0 <= -5e-267) {
tmp = ((-1.0 * (d * Math.sqrt((1.0 / (d * l))))) * (d * Math.sqrt((1.0 / (d * h))))) * 1.0;
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+256) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (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))) t_1 = math.fabs((-d / math.sqrt((h * l)))) * 1.0 tmp = 0 if t_0 <= -5e-267: tmp = ((-1.0 * (d * math.sqrt((1.0 / (d * l))))) * (d * math.sqrt((1.0 / (d * h))))) * 1.0 elif t_0 <= 0.0: tmp = t_1 elif t_0 <= 2e+256: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 else: tmp = t_1 return tmp
function code(d, h, l, M, D) t_0 = 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)))) t_1 = Float64(abs(Float64(Float64(-d) / sqrt(Float64(h * l)))) * 1.0) tmp = 0.0 if (t_0 <= -5e-267) tmp = Float64(Float64(Float64(-1.0 * Float64(d * sqrt(Float64(1.0 / Float64(d * l))))) * Float64(d * sqrt(Float64(1.0 / Float64(d * h))))) * 1.0); elseif (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 2e+256) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = t_1; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((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))); t_1 = abs((-d / sqrt((h * l)))) * 1.0; tmp = 0.0; if (t_0 <= -5e-267) tmp = ((-1.0 * (d * sqrt((1.0 / (d * l))))) * (d * sqrt((1.0 / (d * h))))) * 1.0; elseif (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 2e+256) tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = 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]}, Block[{t$95$1 = N[(N[Abs[N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-267], N[(N[(N[(-1.0 * N[(d * N[Sqrt[N[(1.0 / N[(d * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Sqrt[N[(1.0 / N[(d * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 2e+256], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
t_0 := \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)\\
t_1 := \left|\frac{-d}{\sqrt{h \cdot \ell}}\right| \cdot 1\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-267}:\\
\;\;\;\;\left(\left(-1 \cdot \left(d \cdot \sqrt{\frac{1}{d \cdot \ell}}\right)\right) \cdot \left(d \cdot \sqrt{\frac{1}{d \cdot h}}\right)\right) \cdot 1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+256}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\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.9999999999999999e-267Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6423.5%
Applied rewrites23.5%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6415.3%
Applied rewrites15.3%
if -4.9999999999999999e-267 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.0000000000000001e256 < (*.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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6429.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites43.9%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.0000000000000001e256Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1
(*
(* (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))))))
(if (<= t_1 0.0)
(* (* (* d (sqrt (/ 1.0 (* d l)))) t_0) 1.0)
(if (<= t_1 2e+256)
(* (* (sqrt (/ d l)) t_0) 1.0)
(* (fabs (/ (- d) (sqrt (* h l)))) 1.0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = (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 tmp;
if (t_1 <= 0.0) {
tmp = ((d * sqrt((1.0 / (d * l)))) * t_0) * 1.0;
} else if (t_1 <= 2e+256) {
tmp = (sqrt((d / l)) * t_0) * 1.0;
} else {
tmp = fabs((-d / sqrt((h * l)))) * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = (((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)))
if (t_1 <= 0.0d0) then
tmp = ((d * sqrt((1.0d0 / (d * l)))) * t_0) * 1.0d0
else if (t_1 <= 2d+256) then
tmp = (sqrt((d / l)) * t_0) * 1.0d0
else
tmp = abs((-d / sqrt((h * l)))) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = (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)));
double tmp;
if (t_1 <= 0.0) {
tmp = ((d * Math.sqrt((1.0 / (d * l)))) * t_0) * 1.0;
} else if (t_1 <= 2e+256) {
tmp = (Math.sqrt((d / l)) * t_0) * 1.0;
} else {
tmp = Math.abs((-d / Math.sqrt((h * l)))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = (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))) tmp = 0 if t_1 <= 0.0: tmp = ((d * math.sqrt((1.0 / (d * l)))) * t_0) * 1.0 elif t_1 <= 2e+256: tmp = (math.sqrt((d / l)) * t_0) * 1.0 else: tmp = math.fabs((-d / math.sqrt((h * l)))) * 1.0 return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = 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)))) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(Float64(Float64(d * sqrt(Float64(1.0 / Float64(d * l)))) * t_0) * 1.0); elseif (t_1 <= 2e+256) tmp = Float64(Float64(sqrt(Float64(d / l)) * t_0) * 1.0); else tmp = Float64(abs(Float64(Float64(-d) / sqrt(Float64(h * l)))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / h)); t_1 = (((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))); tmp = 0.0; if (t_1 <= 0.0) tmp = ((d * sqrt((1.0 / (d * l)))) * t_0) * 1.0; elseif (t_1 <= 2e+256) tmp = (sqrt((d / l)) * t_0) * 1.0; else tmp = abs((-d / sqrt((h * l)))) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, 0.0], N[(N[(N[(d * N[Sqrt[N[(1.0 / N[(d * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$1, 2e+256], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Abs[N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \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)\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\left(\left(d \cdot \sqrt{\frac{1}{d \cdot \ell}}\right) \cdot t\_0\right) \cdot 1\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+256}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t\_0\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{h \cdot \ell}}\right| \cdot 1\\
\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)))) < 0.0Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6423.9%
Applied rewrites23.9%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.0000000000000001e256Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
if 2.0000000000000001e256 < (*.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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6429.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites43.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (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)))))
(t_1 (* (fabs (/ (- d) (sqrt (* h l)))) 1.0)))
(if (<= t_0 -5e-267)
(* (/ (- d) (* h (sqrt (/ l h)))) 1.0)
(if (<= t_0 0.0)
t_1
(if (<= t_0 2e+256)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
t_1)))))double code(double d, double h, double l, double M, double D) {
double t_0 = (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 t_1 = fabs((-d / sqrt((h * l)))) * 1.0;
double tmp;
if (t_0 <= -5e-267) {
tmp = (-d / (h * sqrt((l / h)))) * 1.0;
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+256) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((d / 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)))
t_1 = abs((-d / sqrt((h * l)))) * 1.0d0
if (t_0 <= (-5d-267)) then
tmp = (-d / (h * sqrt((l / h)))) * 1.0d0
else if (t_0 <= 0.0d0) then
tmp = t_1
else if (t_0 <= 2d+256) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((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)));
double t_1 = Math.abs((-d / Math.sqrt((h * l)))) * 1.0;
double tmp;
if (t_0 <= -5e-267) {
tmp = (-d / (h * Math.sqrt((l / h)))) * 1.0;
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+256) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (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))) t_1 = math.fabs((-d / math.sqrt((h * l)))) * 1.0 tmp = 0 if t_0 <= -5e-267: tmp = (-d / (h * math.sqrt((l / h)))) * 1.0 elif t_0 <= 0.0: tmp = t_1 elif t_0 <= 2e+256: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 else: tmp = t_1 return tmp
function code(d, h, l, M, D) t_0 = 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)))) t_1 = Float64(abs(Float64(Float64(-d) / sqrt(Float64(h * l)))) * 1.0) tmp = 0.0 if (t_0 <= -5e-267) tmp = Float64(Float64(Float64(-d) / Float64(h * sqrt(Float64(l / h)))) * 1.0); elseif (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 2e+256) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = t_1; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((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))); t_1 = abs((-d / sqrt((h * l)))) * 1.0; tmp = 0.0; if (t_0 <= -5e-267) tmp = (-d / (h * sqrt((l / h)))) * 1.0; elseif (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 2e+256) tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = 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]}, Block[{t$95$1 = N[(N[Abs[N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-267], N[(N[((-d) / N[(h * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 2e+256], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
t_0 := \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)\\
t_1 := \left|\frac{-d}{\sqrt{h \cdot \ell}}\right| \cdot 1\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-267}:\\
\;\;\;\;\frac{-d}{h \cdot \sqrt{\frac{\ell}{h}}} \cdot 1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+256}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\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.9999999999999999e-267Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6426.6%
Applied rewrites26.6%
Taylor expanded in h around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6412.4%
Applied rewrites12.4%
if -4.9999999999999999e-267 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.0000000000000001e256 < (*.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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6429.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites43.9%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.0000000000000001e256Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (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))))))
(if (<= t_0 -5e-267)
(* (/ (- d) (* h (sqrt (/ l h)))) 1.0)
(if (<= t_0 2e+256)
(* (/ d (* l (sqrt (/ h l)))) 1.0)
(* (fabs (/ (- d) (sqrt (* h l)))) 1.0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = (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 tmp;
if (t_0 <= -5e-267) {
tmp = (-d / (h * sqrt((l / h)))) * 1.0;
} else if (t_0 <= 2e+256) {
tmp = (d / (l * sqrt((h / l)))) * 1.0;
} else {
tmp = fabs((-d / sqrt((h * l)))) * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (((d / 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)))
if (t_0 <= (-5d-267)) then
tmp = (-d / (h * sqrt((l / h)))) * 1.0d0
else if (t_0 <= 2d+256) then
tmp = (d / (l * sqrt((h / l)))) * 1.0d0
else
tmp = abs((-d / sqrt((h * l)))) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((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)));
double tmp;
if (t_0 <= -5e-267) {
tmp = (-d / (h * Math.sqrt((l / h)))) * 1.0;
} else if (t_0 <= 2e+256) {
tmp = (d / (l * Math.sqrt((h / l)))) * 1.0;
} else {
tmp = Math.abs((-d / Math.sqrt((h * l)))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (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))) tmp = 0 if t_0 <= -5e-267: tmp = (-d / (h * math.sqrt((l / h)))) * 1.0 elif t_0 <= 2e+256: tmp = (d / (l * math.sqrt((h / l)))) * 1.0 else: tmp = math.fabs((-d / math.sqrt((h * l)))) * 1.0 return tmp
function code(d, h, l, M, D) t_0 = 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)))) tmp = 0.0 if (t_0 <= -5e-267) tmp = Float64(Float64(Float64(-d) / Float64(h * sqrt(Float64(l / h)))) * 1.0); elseif (t_0 <= 2e+256) tmp = Float64(Float64(d / Float64(l * sqrt(Float64(h / l)))) * 1.0); else tmp = Float64(abs(Float64(Float64(-d) / sqrt(Float64(h * l)))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((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))); tmp = 0.0; if (t_0 <= -5e-267) tmp = (-d / (h * sqrt((l / h)))) * 1.0; elseif (t_0 <= 2e+256) tmp = (d / (l * sqrt((h / l)))) * 1.0; else tmp = abs((-d / sqrt((h * l)))) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, -5e-267], N[(N[((-d) / N[(h * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$0, 2e+256], N[(N[(d / N[(l * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Abs[N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \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)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-267}:\\
\;\;\;\;\frac{-d}{h \cdot \sqrt{\frac{\ell}{h}}} \cdot 1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+256}:\\
\;\;\;\;\frac{d}{\ell \cdot \sqrt{\frac{h}{\ell}}} \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{h \cdot \ell}}\right| \cdot 1\\
\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.9999999999999999e-267Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6426.6%
Applied rewrites26.6%
Taylor expanded in h around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6412.4%
Applied rewrites12.4%
if -4.9999999999999999e-267 < (*.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.0000000000000001e256Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6426.6%
Applied rewrites26.6%
Taylor expanded in l around -inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6440.3%
Applied rewrites40.3%
if 2.0000000000000001e256 < (*.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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6429.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites43.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* h l)))
(t_1
(*
(* (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))))))
(if (<= t_1 -5e-267)
(* (- d) (/ 1.0 t_0))
(if (<= t_1 2e+256)
(* (/ d (* l (sqrt (/ h l)))) 1.0)
(* (fabs (/ (- d) t_0)) 1.0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double t_1 = (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 tmp;
if (t_1 <= -5e-267) {
tmp = -d * (1.0 / t_0);
} else if (t_1 <= 2e+256) {
tmp = (d / (l * sqrt((h / l)))) * 1.0;
} else {
tmp = fabs((-d / t_0)) * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((h * l))
t_1 = (((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)))
if (t_1 <= (-5d-267)) then
tmp = -d * (1.0d0 / t_0)
else if (t_1 <= 2d+256) then
tmp = (d / (l * sqrt((h / l)))) * 1.0d0
else
tmp = abs((-d / t_0)) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h * l));
double t_1 = (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)));
double tmp;
if (t_1 <= -5e-267) {
tmp = -d * (1.0 / t_0);
} else if (t_1 <= 2e+256) {
tmp = (d / (l * Math.sqrt((h / l)))) * 1.0;
} else {
tmp = Math.abs((-d / t_0)) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((h * l)) t_1 = (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))) tmp = 0 if t_1 <= -5e-267: tmp = -d * (1.0 / t_0) elif t_1 <= 2e+256: tmp = (d / (l * math.sqrt((h / l)))) * 1.0 else: tmp = math.fabs((-d / t_0)) * 1.0 return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) t_1 = 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)))) tmp = 0.0 if (t_1 <= -5e-267) tmp = Float64(Float64(-d) * Float64(1.0 / t_0)); elseif (t_1 <= 2e+256) tmp = Float64(Float64(d / Float64(l * sqrt(Float64(h / l)))) * 1.0); else tmp = Float64(abs(Float64(Float64(-d) / t_0)) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((h * l)); t_1 = (((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))); tmp = 0.0; if (t_1 <= -5e-267) tmp = -d * (1.0 / t_0); elseif (t_1 <= 2e+256) tmp = (d / (l * sqrt((h / l)))) * 1.0; else tmp = abs((-d / t_0)) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -5e-267], N[((-d) * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+256], N[(N[(d / N[(l * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Abs[N[((-d) / t$95$0), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
t_1 := \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)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-267}:\\
\;\;\;\;\left(-d\right) \cdot \frac{1}{t\_0}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+256}:\\
\;\;\;\;\frac{d}{\ell \cdot \sqrt{\frac{h}{\ell}}} \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{t\_0}\right| \cdot 1\\
\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.9999999999999999e-267Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6426.6%
Applied rewrites26.6%
metadata-eval26.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6426.6%
Applied rewrites26.6%
if -4.9999999999999999e-267 < (*.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.0000000000000001e256Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6426.6%
Applied rewrites26.6%
Taylor expanded in l around -inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6440.3%
Applied rewrites40.3%
if 2.0000000000000001e256 < (*.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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6429.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites43.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* h l)))
(t_1
(*
(* (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))))))
(if (<= t_1 -5e-267)
(* (- d) (/ 1.0 t_0))
(if (<= t_1 5e+249)
(* (/ d (* h (sqrt (/ l h)))) 1.0)
(* (fabs (/ (- d) t_0)) 1.0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double t_1 = (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 tmp;
if (t_1 <= -5e-267) {
tmp = -d * (1.0 / t_0);
} else if (t_1 <= 5e+249) {
tmp = (d / (h * sqrt((l / h)))) * 1.0;
} else {
tmp = fabs((-d / t_0)) * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((h * l))
t_1 = (((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)))
if (t_1 <= (-5d-267)) then
tmp = -d * (1.0d0 / t_0)
else if (t_1 <= 5d+249) then
tmp = (d / (h * sqrt((l / h)))) * 1.0d0
else
tmp = abs((-d / t_0)) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h * l));
double t_1 = (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)));
double tmp;
if (t_1 <= -5e-267) {
tmp = -d * (1.0 / t_0);
} else if (t_1 <= 5e+249) {
tmp = (d / (h * Math.sqrt((l / h)))) * 1.0;
} else {
tmp = Math.abs((-d / t_0)) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((h * l)) t_1 = (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))) tmp = 0 if t_1 <= -5e-267: tmp = -d * (1.0 / t_0) elif t_1 <= 5e+249: tmp = (d / (h * math.sqrt((l / h)))) * 1.0 else: tmp = math.fabs((-d / t_0)) * 1.0 return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) t_1 = 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)))) tmp = 0.0 if (t_1 <= -5e-267) tmp = Float64(Float64(-d) * Float64(1.0 / t_0)); elseif (t_1 <= 5e+249) tmp = Float64(Float64(d / Float64(h * sqrt(Float64(l / h)))) * 1.0); else tmp = Float64(abs(Float64(Float64(-d) / t_0)) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((h * l)); t_1 = (((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))); tmp = 0.0; if (t_1 <= -5e-267) tmp = -d * (1.0 / t_0); elseif (t_1 <= 5e+249) tmp = (d / (h * sqrt((l / h)))) * 1.0; else tmp = abs((-d / t_0)) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -5e-267], N[((-d) * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+249], N[(N[(d / N[(h * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Abs[N[((-d) / t$95$0), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
t_1 := \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)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-267}:\\
\;\;\;\;\left(-d\right) \cdot \frac{1}{t\_0}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+249}:\\
\;\;\;\;\frac{d}{h \cdot \sqrt{\frac{\ell}{h}}} \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{t\_0}\right| \cdot 1\\
\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.9999999999999999e-267Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6426.6%
Applied rewrites26.6%
metadata-eval26.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6426.6%
Applied rewrites26.6%
if -4.9999999999999999e-267 < (*.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.9999999999999996e249Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6426.6%
Applied rewrites26.6%
Taylor expanded in h around -inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6440.1%
Applied rewrites40.1%
if 4.9999999999999996e249 < (*.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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6429.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites43.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* h l))))
(if (<=
(*
(* (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))))
-5e-267)
(* (- d) (/ 1.0 t_0))
(* (fabs (/ (- d) t_0)) 1.0))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double tmp;
if (((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)))) <= -5e-267) {
tmp = -d * (1.0 / t_0);
} else {
tmp = fabs((-d / t_0)) * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((h * l))
if (((((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)))) <= (-5d-267)) then
tmp = -d * (1.0d0 / t_0)
else
tmp = abs((-d / t_0)) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h * l));
double tmp;
if (((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)))) <= -5e-267) {
tmp = -d * (1.0 / t_0);
} else {
tmp = Math.abs((-d / t_0)) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((h * l)) tmp = 0 if ((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)))) <= -5e-267: tmp = -d * (1.0 / t_0) else: tmp = math.fabs((-d / t_0)) * 1.0 return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) tmp = 0.0 if (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)))) <= -5e-267) tmp = Float64(Float64(-d) * Float64(1.0 / t_0)); else tmp = Float64(abs(Float64(Float64(-d) / t_0)) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((h * l)); tmp = 0.0; if (((((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)))) <= -5e-267) tmp = -d * (1.0 / t_0); else tmp = abs((-d / t_0)) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[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], -5e-267], N[((-d) * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[((-d) / t$95$0), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;\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) \leq -5 \cdot 10^{-267}:\\
\;\;\;\;\left(-d\right) \cdot \frac{1}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{t\_0}\right| \cdot 1\\
\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.9999999999999999e-267Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6426.6%
Applied rewrites26.6%
metadata-eval26.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6426.6%
Applied rewrites26.6%
if -4.9999999999999999e-267 < (*.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 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-fabs.f6429.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqrt-divN/A
Applied rewrites43.9%
(FPCore (d h l M D) :precision binary64 (* (/ (- d) (sqrt (* h l))) 1.0))
double code(double d, double h, double l, double M, double D) {
return (-d / sqrt((h * l))) * 1.0;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (-d / sqrt((h * l))) * 1.0d0
end function
public static double code(double d, double h, double l, double M, double D) {
return (-d / Math.sqrt((h * l))) * 1.0;
}
def code(d, h, l, M, D): return (-d / math.sqrt((h * l))) * 1.0
function code(d, h, l, M, D) return Float64(Float64(Float64(-d) / sqrt(Float64(h * l))) * 1.0) end
function tmp = code(d, h, l, M, D) tmp = (-d / sqrt((h * l))) * 1.0; end
code[d_, h_, l_, M_, D_] := N[(N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]
\frac{-d}{\sqrt{h \cdot \ell}} \cdot 1
Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6426.6%
Applied rewrites26.6%
(FPCore (d h l M D) :precision binary64 (* (- d) (/ 1.0 (sqrt (* h l)))))
double code(double d, double h, double l, double M, double D) {
return -d * (1.0 / sqrt((h * l)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = -d * (1.0d0 / sqrt((h * l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return -d * (1.0 / Math.sqrt((h * l)));
}
def code(d, h, l, M, D): return -d * (1.0 / math.sqrt((h * l)))
function code(d, h, l, M, D) return Float64(Float64(-d) * Float64(1.0 / sqrt(Float64(h * l)))) end
function tmp = code(d, h, l, M, D) tmp = -d * (1.0 / sqrt((h * l))); end
code[d_, h_, l_, M_, D_] := N[((-d) * N[(1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(-d\right) \cdot \frac{1}{\sqrt{h \cdot \ell}}
Initial program 66.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.4%
Applied rewrites66.4%
Taylor expanded in d around inf
Applied rewrites40.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6426.6%
Applied rewrites26.6%
metadata-eval26.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6426.6%
Applied rewrites26.6%
herbie shell --seed 2025212
(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)))))