
(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 11 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 72.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
lift-*.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-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6498.3
Applied rewrites98.3%
(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 72.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -8.2e+159)
(/ (* (- (/ u t1) 1.0) v) (+ u t1))
(if (<= t1 7.2e+145)
(* (- t1) (/ (/ v (+ u t1)) (+ u t1)))
(/ (fma (* u (/ v t1)) 2.0 (- v)) t1))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -8.2e+159) {
tmp = (((u / t1) - 1.0) * v) / (u + t1);
} else if (t1 <= 7.2e+145) {
tmp = -t1 * ((v / (u + t1)) / (u + t1));
} else {
tmp = fma((u * (v / t1)), 2.0, -v) / t1;
}
return tmp;
}
function code(u, v, t1) tmp = 0.0 if (t1 <= -8.2e+159) tmp = Float64(Float64(Float64(Float64(u / t1) - 1.0) * v) / Float64(u + t1)); elseif (t1 <= 7.2e+145) tmp = Float64(Float64(-t1) * Float64(Float64(v / Float64(u + t1)) / Float64(u + t1))); else tmp = Float64(fma(Float64(u * Float64(v / t1)), 2.0, Float64(-v)) / t1); end return tmp end
code[u_, v_, t1_] := If[LessEqual[t1, -8.2e+159], N[(N[(N[(N[(u / t1), $MachinePrecision] - 1.0), $MachinePrecision] * v), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 7.2e+145], N[((-t1) * N[(N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(u * N[(v / t1), $MachinePrecision]), $MachinePrecision] * 2.0 + (-v)), $MachinePrecision] / t1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -8.2 \cdot 10^{+159}:\\
\;\;\;\;\frac{\left(\frac{u}{t1} - 1\right) \cdot v}{u + t1}\\
\mathbf{elif}\;t1 \leq 7.2 \cdot 10^{+145}:\\
\;\;\;\;\left(-t1\right) \cdot \frac{\frac{v}{u + t1}}{u + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(u \cdot \frac{v}{t1}, 2, -v\right)}{t1}\\
\end{array}
\end{array}
if t1 < -8.20000000000000027e159Initial program 40.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in u around 0
lower--.f64N/A
lower-/.f6492.3
Applied rewrites92.3%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f6491.6
Applied rewrites91.6%
if -8.20000000000000027e159 < t1 < 7.19999999999999948e145Initial program 83.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6497.2
Applied rewrites97.2%
lift-*.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-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6497.7
Applied rewrites97.7%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f6489.3
Applied rewrites89.3%
if 7.19999999999999948e145 < t1 Initial program 41.4%
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.f6491.9
Applied rewrites91.9%
(FPCore (u v t1)
:precision binary64
(if (<= u -1.2e+154)
(/ (* (- t1) (/ v u)) (+ u t1))
(if (<= u -8.2e-134)
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))
(if (<= u 8.2e-69)
(/ (- v) t1)
(if (<= u 3.55e+75)
(* (- t1) (/ v (* (+ u t1) (+ u t1))))
(* (/ (- t1) u) (/ v (+ u t1))))))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -1.2e+154) {
tmp = (-t1 * (v / u)) / (u + t1);
} else if (u <= -8.2e-134) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else if (u <= 8.2e-69) {
tmp = -v / t1;
} else if (u <= 3.55e+75) {
tmp = -t1 * (v / ((u + t1) * (u + t1)));
} else {
tmp = (-t1 / u) * (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 (u <= (-1.2d+154)) then
tmp = (-t1 * (v / u)) / (u + t1)
else if (u <= (-8.2d-134)) then
tmp = (-t1 * v) / ((t1 + u) * (t1 + u))
else if (u <= 8.2d-69) then
tmp = -v / t1
else if (u <= 3.55d+75) then
tmp = -t1 * (v / ((u + t1) * (u + t1)))
else
tmp = (-t1 / u) * (v / (u + t1))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= -1.2e+154) {
tmp = (-t1 * (v / u)) / (u + t1);
} else if (u <= -8.2e-134) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else if (u <= 8.2e-69) {
tmp = -v / t1;
} else if (u <= 3.55e+75) {
tmp = -t1 * (v / ((u + t1) * (u + t1)));
} else {
tmp = (-t1 / u) * (v / (u + t1));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -1.2e+154: tmp = (-t1 * (v / u)) / (u + t1) elif u <= -8.2e-134: tmp = (-t1 * v) / ((t1 + u) * (t1 + u)) elif u <= 8.2e-69: tmp = -v / t1 elif u <= 3.55e+75: tmp = -t1 * (v / ((u + t1) * (u + t1))) else: tmp = (-t1 / u) * (v / (u + t1)) return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -1.2e+154) tmp = Float64(Float64(Float64(-t1) * Float64(v / u)) / Float64(u + t1)); elseif (u <= -8.2e-134) tmp = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))); elseif (u <= 8.2e-69) tmp = Float64(Float64(-v) / t1); elseif (u <= 3.55e+75) tmp = Float64(Float64(-t1) * Float64(v / Float64(Float64(u + t1) * Float64(u + t1)))); else tmp = Float64(Float64(Float64(-t1) / u) * Float64(v / Float64(u + t1))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -1.2e+154) tmp = (-t1 * (v / u)) / (u + t1); elseif (u <= -8.2e-134) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); elseif (u <= 8.2e-69) tmp = -v / t1; elseif (u <= 3.55e+75) tmp = -t1 * (v / ((u + t1) * (u + t1))); else tmp = (-t1 / u) * (v / (u + t1)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -1.2e+154], N[(N[((-t1) * N[(v / u), $MachinePrecision]), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, -8.2e-134], N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 8.2e-69], N[((-v) / t1), $MachinePrecision], If[LessEqual[u, 3.55e+75], N[((-t1) * N[(v / N[(N[(u + t1), $MachinePrecision] * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) / u), $MachinePrecision] * N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.2 \cdot 10^{+154}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot \frac{v}{u}}{u + t1}\\
\mathbf{elif}\;u \leq -8.2 \cdot 10^{-134}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{elif}\;u \leq 8.2 \cdot 10^{-69}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{elif}\;u \leq 3.55 \cdot 10^{+75}:\\
\;\;\;\;\left(-t1\right) \cdot \frac{v}{\left(u + t1\right) \cdot \left(u + t1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t1}{u} \cdot \frac{v}{u + t1}\\
\end{array}
\end{array}
if u < -1.20000000000000007e154Initial program 72.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6498.4
Applied rewrites98.4%
lift-*.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-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.9
Applied rewrites99.9%
Taylor expanded in u around inf
Applied rewrites90.8%
if -1.20000000000000007e154 < u < -8.2000000000000004e-134Initial program 79.1%
if -8.2000000000000004e-134 < u < 8.1999999999999998e-69Initial program 63.9%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6485.7
Applied rewrites85.7%
if 8.1999999999999998e-69 < u < 3.54999999999999991e75Initial program 77.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6479.8
Applied rewrites79.8%
if 3.54999999999999991e75 < u Initial program 77.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6497.6
Applied rewrites97.6%
Taylor expanded in u around inf
associate-*r/N/A
mul-1-negN/A
lift-neg.f64N/A
lower-/.f6485.6
Applied rewrites85.6%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (- t1) (/ v (* (+ u t1) (+ u t1))))))
(if (<= u -3.5e+153)
(/ (* (- t1) (/ v u)) (+ u t1))
(if (<= u -1.6e-145)
t_1
(if (<= u 8.2e-69)
(/ (- v) t1)
(if (<= u 3.55e+75) t_1 (* (/ (- t1) u) (/ v (+ u t1)))))))))
double code(double u, double v, double t1) {
double t_1 = -t1 * (v / ((u + t1) * (u + t1)));
double tmp;
if (u <= -3.5e+153) {
tmp = (-t1 * (v / u)) / (u + t1);
} else if (u <= -1.6e-145) {
tmp = t_1;
} else if (u <= 8.2e-69) {
tmp = -v / t1;
} else if (u <= 3.55e+75) {
tmp = t_1;
} else {
tmp = (-t1 / u) * (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) :: t_1
real(8) :: tmp
t_1 = -t1 * (v / ((u + t1) * (u + t1)))
if (u <= (-3.5d+153)) then
tmp = (-t1 * (v / u)) / (u + t1)
else if (u <= (-1.6d-145)) then
tmp = t_1
else if (u <= 8.2d-69) then
tmp = -v / t1
else if (u <= 3.55d+75) then
tmp = t_1
else
tmp = (-t1 / u) * (v / (u + t1))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -t1 * (v / ((u + t1) * (u + t1)));
double tmp;
if (u <= -3.5e+153) {
tmp = (-t1 * (v / u)) / (u + t1);
} else if (u <= -1.6e-145) {
tmp = t_1;
} else if (u <= 8.2e-69) {
tmp = -v / t1;
} else if (u <= 3.55e+75) {
tmp = t_1;
} else {
tmp = (-t1 / u) * (v / (u + t1));
}
return tmp;
}
def code(u, v, t1): t_1 = -t1 * (v / ((u + t1) * (u + t1))) tmp = 0 if u <= -3.5e+153: tmp = (-t1 * (v / u)) / (u + t1) elif u <= -1.6e-145: tmp = t_1 elif u <= 8.2e-69: tmp = -v / t1 elif u <= 3.55e+75: tmp = t_1 else: tmp = (-t1 / u) * (v / (u + t1)) return tmp
function code(u, v, t1) t_1 = Float64(Float64(-t1) * Float64(v / Float64(Float64(u + t1) * Float64(u + t1)))) tmp = 0.0 if (u <= -3.5e+153) tmp = Float64(Float64(Float64(-t1) * Float64(v / u)) / Float64(u + t1)); elseif (u <= -1.6e-145) tmp = t_1; elseif (u <= 8.2e-69) tmp = Float64(Float64(-v) / t1); elseif (u <= 3.55e+75) tmp = t_1; else tmp = Float64(Float64(Float64(-t1) / u) * Float64(v / Float64(u + t1))); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -t1 * (v / ((u + t1) * (u + t1))); tmp = 0.0; if (u <= -3.5e+153) tmp = (-t1 * (v / u)) / (u + t1); elseif (u <= -1.6e-145) tmp = t_1; elseif (u <= 8.2e-69) tmp = -v / t1; elseif (u <= 3.55e+75) tmp = t_1; else tmp = (-t1 / u) * (v / (u + t1)); end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-t1) * N[(v / N[(N[(u + t1), $MachinePrecision] * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -3.5e+153], N[(N[((-t1) * N[(v / u), $MachinePrecision]), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, -1.6e-145], t$95$1, If[LessEqual[u, 8.2e-69], N[((-v) / t1), $MachinePrecision], If[LessEqual[u, 3.55e+75], t$95$1, N[(N[((-t1) / u), $MachinePrecision] * N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-t1\right) \cdot \frac{v}{\left(u + t1\right) \cdot \left(u + t1\right)}\\
\mathbf{if}\;u \leq -3.5 \cdot 10^{+153}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot \frac{v}{u}}{u + t1}\\
\mathbf{elif}\;u \leq -1.6 \cdot 10^{-145}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;u \leq 8.2 \cdot 10^{-69}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{elif}\;u \leq 3.55 \cdot 10^{+75}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-t1}{u} \cdot \frac{v}{u + t1}\\
\end{array}
\end{array}
if u < -3.4999999999999999e153Initial program 72.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6498.4
Applied rewrites98.4%
lift-*.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-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.9
Applied rewrites99.9%
Taylor expanded in u around inf
Applied rewrites90.8%
if -3.4999999999999999e153 < u < -1.60000000000000004e-145 or 8.1999999999999998e-69 < u < 3.54999999999999991e75Initial program 78.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6478.9
Applied rewrites78.9%
if -1.60000000000000004e-145 < u < 8.1999999999999998e-69Initial program 63.8%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6486.0
Applied rewrites86.0%
if 3.54999999999999991e75 < u Initial program 77.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6497.6
Applied rewrites97.6%
Taylor expanded in u around inf
associate-*r/N/A
mul-1-negN/A
lift-neg.f64N/A
lower-/.f6485.6
Applied rewrites85.6%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (* (/ (- t1) u) (/ v (+ u t1))))) (if (<= u -6.8e-99) t_1 (if (<= u 9.5e-29) (/ (- v) t1) t_1))))
double code(double u, double v, double t1) {
double t_1 = (-t1 / u) * (v / (u + t1));
double tmp;
if (u <= -6.8e-99) {
tmp = t_1;
} else if (u <= 9.5e-29) {
tmp = -v / t1;
} 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 = (-t1 / u) * (v / (u + t1))
if (u <= (-6.8d-99)) then
tmp = t_1
else if (u <= 9.5d-29) then
tmp = -v / t1
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (-t1 / u) * (v / (u + t1));
double tmp;
if (u <= -6.8e-99) {
tmp = t_1;
} else if (u <= 9.5e-29) {
tmp = -v / t1;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (-t1 / u) * (v / (u + t1)) tmp = 0 if u <= -6.8e-99: tmp = t_1 elif u <= 9.5e-29: tmp = -v / t1 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(Float64(-t1) / u) * Float64(v / Float64(u + t1))) tmp = 0.0 if (u <= -6.8e-99) tmp = t_1; elseif (u <= 9.5e-29) tmp = Float64(Float64(-v) / t1); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-t1 / u) * (v / (u + t1)); tmp = 0.0; if (u <= -6.8e-99) tmp = t_1; elseif (u <= 9.5e-29) tmp = -v / t1; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) / u), $MachinePrecision] * N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -6.8e-99], t$95$1, If[LessEqual[u, 9.5e-29], N[((-v) / t1), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-t1}{u} \cdot \frac{v}{u + t1}\\
\mathbf{if}\;u \leq -6.8 \cdot 10^{-99}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;u \leq 9.5 \cdot 10^{-29}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if u < -6.80000000000000014e-99 or 9.50000000000000023e-29 < u Initial program 77.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6497.7
Applied rewrites97.7%
Taylor expanded in u around inf
associate-*r/N/A
mul-1-negN/A
lift-neg.f64N/A
lower-/.f6475.1
Applied rewrites75.1%
if -6.80000000000000014e-99 < u < 9.50000000000000023e-29Initial program 65.3%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6482.7
Applied rewrites82.7%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (* (/ (- t1) u) (/ v u)))) (if (<= u -6.8e-99) t_1 (if (<= u 0.00038) (/ (- v) t1) t_1))))
double code(double u, double v, double t1) {
double t_1 = (-t1 / u) * (v / u);
double tmp;
if (u <= -6.8e-99) {
tmp = t_1;
} else if (u <= 0.00038) {
tmp = -v / t1;
} 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 = (-t1 / u) * (v / u)
if (u <= (-6.8d-99)) then
tmp = t_1
else if (u <= 0.00038d0) then
tmp = -v / t1
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (-t1 / u) * (v / u);
double tmp;
if (u <= -6.8e-99) {
tmp = t_1;
} else if (u <= 0.00038) {
tmp = -v / t1;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (-t1 / u) * (v / u) tmp = 0 if u <= -6.8e-99: tmp = t_1 elif u <= 0.00038: tmp = -v / t1 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(Float64(-t1) / u) * Float64(v / u)) tmp = 0.0 if (u <= -6.8e-99) tmp = t_1; elseif (u <= 0.00038) tmp = Float64(Float64(-v) / t1); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-t1 / u) * (v / u); tmp = 0.0; if (u <= -6.8e-99) tmp = t_1; elseif (u <= 0.00038) tmp = -v / t1; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) / u), $MachinePrecision] * N[(v / u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -6.8e-99], t$95$1, If[LessEqual[u, 0.00038], N[((-v) / t1), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-t1}{u} \cdot \frac{v}{u}\\
\mathbf{if}\;u \leq -6.8 \cdot 10^{-99}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;u \leq 0.00038:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if u < -6.80000000000000014e-99 or 3.8000000000000002e-4 < u Initial program 77.3%
Taylor expanded in u around inf
Applied rewrites66.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
times-fracN/A
+-commutativeN/A
lift-neg.f64N/A
lower-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lower-/.f6471.6
+-commutative71.6
Applied rewrites71.6%
Taylor expanded in u around inf
associate-*r/N/A
mul-1-negN/A
lift-neg.f64N/A
lower-/.f6471.3
Applied rewrites71.3%
if -6.80000000000000014e-99 < u < 3.8000000000000002e-4Initial program 65.9%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6481.6
Applied rewrites81.6%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ u t1))))
(if (<= t1 -1.15e-100)
t_1
(if (<= t1 4.4e-62) (* (- t1) (/ v (* u u))) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (u + t1);
double tmp;
if (t1 <= -1.15e-100) {
tmp = t_1;
} else if (t1 <= 4.4e-62) {
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 <= (-1.15d-100)) then
tmp = t_1
else if (t1 <= 4.4d-62) 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 <= -1.15e-100) {
tmp = t_1;
} else if (t1 <= 4.4e-62) {
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 <= -1.15e-100: tmp = t_1 elif t1 <= 4.4e-62: 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 <= -1.15e-100) tmp = t_1; elseif (t1 <= 4.4e-62) 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 <= -1.15e-100) tmp = t_1; elseif (t1 <= 4.4e-62) 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, -1.15e-100], t$95$1, If[LessEqual[t1, 4.4e-62], 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 -1.15 \cdot 10^{-100}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 4.4 \cdot 10^{-62}:\\
\;\;\;\;\left(-t1\right) \cdot \frac{v}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.14999999999999997e-100 or 4.40000000000000035e-62 < t1 Initial program 67.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
lift-*.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-/.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.f6478.0
Applied rewrites78.0%
if -1.14999999999999997e-100 < t1 < 4.40000000000000035e-62Initial program 81.3%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6474.7
Applied rewrites74.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6474.1
Applied rewrites74.1%
(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 72.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
lift-*.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-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6498.3
Applied rewrites98.3%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6461.9
Applied rewrites61.9%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (* -1.0 (/ v u)))) (if (<= u -1.8e+173) t_1 (if (<= u 1.12e+156) (/ (- v) t1) t_1))))
double code(double u, double v, double t1) {
double t_1 = -1.0 * (v / u);
double tmp;
if (u <= -1.8e+173) {
tmp = t_1;
} else if (u <= 1.12e+156) {
tmp = -v / t1;
} 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 = (-1.0d0) * (v / u)
if (u <= (-1.8d+173)) then
tmp = t_1
else if (u <= 1.12d+156) then
tmp = -v / t1
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -1.0 * (v / u);
double tmp;
if (u <= -1.8e+173) {
tmp = t_1;
} else if (u <= 1.12e+156) {
tmp = -v / t1;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -1.0 * (v / u) tmp = 0 if u <= -1.8e+173: tmp = t_1 elif u <= 1.12e+156: tmp = -v / t1 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(-1.0 * Float64(v / u)) tmp = 0.0 if (u <= -1.8e+173) tmp = t_1; elseif (u <= 1.12e+156) tmp = Float64(Float64(-v) / t1); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -1.0 * (v / u); tmp = 0.0; if (u <= -1.8e+173) tmp = t_1; elseif (u <= 1.12e+156) tmp = -v / t1; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(-1.0 * N[(v / u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -1.8e+173], t$95$1, If[LessEqual[u, 1.12e+156], N[((-v) / t1), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 \cdot \frac{v}{u}\\
\mathbf{if}\;u \leq -1.8 \cdot 10^{+173}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;u \leq 1.12 \cdot 10^{+156}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if u < -1.8000000000000001e173 or 1.12000000000000007e156 < u Initial program 74.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6498.8
Applied rewrites98.8%
Taylor expanded in u around 0
Applied rewrites45.9%
Taylor expanded in u around inf
Applied rewrites40.1%
if -1.8000000000000001e173 < u < 1.12000000000000007e156Initial program 72.0%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6464.4
Applied rewrites64.4%
(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 72.5%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6454.3
Applied rewrites54.3%
herbie shell --seed 2025095
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))