
(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 16 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 (/ D (+ d d))))
(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+239)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* (* t_0 M) (* (* t_0 (* M 0.5)) (/ h l)))))
(*
(* (fabs d) (sqrt (/ 1.0 (* h l))))
(fma (/ (* (* (/ (* M D) d) -0.25) h) d) (/ (* (* M D) 0.5) l) 1.0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = D / (d + 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)))) <= 5e+239) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((t_0 * M) * ((t_0 * (M * 0.5)) * (h / l))));
} else {
tmp = (fabs(d) * sqrt((1.0 / (h * l)))) * fma((((((M * D) / d) * -0.25) * h) / d), (((M * D) * 0.5) / l), 1.0);
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(D / Float64(d + 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)))) <= 5e+239) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(t_0 * M) * Float64(Float64(t_0 * Float64(M * 0.5)) * Float64(h / l))))); else tmp = Float64(Float64(abs(d) * sqrt(Float64(1.0 / Float64(h * l)))) * fma(Float64(Float64(Float64(Float64(Float64(M * D) / d) * -0.25) * h) / d), Float64(Float64(Float64(M * D) * 0.5) / l), 1.0)); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(D / N[(d + 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[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+239], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(t$95$0 * M), $MachinePrecision] * N[(N[(t$95$0 * N[(M * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * -0.25), $MachinePrecision] * h), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(M * D), $MachinePrecision] * 0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{D}{d + d}\\
\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^{+239}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(t\_0 \cdot M\right) \cdot \left(\left(t\_0 \cdot \left(M \cdot 0.5\right)\right) \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left|d\right| \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \mathsf{fma}\left(\frac{\left(\frac{M \cdot D}{d} \cdot -0.25\right) \cdot h}{d}, \frac{\left(M \cdot D\right) \cdot 0.5}{\ell}, 1\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)))) < 5.00000000000000007e239Initial program 66.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
if 5.00000000000000007e239 < (*.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.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Applied rewrites68.3%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
mult-flipN/A
sqrt-prodN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-*.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f6474.2
Applied rewrites74.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(fma (/ (* (* (/ (* M D) d) -0.25) h) d) (/ (* (* M D) 0.5) l) 1.0)))
(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+239)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) t_0)
(* (* (fabs d) (sqrt (/ 1.0 (* h l)))) t_0))))double code(double d, double h, double l, double M, double D) {
double t_0 = fma((((((M * D) / d) * -0.25) * h) / d), (((M * D) * 0.5) / l), 1.0);
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+239) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * t_0;
} else {
tmp = (fabs(d) * sqrt((1.0 / (h * l)))) * t_0;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = fma(Float64(Float64(Float64(Float64(Float64(M * D) / d) * -0.25) * h) / d), Float64(Float64(Float64(M * D) * 0.5) / l), 1.0) 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+239) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * t_0); else tmp = Float64(Float64(abs(d) * sqrt(Float64(1.0 / Float64(h * l)))) * t_0); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * -0.25), $MachinePrecision] * h), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(M * D), $MachinePrecision] * 0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $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+239], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{\left(\frac{M \cdot D}{d} \cdot -0.25\right) \cdot h}{d}, \frac{\left(M \cdot D\right) \cdot 0.5}{\ell}, 1\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{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+239}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\left|d\right| \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 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)))) < 5.00000000000000007e239Initial program 66.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Applied rewrites68.3%
if 5.00000000000000007e239 < (*.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.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Applied rewrites68.3%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
mult-flipN/A
sqrt-prodN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-*.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f6474.2
Applied rewrites74.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin (fabs M) D))
(t_1 (fmax (fabs M) D))
(t_2 (* t_0 t_1))
(t_3 (* (/ t_2 d) -0.25)))
(if (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ t_2 (* 2.0 d)) 2.0)) (/ h l))))
5e+239)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(fma (* (* (/ h l) t_3) (* 0.5 t_0)) (/ t_1 d) 1.0))
(*
(* (fabs d) (sqrt (/ 1.0 (* h l))))
(fma (/ (* t_3 h) d) (/ (* t_2 0.5) l) 1.0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(fabs(M), D);
double t_1 = fmax(fabs(M), D);
double t_2 = t_0 * t_1;
double t_3 = (t_2 / d) * -0.25;
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_2 / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+239) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * fma((((h / l) * t_3) * (0.5 * t_0)), (t_1 / d), 1.0);
} else {
tmp = (fabs(d) * sqrt((1.0 / (h * l)))) * fma(((t_3 * h) / d), ((t_2 * 0.5) / l), 1.0);
}
return tmp;
}
function code(d, h, l, M, D) t_0 = fmin(abs(M), D) t_1 = fmax(abs(M), D) t_2 = Float64(t_0 * t_1) t_3 = Float64(Float64(t_2 / d) * -0.25) 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(t_2 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 5e+239) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * fma(Float64(Float64(Float64(h / l) * t_3) * Float64(0.5 * t_0)), Float64(t_1 / d), 1.0)); else tmp = Float64(Float64(abs(d) * sqrt(Float64(1.0 / Float64(h * l)))) * fma(Float64(Float64(t_3 * h) / d), Float64(Float64(t_2 * 0.5) / l), 1.0)); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$2 / d), $MachinePrecision] * -0.25), $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[(t$95$2 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+239], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(h / l), $MachinePrecision] * t$95$3), $MachinePrecision] * N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / d), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(t$95$3 * h), $MachinePrecision] / d), $MachinePrecision] * N[(N[(t$95$2 * 0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, D\right)\\
t_1 := \mathsf{max}\left(\left|M\right|, D\right)\\
t_2 := t\_0 \cdot t\_1\\
t_3 := \frac{t\_2}{d} \cdot -0.25\\
\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\_2}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+239}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \mathsf{fma}\left(\left(\frac{h}{\ell} \cdot t\_3\right) \cdot \left(0.5 \cdot t\_0\right), \frac{t\_1}{d}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left|d\right| \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \mathsf{fma}\left(\frac{t\_3 \cdot h}{d}, \frac{t\_2 \cdot 0.5}{\ell}, 1\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)))) < 5.00000000000000007e239Initial program 66.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Applied rewrites66.0%
if 5.00000000000000007e239 < (*.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.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Applied rewrites68.3%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
mult-flipN/A
sqrt-prodN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-*.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f6474.2
Applied rewrites74.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(fma (/ (* (* (/ (* M D) d) -0.25) h) d) (/ (* (* M D) 0.5) l) 1.0))
(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 2e-239)
(* (/ (fabs d) (sqrt (* h l))) t_0)
(if (<= t_1 5e+239)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(* (* (fabs d) (sqrt (/ 1.0 (* h l)))) t_0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = fma((((((M * D) / d) * -0.25) * h) / d), (((M * D) * 0.5) / l), 1.0);
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 <= 2e-239) {
tmp = (fabs(d) / sqrt((h * l))) * t_0;
} else if (t_1 <= 5e+239) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = (fabs(d) * sqrt((1.0 / (h * l)))) * t_0;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = fma(Float64(Float64(Float64(Float64(Float64(M * D) / d) * -0.25) * h) / d), Float64(Float64(Float64(M * D) * 0.5) / l), 1.0) 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 <= 2e-239) tmp = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * t_0); elseif (t_1 <= 5e+239) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = Float64(Float64(abs(d) * sqrt(Float64(1.0 / Float64(h * l)))) * t_0); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * -0.25), $MachinePrecision] * h), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(M * D), $MachinePrecision] * 0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $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, 2e-239], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[t$95$1, 5e+239], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{\left(\frac{M \cdot D}{d} \cdot -0.25\right) \cdot h}{d}, \frac{\left(M \cdot D\right) \cdot 0.5}{\ell}, 1\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 2 \cdot 10^{-239}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot t\_0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+239}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left(\left|d\right| \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 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)))) < 2.0000000000000002e-239Initial program 66.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Applied rewrites68.3%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6474.5
Applied rewrites74.5%
if 2.0000000000000002e-239 < (*.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)))) < 5.00000000000000007e239Initial program 66.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Taylor expanded in d around inf
Applied rewrites39.9%
if 5.00000000000000007e239 < (*.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.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Applied rewrites68.3%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
mult-flipN/A
sqrt-prodN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-*.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f6474.2
Applied rewrites74.2%
(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)))
(fma
(/ (* (* (/ (* M D) d) -0.25) h) d)
(/ (* (* M D) 0.5) l)
1.0))))
(if (<= t_0 2e-239)
t_1
(if (<= t_0 5e+239) (* (* (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))) * fma((((((M * D) / d) * -0.25) * h) / d), (((M * D) * 0.5) / l), 1.0);
double tmp;
if (t_0 <= 2e-239) {
tmp = t_1;
} else if (t_0 <= 5e+239) {
tmp = (sqrt((d / l)) * 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(Float64(abs(d) / sqrt(Float64(h * l))) * fma(Float64(Float64(Float64(Float64(Float64(M * D) / d) * -0.25) * h) / d), Float64(Float64(Float64(M * D) * 0.5) / l), 1.0)) tmp = 0.0 if (t_0 <= 2e-239) tmp = t_1; elseif (t_0 <= 5e+239) 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[(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[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * -0.25), $MachinePrecision] * h), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(M * D), $MachinePrecision] * 0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e-239], t$95$1, If[LessEqual[t$95$0, 5e+239], 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 := \frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \mathsf{fma}\left(\frac{\left(\frac{M \cdot D}{d} \cdot -0.25\right) \cdot h}{d}, \frac{\left(M \cdot D\right) \cdot 0.5}{\ell}, 1\right)\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-239}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+239}:\\
\;\;\;\;\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)))) < 2.0000000000000002e-239 or 5.00000000000000007e239 < (*.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.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Applied rewrites68.3%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6474.5
Applied rewrites74.5%
if 2.0000000000000002e-239 < (*.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)))) < 5.00000000000000007e239Initial program 66.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Taylor expanded in d around inf
Applied rewrites39.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ (* M D) d)) (t_1 (* t_0 -0.25)))
(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+239)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(fma (* (* t_0 t_1) (/ h l)) 0.5 1.0))
(*
(* (fabs d) (sqrt (/ 1.0 (* h l))))
(fma (/ (* t_1 h) d) (/ (* (* M D) 0.5) l) 1.0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = (M * D) / d;
double t_1 = t_0 * -0.25;
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+239) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * fma(((t_0 * t_1) * (h / l)), 0.5, 1.0);
} else {
tmp = (fabs(d) * sqrt((1.0 / (h * l)))) * fma(((t_1 * h) / d), (((M * D) * 0.5) / l), 1.0);
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(M * D) / d) t_1 = Float64(t_0 * -0.25) 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+239) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * fma(Float64(Float64(t_0 * t_1) * Float64(h / l)), 0.5, 1.0)); else tmp = Float64(Float64(abs(d) * sqrt(Float64(1.0 / Float64(h * l)))) * fma(Float64(Float64(t_1 * h) / d), Float64(Float64(Float64(M * D) * 0.5) / l), 1.0)); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * -0.25), $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+239], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(t$95$1 * h), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(M * D), $MachinePrecision] * 0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{M \cdot D}{d}\\
t_1 := t\_0 \cdot -0.25\\
\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^{+239}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \mathsf{fma}\left(\left(t\_0 \cdot t\_1\right) \cdot \frac{h}{\ell}, 0.5, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left|d\right| \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \mathsf{fma}\left(\frac{t\_1 \cdot h}{d}, \frac{\left(M \cdot D\right) \cdot 0.5}{\ell}, 1\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)))) < 5.00000000000000007e239Initial program 66.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Applied rewrites66.0%
if 5.00000000000000007e239 < (*.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.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Applied rewrites68.3%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
mult-flipN/A
sqrt-prodN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-*.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f6474.2
Applied rewrites74.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin (fabs M) D))
(t_1 (fmax (fabs M) D))
(t_2
(*
(fma
(* (* (/ (* t_1 t_0) d) t_0) -0.25)
(/ (* (* 0.5 h) t_1) (* l d))
1.0)
(/ (fabs d) (sqrt (* h l)))))
(t_3
(*
(* (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))))))
(if (<= t_3 0.0)
t_2
(if (<= t_3 5e+239) (* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0) t_2))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(fabs(M), D);
double t_1 = fmax(fabs(M), D);
double t_2 = fma(((((t_1 * t_0) / d) * t_0) * -0.25), (((0.5 * h) * t_1) / (l * d)), 1.0) * (fabs(d) / sqrt((h * l)));
double t_3 = (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)));
double tmp;
if (t_3 <= 0.0) {
tmp = t_2;
} else if (t_3 <= 5e+239) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = t_2;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = fmin(abs(M), D) t_1 = fmax(abs(M), D) t_2 = Float64(fma(Float64(Float64(Float64(Float64(t_1 * t_0) / d) * t_0) * -0.25), Float64(Float64(Float64(0.5 * h) * t_1) / Float64(l * d)), 1.0) * Float64(abs(d) / sqrt(Float64(h * l)))) t_3 = 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)))) tmp = 0.0 if (t_3 <= 0.0) tmp = t_2; elseif (t_3 <= 5e+239) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = t_2; end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(N[(t$95$1 * t$95$0), $MachinePrecision] / d), $MachinePrecision] * t$95$0), $MachinePrecision] * -0.25), $MachinePrecision] * N[(N[(N[(0.5 * h), $MachinePrecision] * t$95$1), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = 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]}, If[LessEqual[t$95$3, 0.0], t$95$2, If[LessEqual[t$95$3, 5e+239], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, D\right)\\
t_1 := \mathsf{max}\left(\left|M\right|, D\right)\\
t_2 := \mathsf{fma}\left(\left(\frac{t\_1 \cdot t\_0}{d} \cdot t\_0\right) \cdot -0.25, \frac{\left(0.5 \cdot h\right) \cdot t\_1}{\ell \cdot d}, 1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
t_3 := \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)\\
\mathbf{if}\;t\_3 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+239}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\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.0 or 5.00000000000000007e239 < (*.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.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites59.1%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
associate-*r/N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f64N/A
lower-unsound-sqrt.f6424.7
Applied rewrites24.7%
Applied rewrites70.6%
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)))) < 5.00000000000000007e239Initial program 66.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Taylor expanded in d around inf
Applied rewrites39.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
(*
(fma (/ (* (* -0.25 (* D M)) h) (* d d)) (* (/ 0.5 l) (* D M)) 1.0)
(/ (fabs d) (sqrt (* h l))))))
(if (<= t_0 0.0)
t_1
(if (<= t_0 5e+239) (* (* (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 = fma((((-0.25 * (D * M)) * h) / (d * d)), ((0.5 / l) * (D * M)), 1.0) * (fabs(d) / sqrt((h * l)));
double tmp;
if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 5e+239) {
tmp = (sqrt((d / l)) * 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(fma(Float64(Float64(Float64(-0.25 * Float64(D * M)) * h) / Float64(d * d)), Float64(Float64(0.5 / l) * Float64(D * M)), 1.0) * Float64(abs(d) / sqrt(Float64(h * l)))) tmp = 0.0 if (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 5e+239) 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[(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[(N[(N[(N[(-0.25 * N[(D * M), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 / l), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 5e+239], 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 := \mathsf{fma}\left(\frac{\left(-0.25 \cdot \left(D \cdot M\right)\right) \cdot h}{d \cdot d}, \frac{0.5}{\ell} \cdot \left(D \cdot M\right), 1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+239}:\\
\;\;\;\;\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)))) < -0.0 or 5.00000000000000007e239 < (*.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.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Applied rewrites68.3%
Applied rewrites64.3%
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)))) < 5.00000000000000007e239Initial program 66.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Taylor expanded in d around inf
Applied rewrites39.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
(*
(fma (* (/ (* (* (* D D) 0.25) (* M M)) (* (* d d) l)) h) -0.5 1.0)
(/ (fabs d) (sqrt (* h l))))))
(if (<= t_0 -1e+129)
t_1
(if (<= t_0 4e+247)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(if (<= t_0 INFINITY) (/ 1.0 (/ h (* (sqrt (/ h l)) d))) 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 = fma((((((D * D) * 0.25) * (M * M)) / ((d * d) * l)) * h), -0.5, 1.0) * (fabs(d) / sqrt((h * l)));
double tmp;
if (t_0 <= -1e+129) {
tmp = t_1;
} else if (t_0 <= 4e+247) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else if (t_0 <= ((double) INFINITY)) {
tmp = 1.0 / (h / (sqrt((h / l)) * d));
} 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(fma(Float64(Float64(Float64(Float64(Float64(D * D) * 0.25) * Float64(M * M)) / Float64(Float64(d * d) * l)) * h), -0.5, 1.0) * Float64(abs(d) / sqrt(Float64(h * l)))) tmp = 0.0 if (t_0 <= -1e+129) tmp = t_1; elseif (t_0 <= 4e+247) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); elseif (t_0 <= Inf) tmp = Float64(1.0 / Float64(h / Float64(sqrt(Float64(h / l)) * d))); else tmp = t_1; end return 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[(N[(N[(N[(N[(N[(D * D), $MachinePrecision] * 0.25), $MachinePrecision] * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+129], t$95$1, If[LessEqual[t$95$0, 4e+247], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(1.0 / N[(h / N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision]), $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 := \mathsf{fma}\left(\frac{\left(\left(D \cdot D\right) \cdot 0.25\right) \cdot \left(M \cdot M\right)}{\left(d \cdot d\right) \cdot \ell} \cdot h, -0.5, 1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+129}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+247}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{1}{\frac{h}{\sqrt{\frac{h}{\ell}} \cdot d}}\\
\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)))) < -1e129 or +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.0%
Applied rewrites35.2%
Applied rewrites49.2%
if -1e129 < (*.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)))) < 3.99999999999999981e247Initial program 66.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Taylor expanded in d around inf
Applied rewrites39.9%
if 3.99999999999999981e247 < (*.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.0%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6437.7
Applied rewrites37.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6437.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6437.5
Applied rewrites37.5%
(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 (sqrt (/ d l))))
(if (<= t_0 0.0)
(* -1.0 (sqrt (/ (pow d 2.0) (* h l))))
(if (<= t_0 4e+247)
(* (* t_1 (sqrt (/ d h))) 1.0)
(if (<= t_0 INFINITY)
(/ 1.0 (/ h (* (sqrt (/ h l)) d)))
(/ (* (* -1.0 (* d (sqrt (/ h d)))) t_1) h))))))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 = sqrt((d / l));
double tmp;
if (t_0 <= 0.0) {
tmp = -1.0 * sqrt((pow(d, 2.0) / (h * l)));
} else if (t_0 <= 4e+247) {
tmp = (t_1 * sqrt((d / h))) * 1.0;
} else if (t_0 <= ((double) INFINITY)) {
tmp = 1.0 / (h / (sqrt((h / l)) * d));
} else {
tmp = ((-1.0 * (d * sqrt((h / d)))) * t_1) / h;
}
return tmp;
}
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.sqrt((d / l));
double tmp;
if (t_0 <= 0.0) {
tmp = -1.0 * Math.sqrt((Math.pow(d, 2.0) / (h * l)));
} else if (t_0 <= 4e+247) {
tmp = (t_1 * Math.sqrt((d / h))) * 1.0;
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = 1.0 / (h / (Math.sqrt((h / l)) * d));
} else {
tmp = ((-1.0 * (d * Math.sqrt((h / d)))) * t_1) / h;
}
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.sqrt((d / l)) tmp = 0 if t_0 <= 0.0: tmp = -1.0 * math.sqrt((math.pow(d, 2.0) / (h * l))) elif t_0 <= 4e+247: tmp = (t_1 * math.sqrt((d / h))) * 1.0 elif t_0 <= math.inf: tmp = 1.0 / (h / (math.sqrt((h / l)) * d)) else: tmp = ((-1.0 * (d * math.sqrt((h / d)))) * t_1) / h 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 = sqrt(Float64(d / l)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(-1.0 * sqrt(Float64((d ^ 2.0) / Float64(h * l)))); elseif (t_0 <= 4e+247) tmp = Float64(Float64(t_1 * sqrt(Float64(d / h))) * 1.0); elseif (t_0 <= Inf) tmp = Float64(1.0 / Float64(h / Float64(sqrt(Float64(h / l)) * d))); else tmp = Float64(Float64(Float64(-1.0 * Float64(d * sqrt(Float64(h / d)))) * t_1) / h); 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 = sqrt((d / l)); tmp = 0.0; if (t_0 <= 0.0) tmp = -1.0 * sqrt(((d ^ 2.0) / (h * l))); elseif (t_0 <= 4e+247) tmp = (t_1 * sqrt((d / h))) * 1.0; elseif (t_0 <= Inf) tmp = 1.0 / (h / (sqrt((h / l)) * d)); else tmp = ((-1.0 * (d * sqrt((h / d)))) * t_1) / h; 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[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(-1.0 * N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+247], N[(N[(t$95$1 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(1.0 / N[(h / N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.0 * N[(d * N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] / h), $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)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;-1 \cdot \sqrt{\frac{{d}^{2}}{h \cdot \ell}}\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+247}:\\
\;\;\;\;\left(t\_1 \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{1}{\frac{h}{\sqrt{\frac{h}{\ell}} \cdot d}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot t\_1}{h}\\
\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.0%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6411.6
Applied rewrites11.6%
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)))) < 3.99999999999999981e247Initial program 66.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Taylor expanded in d around inf
Applied rewrites39.9%
if 3.99999999999999981e247 < (*.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.0%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6437.7
Applied rewrites37.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6437.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6437.5
Applied rewrites37.5%
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.0%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6411.9
Applied rewrites11.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)))))
(t_2 (sqrt (/ d l))))
(if (<= t_1 -5e-177)
(/ (* -1.0 (* d t_0)) h)
(if (<= t_1 4e+247)
(* (* t_2 (sqrt (/ d h))) 1.0)
(if (<= t_1 INFINITY)
(/ 1.0 (/ h (* t_0 d)))
(/ (* (* -1.0 (* d (sqrt (/ h d)))) t_2) h))))))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 t_2 = sqrt((d / l));
double tmp;
if (t_1 <= -5e-177) {
tmp = (-1.0 * (d * t_0)) / h;
} else if (t_1 <= 4e+247) {
tmp = (t_2 * sqrt((d / h))) * 1.0;
} else if (t_1 <= ((double) INFINITY)) {
tmp = 1.0 / (h / (t_0 * d));
} else {
tmp = ((-1.0 * (d * sqrt((h / d)))) * t_2) / h;
}
return tmp;
}
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 t_2 = Math.sqrt((d / l));
double tmp;
if (t_1 <= -5e-177) {
tmp = (-1.0 * (d * t_0)) / h;
} else if (t_1 <= 4e+247) {
tmp = (t_2 * Math.sqrt((d / h))) * 1.0;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 1.0 / (h / (t_0 * d));
} else {
tmp = ((-1.0 * (d * Math.sqrt((h / d)))) * t_2) / h;
}
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))) t_2 = math.sqrt((d / l)) tmp = 0 if t_1 <= -5e-177: tmp = (-1.0 * (d * t_0)) / h elif t_1 <= 4e+247: tmp = (t_2 * math.sqrt((d / h))) * 1.0 elif t_1 <= math.inf: tmp = 1.0 / (h / (t_0 * d)) else: tmp = ((-1.0 * (d * math.sqrt((h / d)))) * t_2) / h 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)))) t_2 = sqrt(Float64(d / l)) tmp = 0.0 if (t_1 <= -5e-177) tmp = Float64(Float64(-1.0 * Float64(d * t_0)) / h); elseif (t_1 <= 4e+247) tmp = Float64(Float64(t_2 * sqrt(Float64(d / h))) * 1.0); elseif (t_1 <= Inf) tmp = Float64(1.0 / Float64(h / Float64(t_0 * d))); else tmp = Float64(Float64(Float64(-1.0 * Float64(d * sqrt(Float64(h / d)))) * t_2) / h); 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))); t_2 = sqrt((d / l)); tmp = 0.0; if (t_1 <= -5e-177) tmp = (-1.0 * (d * t_0)) / h; elseif (t_1 <= 4e+247) tmp = (t_2 * sqrt((d / h))) * 1.0; elseif (t_1 <= Inf) tmp = 1.0 / (h / (t_0 * d)); else tmp = ((-1.0 * (d * sqrt((h / d)))) * t_2) / h; 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]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -5e-177], N[(N[(-1.0 * N[(d * t$95$0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$1, 4e+247], N[(N[(t$95$2 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(1.0 / N[(h / N[(t$95$0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.0 * N[(d * N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] / h), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\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)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-177}:\\
\;\;\;\;\frac{-1 \cdot \left(d \cdot t\_0\right)}{h}\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+247}:\\
\;\;\;\;\left(t\_2 \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{1}{\frac{h}{t\_0 \cdot d}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot t\_2}{h}\\
\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)))) < -5e-177Initial program 66.0%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6413.7
Applied rewrites13.7%
if -5e-177 < (*.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)))) < 3.99999999999999981e247Initial program 66.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Taylor expanded in d around inf
Applied rewrites39.9%
if 3.99999999999999981e247 < (*.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.0%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6437.7
Applied rewrites37.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6437.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6437.5
Applied rewrites37.5%
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.0%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6411.9
Applied rewrites11.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-177)
(/ (* -1.0 (* d t_0)) h)
(if (<= t_1 4e+247)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(if (<= t_1 INFINITY)
(/ 1.0 (/ h (* t_0 d)))
(* -1.0 (* d (sqrt (/ 1.0 (* h l))))))))))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-177) {
tmp = (-1.0 * (d * t_0)) / h;
} else if (t_1 <= 4e+247) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else if (t_1 <= ((double) INFINITY)) {
tmp = 1.0 / (h / (t_0 * d));
} else {
tmp = -1.0 * (d * sqrt((1.0 / (h * l))));
}
return tmp;
}
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-177) {
tmp = (-1.0 * (d * t_0)) / h;
} else if (t_1 <= 4e+247) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 1.0 / (h / (t_0 * d));
} else {
tmp = -1.0 * (d * Math.sqrt((1.0 / (h * l))));
}
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-177: tmp = (-1.0 * (d * t_0)) / h elif t_1 <= 4e+247: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 elif t_1 <= math.inf: tmp = 1.0 / (h / (t_0 * d)) else: tmp = -1.0 * (d * math.sqrt((1.0 / (h * l)))) 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-177) tmp = Float64(Float64(-1.0 * Float64(d * t_0)) / h); elseif (t_1 <= 4e+247) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); elseif (t_1 <= Inf) tmp = Float64(1.0 / Float64(h / Float64(t_0 * d))); else tmp = Float64(-1.0 * Float64(d * sqrt(Float64(1.0 / Float64(h * l))))); 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-177) tmp = (-1.0 * (d * t_0)) / h; elseif (t_1 <= 4e+247) tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; elseif (t_1 <= Inf) tmp = 1.0 / (h / (t_0 * d)); else tmp = -1.0 * (d * sqrt((1.0 / (h * l)))); 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-177], N[(N[(-1.0 * N[(d * t$95$0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$1, 4e+247], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(1.0 / N[(h / N[(t$95$0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\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^{-177}:\\
\;\;\;\;\frac{-1 \cdot \left(d \cdot t\_0\right)}{h}\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+247}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{1}{\frac{h}{t\_0 \cdot d}}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\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)))) < -5e-177Initial program 66.0%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6413.7
Applied rewrites13.7%
if -5e-177 < (*.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)))) < 3.99999999999999981e247Initial program 66.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites67.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6467.3
lift-/.f64N/A
metadata-eval67.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6467.3
Applied rewrites67.3%
Taylor expanded in d around inf
Applied rewrites39.9%
if 3.99999999999999981e247 < (*.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.0%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6437.7
Applied rewrites37.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6437.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6437.5
Applied rewrites37.5%
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.0%
Applied rewrites35.2%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.7
Applied rewrites26.7%
(FPCore (d h l M D)
:precision binary64
(if (<= l -1.6e-190)
(/ (* d (/ (sqrt (- h)) (sqrt (- l)))) h)
(if (<= l 5.4e-215)
(* -1.0 (* d (sqrt (/ 1.0 (* h l)))))
(/ (* d (/ (sqrt h) (sqrt l))) h))))double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.6e-190) {
tmp = (d * (sqrt(-h) / sqrt(-l))) / h;
} else if (l <= 5.4e-215) {
tmp = -1.0 * (d * sqrt((1.0 / (h * l))));
} else {
tmp = (d * (sqrt(h) / sqrt(l))) / h;
}
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 (l <= (-1.6d-190)) then
tmp = (d * (sqrt(-h) / sqrt(-l))) / h
else if (l <= 5.4d-215) then
tmp = (-1.0d0) * (d * sqrt((1.0d0 / (h * l))))
else
tmp = (d * (sqrt(h) / sqrt(l))) / h
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.6e-190) {
tmp = (d * (Math.sqrt(-h) / Math.sqrt(-l))) / h;
} else if (l <= 5.4e-215) {
tmp = -1.0 * (d * Math.sqrt((1.0 / (h * l))));
} else {
tmp = (d * (Math.sqrt(h) / Math.sqrt(l))) / h;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -1.6e-190: tmp = (d * (math.sqrt(-h) / math.sqrt(-l))) / h elif l <= 5.4e-215: tmp = -1.0 * (d * math.sqrt((1.0 / (h * l)))) else: tmp = (d * (math.sqrt(h) / math.sqrt(l))) / h return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -1.6e-190) tmp = Float64(Float64(d * Float64(sqrt(Float64(-h)) / sqrt(Float64(-l)))) / h); elseif (l <= 5.4e-215) tmp = Float64(-1.0 * Float64(d * sqrt(Float64(1.0 / Float64(h * l))))); else tmp = Float64(Float64(d * Float64(sqrt(h) / sqrt(l))) / h); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -1.6e-190) tmp = (d * (sqrt(-h) / sqrt(-l))) / h; elseif (l <= 5.4e-215) tmp = -1.0 * (d * sqrt((1.0 / (h * l)))); else tmp = (d * (sqrt(h) / sqrt(l))) / h; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.6e-190], N[(N[(d * N[(N[Sqrt[(-h)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[l, 5.4e-215], N[(-1.0 * N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.6 \cdot 10^{-190}:\\
\;\;\;\;\frac{d \cdot \frac{\sqrt{-h}}{\sqrt{-\ell}}}{h}\\
\mathbf{elif}\;\ell \leq 5.4 \cdot 10^{-215}:\\
\;\;\;\;-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \frac{\sqrt{h}}{\sqrt{\ell}}}{h}\\
\end{array}
if l < -1.6e-190Initial program 66.0%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6437.7
Applied rewrites37.7%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f6422.7
Applied rewrites22.7%
if -1.6e-190 < l < 5.40000000000000035e-215Initial program 66.0%
Applied rewrites35.2%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.7
Applied rewrites26.7%
if 5.40000000000000035e-215 < l Initial program 66.0%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6437.7
Applied rewrites37.7%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6422.6
Applied rewrites22.6%
(FPCore (d h l M D) :precision binary64 (if (<= l 5.4e-215) (* -1.0 (* d (sqrt (/ 1.0 (* h l))))) (/ (* d (/ (sqrt h) (sqrt l))) h)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 5.4e-215) {
tmp = -1.0 * (d * sqrt((1.0 / (h * l))));
} else {
tmp = (d * (sqrt(h) / sqrt(l))) / h;
}
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 (l <= 5.4d-215) then
tmp = (-1.0d0) * (d * sqrt((1.0d0 / (h * l))))
else
tmp = (d * (sqrt(h) / sqrt(l))) / h
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 5.4e-215) {
tmp = -1.0 * (d * Math.sqrt((1.0 / (h * l))));
} else {
tmp = (d * (Math.sqrt(h) / Math.sqrt(l))) / h;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= 5.4e-215: tmp = -1.0 * (d * math.sqrt((1.0 / (h * l)))) else: tmp = (d * (math.sqrt(h) / math.sqrt(l))) / h return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= 5.4e-215) tmp = Float64(-1.0 * Float64(d * sqrt(Float64(1.0 / Float64(h * l))))); else tmp = Float64(Float64(d * Float64(sqrt(h) / sqrt(l))) / h); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= 5.4e-215) tmp = -1.0 * (d * sqrt((1.0 / (h * l)))); else tmp = (d * (sqrt(h) / sqrt(l))) / h; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, 5.4e-215], N[(-1.0 * N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\ell \leq 5.4 \cdot 10^{-215}:\\
\;\;\;\;-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \frac{\sqrt{h}}{\sqrt{\ell}}}{h}\\
\end{array}
if l < 5.40000000000000035e-215Initial program 66.0%
Applied rewrites35.2%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.7
Applied rewrites26.7%
if 5.40000000000000035e-215 < l Initial program 66.0%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6437.7
Applied rewrites37.7%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6422.6
Applied rewrites22.6%
(FPCore (d h l M D) :precision binary64 (if (<= l -5e-310) (/ (* d (sqrt (/ h l))) h) (/ (* d (/ (sqrt h) (sqrt l))) h)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5e-310) {
tmp = (d * sqrt((h / l))) / h;
} else {
tmp = (d * (sqrt(h) / sqrt(l))) / h;
}
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 (l <= (-5d-310)) then
tmp = (d * sqrt((h / l))) / h
else
tmp = (d * (sqrt(h) / sqrt(l))) / h
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5e-310) {
tmp = (d * Math.sqrt((h / l))) / h;
} else {
tmp = (d * (Math.sqrt(h) / Math.sqrt(l))) / h;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -5e-310: tmp = (d * math.sqrt((h / l))) / h else: tmp = (d * (math.sqrt(h) / math.sqrt(l))) / h return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h); else tmp = Float64(Float64(d * Float64(sqrt(h) / sqrt(l))) / h); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -5e-310) tmp = (d * sqrt((h / l))) / h; else tmp = (d * (sqrt(h) / sqrt(l))) / h; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -5e-310], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(d * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \frac{\sqrt{h}}{\sqrt{\ell}}}{h}\\
\end{array}
if l < -4.999999999999985e-310Initial program 66.0%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6437.7
Applied rewrites37.7%
if -4.999999999999985e-310 < l Initial program 66.0%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6437.7
Applied rewrites37.7%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6422.6
Applied rewrites22.6%
(FPCore (d h l M D) :precision binary64 (/ (* d (sqrt (/ h l))) h))
double code(double d, double h, double l, double M, double D) {
return (d * sqrt((h / l))) / h;
}
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))) / h
end function
public static double code(double d, double h, double l, double M, double D) {
return (d * Math.sqrt((h / l))) / h;
}
def code(d, h, l, M, D): return (d * math.sqrt((h / l))) / h
function code(d, h, l, M, D) return Float64(Float64(d * sqrt(Float64(h / l))) / h) end
function tmp = code(d, h, l, M, D) tmp = (d * sqrt((h / l))) / h; end
code[d_, h_, l_, M_, D_] := N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]
\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}
Initial program 66.0%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6437.7
Applied rewrites37.7%
herbie shell --seed 2025174
(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)))))