
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1): return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1): return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}
(FPCore (u v t1) :precision binary64 (/ (* (- t1) (/ v (+ u t1))) (+ u t1)))
double code(double u, double v, double t1) {
return (-t1 * (v / (u + t1))) / (u + t1);
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 * (v / (u + t1))) / (u + t1)
end function
public static double code(double u, double v, double t1) {
return (-t1 * (v / (u + t1))) / (u + t1);
}
def code(u, v, t1): return (-t1 * (v / (u + t1))) / (u + t1)
function code(u, v, t1) return Float64(Float64(Float64(-t1) * Float64(v / Float64(u + t1))) / Float64(u + t1)) end
function tmp = code(u, v, t1) tmp = (-t1 * (v / (u + t1))) / (u + t1); end
code[u_, v_, t1_] := N[(N[((-t1) * N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-t1\right) \cdot \frac{v}{u + t1}}{u + t1}
\end{array}
Initial program 71.8%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6498.1
Applied rewrites98.1%
lift-*.f64N/A
lift-neg.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
+-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6498.0
Applied rewrites98.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))))
(if (<= t1 -2.65e+121)
(/ (fma (* u (/ v t1)) 2.0 (- v)) t1)
(if (<= t1 -4.1e-166)
t_1
(if (<= t1 2.3e-169)
(* v (/ (/ (- t1) u) u))
(if (<= t1 2.25e+52) t_1 (* (- (/ u t1) 1.0) (/ v (+ u t1)))))))))
double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double tmp;
if (t1 <= -2.65e+121) {
tmp = fma((u * (v / t1)), 2.0, -v) / t1;
} else if (t1 <= -4.1e-166) {
tmp = t_1;
} else if (t1 <= 2.3e-169) {
tmp = v * ((-t1 / u) / u);
} else if (t1 <= 2.25e+52) {
tmp = t_1;
} else {
tmp = ((u / t1) - 1.0) * (v / (u + t1));
}
return tmp;
}
function code(u, v, t1) t_1 = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) tmp = 0.0 if (t1 <= -2.65e+121) tmp = Float64(fma(Float64(u * Float64(v / t1)), 2.0, Float64(-v)) / t1); elseif (t1 <= -4.1e-166) tmp = t_1; elseif (t1 <= 2.3e-169) tmp = Float64(v * Float64(Float64(Float64(-t1) / u) / u)); elseif (t1 <= 2.25e+52) tmp = t_1; else tmp = Float64(Float64(Float64(u / t1) - 1.0) * Float64(v / Float64(u + t1))); end return tmp end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -2.65e+121], N[(N[(N[(u * N[(v / t1), $MachinePrecision]), $MachinePrecision] * 2.0 + (-v)), $MachinePrecision] / t1), $MachinePrecision], If[LessEqual[t1, -4.1e-166], t$95$1, If[LessEqual[t1, 2.3e-169], N[(v * N[(N[((-t1) / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 2.25e+52], t$95$1, N[(N[(N[(u / t1), $MachinePrecision] - 1.0), $MachinePrecision] * N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{if}\;t1 \leq -2.65 \cdot 10^{+121}:\\
\;\;\;\;\frac{\mathsf{fma}\left(u \cdot \frac{v}{t1}, 2, -v\right)}{t1}\\
\mathbf{elif}\;t1 \leq -4.1 \cdot 10^{-166}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 2.3 \cdot 10^{-169}:\\
\;\;\;\;v \cdot \frac{\frac{-t1}{u}}{u}\\
\mathbf{elif}\;t1 \leq 2.25 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{u}{t1} - 1\right) \cdot \frac{v}{u + t1}\\
\end{array}
\end{array}
if t1 < -2.65000000000000005e121Initial program 47.9%
Taylor expanded in t1 around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6489.9
Applied rewrites89.9%
if -2.65000000000000005e121 < t1 < -4.0999999999999997e-166 or 2.3000000000000001e-169 < t1 < 2.25e52Initial program 87.8%
if -4.0999999999999997e-166 < t1 < 2.3000000000000001e-169Initial program 77.2%
Taylor expanded in u around inf
associate-*r/N/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
mul-1-negN/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lift-neg.f6485.6
Applied rewrites85.6%
lift-*.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
distribute-frac-negN/A
mul-1-negN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
distribute-frac-negN/A
lift-/.f64N/A
lift-neg.f6485.8
Applied rewrites85.8%
times-frac85.8
+-commutative85.8
+-commutative85.8
associate-*l/85.8
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
distribute-frac-negN/A
mul-1-negN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
lift-/.f64N/A
lift-neg.f6486.8
Applied rewrites86.8%
if 2.25e52 < t1 Initial program 50.6%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in u around 0
lower--.f64N/A
lower-/.f6486.9
Applied rewrites86.9%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
(t_2 (* (- (/ u t1) 1.0) (/ v (+ u t1)))))
(if (<= t1 -6e+87)
t_2
(if (<= t1 -4.1e-166)
t_1
(if (<= t1 2.3e-169)
(* v (/ (/ (- t1) u) u))
(if (<= t1 2.25e+52) t_1 t_2))))))
double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double t_2 = ((u / t1) - 1.0) * (v / (u + t1));
double tmp;
if (t1 <= -6e+87) {
tmp = t_2;
} else if (t1 <= -4.1e-166) {
tmp = t_1;
} else if (t1 <= 2.3e-169) {
tmp = v * ((-t1 / u) / u);
} else if (t1 <= 2.25e+52) {
tmp = t_1;
} else {
tmp = t_2;
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-t1 * v) / ((t1 + u) * (t1 + u))
t_2 = ((u / t1) - 1.0d0) * (v / (u + t1))
if (t1 <= (-6d+87)) then
tmp = t_2
else if (t1 <= (-4.1d-166)) then
tmp = t_1
else if (t1 <= 2.3d-169) then
tmp = v * ((-t1 / u) / u)
else if (t1 <= 2.25d+52) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double t_2 = ((u / t1) - 1.0) * (v / (u + t1));
double tmp;
if (t1 <= -6e+87) {
tmp = t_2;
} else if (t1 <= -4.1e-166) {
tmp = t_1;
} else if (t1 <= 2.3e-169) {
tmp = v * ((-t1 / u) / u);
} else if (t1 <= 2.25e+52) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(u, v, t1): t_1 = (-t1 * v) / ((t1 + u) * (t1 + u)) t_2 = ((u / t1) - 1.0) * (v / (u + t1)) tmp = 0 if t1 <= -6e+87: tmp = t_2 elif t1 <= -4.1e-166: tmp = t_1 elif t1 <= 2.3e-169: tmp = v * ((-t1 / u) / u) elif t1 <= 2.25e+52: tmp = t_1 else: tmp = t_2 return tmp
function code(u, v, t1) t_1 = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) t_2 = Float64(Float64(Float64(u / t1) - 1.0) * Float64(v / Float64(u + t1))) tmp = 0.0 if (t1 <= -6e+87) tmp = t_2; elseif (t1 <= -4.1e-166) tmp = t_1; elseif (t1 <= 2.3e-169) tmp = Float64(v * Float64(Float64(Float64(-t1) / u) / u)); elseif (t1 <= 2.25e+52) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-t1 * v) / ((t1 + u) * (t1 + u)); t_2 = ((u / t1) - 1.0) * (v / (u + t1)); tmp = 0.0; if (t1 <= -6e+87) tmp = t_2; elseif (t1 <= -4.1e-166) tmp = t_1; elseif (t1 <= 2.3e-169) tmp = v * ((-t1 / u) / u); elseif (t1 <= 2.25e+52) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(u / t1), $MachinePrecision] - 1.0), $MachinePrecision] * N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -6e+87], t$95$2, If[LessEqual[t1, -4.1e-166], t$95$1, If[LessEqual[t1, 2.3e-169], N[(v * N[(N[((-t1) / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 2.25e+52], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
t_2 := \left(\frac{u}{t1} - 1\right) \cdot \frac{v}{u + t1}\\
\mathbf{if}\;t1 \leq -6 \cdot 10^{+87}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t1 \leq -4.1 \cdot 10^{-166}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 2.3 \cdot 10^{-169}:\\
\;\;\;\;v \cdot \frac{\frac{-t1}{u}}{u}\\
\mathbf{elif}\;t1 \leq 2.25 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t1 < -5.9999999999999998e87 or 2.25e52 < t1 Initial program 50.9%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in u around 0
lower--.f64N/A
lower-/.f6488.1
Applied rewrites88.1%
if -5.9999999999999998e87 < t1 < -4.0999999999999997e-166 or 2.3000000000000001e-169 < t1 < 2.25e52Initial program 89.2%
if -4.0999999999999997e-166 < t1 < 2.3000000000000001e-169Initial program 77.2%
Taylor expanded in u around inf
associate-*r/N/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
mul-1-negN/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lift-neg.f6485.6
Applied rewrites85.6%
lift-*.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
distribute-frac-negN/A
mul-1-negN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
distribute-frac-negN/A
lift-/.f64N/A
lift-neg.f6485.8
Applied rewrites85.8%
times-frac85.8
+-commutative85.8
+-commutative85.8
associate-*l/85.8
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
distribute-frac-negN/A
mul-1-negN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
lift-/.f64N/A
lift-neg.f6486.8
Applied rewrites86.8%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ u t1))) (t_2 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))))
(if (<= t1 -6e+87)
t_1
(if (<= t1 -5.8e-164)
t_2
(if (<= t1 2.3e-169)
(* v (/ (/ (- t1) u) u))
(if (<= t1 2.25e+52) t_2 t_1))))))
double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double t_2 = (-t1 * v) / ((t1 + u) * (t1 + u));
double tmp;
if (t1 <= -6e+87) {
tmp = t_1;
} else if (t1 <= -5.8e-164) {
tmp = t_2;
} else if (t1 <= 2.3e-169) {
tmp = v * ((-t1 / u) / u);
} else if (t1 <= 2.25e+52) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = -v / (u + t1)
t_2 = (-t1 * v) / ((t1 + u) * (t1 + u))
if (t1 <= (-6d+87)) then
tmp = t_1
else if (t1 <= (-5.8d-164)) then
tmp = t_2
else if (t1 <= 2.3d-169) then
tmp = v * ((-t1 / u) / u)
else if (t1 <= 2.25d+52) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double t_2 = (-t1 * v) / ((t1 + u) * (t1 + u));
double tmp;
if (t1 <= -6e+87) {
tmp = t_1;
} else if (t1 <= -5.8e-164) {
tmp = t_2;
} else if (t1 <= 2.3e-169) {
tmp = v * ((-t1 / u) / u);
} else if (t1 <= 2.25e+52) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (u + t1) t_2 = (-t1 * v) / ((t1 + u) * (t1 + u)) tmp = 0 if t1 <= -6e+87: tmp = t_1 elif t1 <= -5.8e-164: tmp = t_2 elif t1 <= 2.3e-169: tmp = v * ((-t1 / u) / u) elif t1 <= 2.25e+52: tmp = t_2 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(u + t1)) t_2 = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) tmp = 0.0 if (t1 <= -6e+87) tmp = t_1; elseif (t1 <= -5.8e-164) tmp = t_2; elseif (t1 <= 2.3e-169) tmp = Float64(v * Float64(Float64(Float64(-t1) / u) / u)); elseif (t1 <= 2.25e+52) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / (u + t1); t_2 = (-t1 * v) / ((t1 + u) * (t1 + u)); tmp = 0.0; if (t1 <= -6e+87) tmp = t_1; elseif (t1 <= -5.8e-164) tmp = t_2; elseif (t1 <= 2.3e-169) tmp = v * ((-t1 / u) / u); elseif (t1 <= 2.25e+52) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -6e+87], t$95$1, If[LessEqual[t1, -5.8e-164], t$95$2, If[LessEqual[t1, 2.3e-169], N[(v * N[(N[((-t1) / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 2.25e+52], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{u + t1}\\
t_2 := \frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{if}\;t1 \leq -6 \cdot 10^{+87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq -5.8 \cdot 10^{-164}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t1 \leq 2.3 \cdot 10^{-169}:\\
\;\;\;\;v \cdot \frac{\frac{-t1}{u}}{u}\\
\mathbf{elif}\;t1 \leq 2.25 \cdot 10^{+52}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -5.9999999999999998e87 or 2.25e52 < t1 Initial program 50.9%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
lift-neg.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
+-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.9
Applied rewrites99.9%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6488.1
Applied rewrites88.1%
if -5.9999999999999998e87 < t1 < -5.8e-164 or 2.3000000000000001e-169 < t1 < 2.25e52Initial program 89.2%
if -5.8e-164 < t1 < 2.3000000000000001e-169Initial program 77.3%
Taylor expanded in u around inf
associate-*r/N/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
mul-1-negN/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lift-neg.f6485.7
Applied rewrites85.7%
lift-*.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
distribute-frac-negN/A
mul-1-negN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
distribute-frac-negN/A
lift-/.f64N/A
lift-neg.f6485.8
Applied rewrites85.8%
times-frac85.8
+-commutative85.8
+-commutative85.8
associate-*l/85.8
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
distribute-frac-negN/A
mul-1-negN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
lift-/.f64N/A
lift-neg.f6486.8
Applied rewrites86.8%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -5.8e-130)
(* (/ (- t1) (+ u t1)) (/ v t1))
(if (<= t1 2.3e-169)
(* v (/ (/ (- t1) u) u))
(if (<= t1 2.25e+52)
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))
(/ (- v) (+ u t1))))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -5.8e-130) {
tmp = (-t1 / (u + t1)) * (v / t1);
} else if (t1 <= 2.3e-169) {
tmp = v * ((-t1 / u) / u);
} else if (t1 <= 2.25e+52) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else {
tmp = -v / (u + t1);
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (t1 <= (-5.8d-130)) then
tmp = (-t1 / (u + t1)) * (v / t1)
else if (t1 <= 2.3d-169) then
tmp = v * ((-t1 / u) / u)
else if (t1 <= 2.25d+52) then
tmp = (-t1 * v) / ((t1 + u) * (t1 + u))
else
tmp = -v / (u + t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -5.8e-130) {
tmp = (-t1 / (u + t1)) * (v / t1);
} else if (t1 <= 2.3e-169) {
tmp = v * ((-t1 / u) / u);
} else if (t1 <= 2.25e+52) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else {
tmp = -v / (u + t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -5.8e-130: tmp = (-t1 / (u + t1)) * (v / t1) elif t1 <= 2.3e-169: tmp = v * ((-t1 / u) / u) elif t1 <= 2.25e+52: tmp = (-t1 * v) / ((t1 + u) * (t1 + u)) else: tmp = -v / (u + t1) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -5.8e-130) tmp = Float64(Float64(Float64(-t1) / Float64(u + t1)) * Float64(v / t1)); elseif (t1 <= 2.3e-169) tmp = Float64(v * Float64(Float64(Float64(-t1) / u) / u)); elseif (t1 <= 2.25e+52) tmp = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))); else tmp = Float64(Float64(-v) / Float64(u + t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -5.8e-130) tmp = (-t1 / (u + t1)) * (v / t1); elseif (t1 <= 2.3e-169) tmp = v * ((-t1 / u) / u); elseif (t1 <= 2.25e+52) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); else tmp = -v / (u + t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -5.8e-130], N[(N[((-t1) / N[(u + t1), $MachinePrecision]), $MachinePrecision] * N[(v / t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 2.3e-169], N[(v * N[(N[((-t1) / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 2.25e+52], N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -5.8 \cdot 10^{-130}:\\
\;\;\;\;\frac{-t1}{u + t1} \cdot \frac{v}{t1}\\
\mathbf{elif}\;t1 \leq 2.3 \cdot 10^{-169}:\\
\;\;\;\;v \cdot \frac{\frac{-t1}{u}}{u}\\
\mathbf{elif}\;t1 \leq 2.25 \cdot 10^{+52}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u + t1}\\
\end{array}
\end{array}
if t1 < -5.8e-130Initial program 70.8%
Taylor expanded in u around 0
Applied rewrites53.6%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
times-fracN/A
+-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
lift-+.f64N/A
lower-/.f6474.7
+-commutative74.7
Applied rewrites74.7%
if -5.8e-130 < t1 < 2.3000000000000001e-169Initial program 78.3%
Taylor expanded in u around inf
associate-*r/N/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
mul-1-negN/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lift-neg.f6484.9
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
distribute-frac-negN/A
mul-1-negN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
distribute-frac-negN/A
lift-/.f64N/A
lift-neg.f6485.1
Applied rewrites85.1%
times-frac85.1
+-commutative85.1
+-commutative85.1
associate-*l/85.1
lift-/.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
distribute-frac-negN/A
mul-1-negN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
lift-/.f64N/A
lift-neg.f6485.6
Applied rewrites85.6%
if 2.3000000000000001e-169 < t1 < 2.25e52Initial program 88.8%
if 2.25e52 < t1 Initial program 50.6%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
lift-neg.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
+-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.9
Applied rewrites99.9%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6487.0
Applied rewrites87.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ v (+ u t1))))
(if (<= t1 -1.02e+131)
(/ (fma (* u (/ v t1)) 2.0 (- v)) t1)
(if (<= t1 4.1e+76)
(* (- t1) (/ t_1 (+ u t1)))
(* (- (/ u t1) 1.0) t_1)))))
double code(double u, double v, double t1) {
double t_1 = v / (u + t1);
double tmp;
if (t1 <= -1.02e+131) {
tmp = fma((u * (v / t1)), 2.0, -v) / t1;
} else if (t1 <= 4.1e+76) {
tmp = -t1 * (t_1 / (u + t1));
} else {
tmp = ((u / t1) - 1.0) * t_1;
}
return tmp;
}
function code(u, v, t1) t_1 = Float64(v / Float64(u + t1)) tmp = 0.0 if (t1 <= -1.02e+131) tmp = Float64(fma(Float64(u * Float64(v / t1)), 2.0, Float64(-v)) / t1); elseif (t1 <= 4.1e+76) tmp = Float64(Float64(-t1) * Float64(t_1 / Float64(u + t1))); else tmp = Float64(Float64(Float64(u / t1) - 1.0) * t_1); end return tmp end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.02e+131], N[(N[(N[(u * N[(v / t1), $MachinePrecision]), $MachinePrecision] * 2.0 + (-v)), $MachinePrecision] / t1), $MachinePrecision], If[LessEqual[t1, 4.1e+76], N[((-t1) * N[(t$95$1 / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(u / t1), $MachinePrecision] - 1.0), $MachinePrecision] * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{u + t1}\\
\mathbf{if}\;t1 \leq -1.02 \cdot 10^{+131}:\\
\;\;\;\;\frac{\mathsf{fma}\left(u \cdot \frac{v}{t1}, 2, -v\right)}{t1}\\
\mathbf{elif}\;t1 \leq 4.1 \cdot 10^{+76}:\\
\;\;\;\;\left(-t1\right) \cdot \frac{t\_1}{u + t1}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{u}{t1} - 1\right) \cdot t\_1\\
\end{array}
\end{array}
if t1 < -1.0199999999999999e131Initial program 46.0%
Taylor expanded in t1 around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6490.6
Applied rewrites90.6%
if -1.0199999999999999e131 < t1 < 4.0999999999999998e76Initial program 83.5%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6497.2
Applied rewrites97.2%
lift-*.f64N/A
lift-neg.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
+-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6497.1
Applied rewrites97.1%
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6490.2
Applied rewrites90.2%
if 4.0999999999999998e76 < t1 Initial program 48.7%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in u around 0
lower--.f64N/A
lower-/.f6488.8
Applied rewrites88.8%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ u t1))))
(if (<= t1 -5.8e-130)
t_1
(if (<= t1 5.1e-42) (/ (* v (/ (- t1) u)) u) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -5.8e-130) {
tmp = t_1;
} else if (t1 <= 5.1e-42) {
tmp = (v * (-t1 / u)) / u;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: tmp
t_1 = -v / (u + t1)
if (t1 <= (-5.8d-130)) then
tmp = t_1
else if (t1 <= 5.1d-42) then
tmp = (v * (-t1 / u)) / u
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -5.8e-130) {
tmp = t_1;
} else if (t1 <= 5.1e-42) {
tmp = (v * (-t1 / u)) / u;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (u + t1) tmp = 0 if t1 <= -5.8e-130: tmp = t_1 elif t1 <= 5.1e-42: tmp = (v * (-t1 / u)) / u else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(u + t1)) tmp = 0.0 if (t1 <= -5.8e-130) tmp = t_1; elseif (t1 <= 5.1e-42) tmp = Float64(Float64(v * Float64(Float64(-t1) / u)) / u); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / (u + t1); tmp = 0.0; if (t1 <= -5.8e-130) tmp = t_1; elseif (t1 <= 5.1e-42) tmp = (v * (-t1 / u)) / u; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -5.8e-130], t$95$1, If[LessEqual[t1, 5.1e-42], N[(N[(v * N[((-t1) / u), $MachinePrecision]), $MachinePrecision] / u), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{u + t1}\\
\mathbf{if}\;t1 \leq -5.8 \cdot 10^{-130}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 5.1 \cdot 10^{-42}:\\
\;\;\;\;\frac{v \cdot \frac{-t1}{u}}{u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -5.8e-130 or 5.1e-42 < t1 Initial program 66.5%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-neg.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
+-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.8
Applied rewrites99.8%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6476.8
Applied rewrites76.8%
if -5.8e-130 < t1 < 5.1e-42Initial program 81.0%
Taylor expanded in u around inf
associate-*r/N/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
mul-1-negN/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lift-neg.f6481.0
Applied rewrites81.0%
lift-*.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
distribute-frac-negN/A
mul-1-negN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
distribute-frac-negN/A
lift-/.f64N/A
lift-neg.f6481.0
Applied rewrites81.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ u t1))))
(if (<= t1 -5.8e-130)
t_1
(if (<= t1 5.1e-42) (* (/ v u) (/ (- t1) u)) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -5.8e-130) {
tmp = t_1;
} else if (t1 <= 5.1e-42) {
tmp = (v / u) * (-t1 / u);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: tmp
t_1 = -v / (u + t1)
if (t1 <= (-5.8d-130)) then
tmp = t_1
else if (t1 <= 5.1d-42) then
tmp = (v / u) * (-t1 / u)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -5.8e-130) {
tmp = t_1;
} else if (t1 <= 5.1e-42) {
tmp = (v / u) * (-t1 / u);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (u + t1) tmp = 0 if t1 <= -5.8e-130: tmp = t_1 elif t1 <= 5.1e-42: tmp = (v / u) * (-t1 / u) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(u + t1)) tmp = 0.0 if (t1 <= -5.8e-130) tmp = t_1; elseif (t1 <= 5.1e-42) tmp = Float64(Float64(v / u) * Float64(Float64(-t1) / u)); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / (u + t1); tmp = 0.0; if (t1 <= -5.8e-130) tmp = t_1; elseif (t1 <= 5.1e-42) tmp = (v / u) * (-t1 / u); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -5.8e-130], t$95$1, If[LessEqual[t1, 5.1e-42], N[(N[(v / u), $MachinePrecision] * N[((-t1) / u), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{u + t1}\\
\mathbf{if}\;t1 \leq -5.8 \cdot 10^{-130}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 5.1 \cdot 10^{-42}:\\
\;\;\;\;\frac{v}{u} \cdot \frac{-t1}{u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -5.8e-130 or 5.1e-42 < t1 Initial program 66.5%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-neg.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
+-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.8
Applied rewrites99.8%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6476.8
Applied rewrites76.8%
if -5.8e-130 < t1 < 5.1e-42Initial program 81.0%
Taylor expanded in u around inf
associate-*r/N/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
mul-1-negN/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lift-neg.f6481.0
Applied rewrites81.0%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (/ (- v) (+ u t1)))) (if (<= t1 -5.8e-130) t_1 (if (<= t1 7e-50) (- (* t1 (/ v (* u u)))) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -5.8e-130) {
tmp = t_1;
} else if (t1 <= 7e-50) {
tmp = -(t1 * (v / (u * u)));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: tmp
t_1 = -v / (u + t1)
if (t1 <= (-5.8d-130)) then
tmp = t_1
else if (t1 <= 7d-50) then
tmp = -(t1 * (v / (u * u)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -5.8e-130) {
tmp = t_1;
} else if (t1 <= 7e-50) {
tmp = -(t1 * (v / (u * u)));
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (u + t1) tmp = 0 if t1 <= -5.8e-130: tmp = t_1 elif t1 <= 7e-50: tmp = -(t1 * (v / (u * u))) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(u + t1)) tmp = 0.0 if (t1 <= -5.8e-130) tmp = t_1; elseif (t1 <= 7e-50) tmp = Float64(-Float64(t1 * Float64(v / Float64(u * u)))); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / (u + t1); tmp = 0.0; if (t1 <= -5.8e-130) tmp = t_1; elseif (t1 <= 7e-50) tmp = -(t1 * (v / (u * u))); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -5.8e-130], t$95$1, If[LessEqual[t1, 7e-50], (-N[(t1 * N[(v / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{u + t1}\\
\mathbf{if}\;t1 \leq -5.8 \cdot 10^{-130}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 7 \cdot 10^{-50}:\\
\;\;\;\;-t1 \cdot \frac{v}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -5.8e-130 or 6.99999999999999993e-50 < t1 Initial program 66.7%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-neg.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
+-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.8
Applied rewrites99.8%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6476.6
Applied rewrites76.6%
if -5.8e-130 < t1 < 6.99999999999999993e-50Initial program 80.8%
Taylor expanded in u around inf
associate-*r/N/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
mul-1-negN/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lift-neg.f6481.4
Applied rewrites81.4%
lift-*.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
distribute-lft-neg-outN/A
mul-1-negN/A
unpow2N/A
associate-*r/N/A
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6473.6
Applied rewrites73.6%
(FPCore (u v t1) :precision binary64 (* (/ (- t1) (+ u t1)) (/ v (+ u t1))))
double code(double u, double v, double t1) {
return (-t1 / (u + t1)) * (v / (u + t1));
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 / (u + t1)) * (v / (u + t1))
end function
public static double code(double u, double v, double t1) {
return (-t1 / (u + t1)) * (v / (u + t1));
}
def code(u, v, t1): return (-t1 / (u + t1)) * (v / (u + t1))
function code(u, v, t1) return Float64(Float64(Float64(-t1) / Float64(u + t1)) * Float64(v / Float64(u + t1))) end
function tmp = code(u, v, t1) tmp = (-t1 / (u + t1)) * (v / (u + t1)); end
code[u_, v_, t1_] := N[(N[((-t1) / N[(u + t1), $MachinePrecision]), $MachinePrecision] * N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-t1}{u + t1} \cdot \frac{v}{u + t1}
\end{array}
Initial program 71.8%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6498.1
Applied rewrites98.1%
(FPCore (u v t1) :precision binary64 (if (<= u 3.1e+101) (/ (- v) t1) (/ (- v) u)))
double code(double u, double v, double t1) {
double tmp;
if (u <= 3.1e+101) {
tmp = -v / t1;
} else {
tmp = -v / u;
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (u <= 3.1d+101) then
tmp = -v / t1
else
tmp = -v / u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= 3.1e+101) {
tmp = -v / t1;
} else {
tmp = -v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= 3.1e+101: tmp = -v / t1 else: tmp = -v / u return tmp
function code(u, v, t1) tmp = 0.0 if (u <= 3.1e+101) tmp = Float64(Float64(-v) / t1); else tmp = Float64(Float64(-v) / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= 3.1e+101) tmp = -v / t1; else tmp = -v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, 3.1e+101], N[((-v) / t1), $MachinePrecision], N[((-v) / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq 3.1 \cdot 10^{+101}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u}\\
\end{array}
\end{array}
if u < 3.09999999999999999e101Initial program 71.1%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6459.8
Applied rewrites59.8%
if 3.09999999999999999e101 < u Initial program 75.1%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6498.3
Applied rewrites98.3%
lift-*.f64N/A
lift-neg.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
+-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.9
Applied rewrites99.9%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6446.0
Applied rewrites46.0%
Taylor expanded in u around inf
Applied rewrites35.3%
(FPCore (u v t1) :precision binary64 (/ (- v) (+ u t1)))
double code(double u, double v, double t1) {
return -v / (u + t1);
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = -v / (u + t1)
end function
public static double code(double u, double v, double t1) {
return -v / (u + t1);
}
def code(u, v, t1): return -v / (u + t1)
function code(u, v, t1) return Float64(Float64(-v) / Float64(u + t1)) end
function tmp = code(u, v, t1) tmp = -v / (u + t1); end
code[u_, v_, t1_] := N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-v}{u + t1}
\end{array}
Initial program 71.8%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6498.1
Applied rewrites98.1%
lift-*.f64N/A
lift-neg.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
+-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6498.0
Applied rewrites98.0%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6461.1
Applied rewrites61.1%
(FPCore (u v t1) :precision binary64 (/ (- v) t1))
double code(double u, double v, double t1) {
return -v / t1;
}
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(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = -v / t1
end function
public static double code(double u, double v, double t1) {
return -v / t1;
}
def code(u, v, t1): return -v / t1
function code(u, v, t1) return Float64(Float64(-v) / t1) end
function tmp = code(u, v, t1) tmp = -v / t1; end
code[u_, v_, t1_] := N[((-v) / t1), $MachinePrecision]
\begin{array}{l}
\\
\frac{-v}{t1}
\end{array}
Initial program 71.8%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6453.7
Applied rewrites53.7%
herbie shell --seed 2025098
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))