
(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}
Sampling outcomes in binary64 precision:
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 (- 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)) * v) / Float64(Float64(-u) + t1)) end
function tmp = code(u, v, t1) tmp = ((t1 / (u - t1)) * v) / (-u + t1); end
code[u_, v_, t1_] := N[(N[(N[(t1 / N[(u - t1), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{t1}{u - t1} \cdot v}{\left(-u\right) + t1}
\end{array}
Initial program 71.6%
Applied rewrites96.7%
Final simplification96.7%
(FPCore (u v t1)
:precision binary64
(if (<= u -3700000000.0)
(/ (* (/ (- v) u) t1) u)
(if (<= u 9.5e-98)
(/ (- v) t1)
(if (<= u 6.2e+140)
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))
(/ (* (/ t1 u) (- v)) (- u t1))))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -3700000000.0) {
tmp = ((-v / u) * t1) / u;
} else if (u <= 9.5e-98) {
tmp = -v / t1;
} else if (u <= 6.2e+140) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} 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 <= (-3700000000.0d0)) then
tmp = ((-v / u) * t1) / u
else if (u <= 9.5d-98) then
tmp = -v / t1
else if (u <= 6.2d+140) then
tmp = (-t1 * v) / ((t1 + u) * (t1 + u))
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 <= -3700000000.0) {
tmp = ((-v / u) * t1) / u;
} else if (u <= 9.5e-98) {
tmp = -v / t1;
} else if (u <= 6.2e+140) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else {
tmp = ((t1 / u) * -v) / (u - t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -3700000000.0: tmp = ((-v / u) * t1) / u elif u <= 9.5e-98: tmp = -v / t1 elif u <= 6.2e+140: tmp = (-t1 * v) / ((t1 + u) * (t1 + u)) else: tmp = ((t1 / u) * -v) / (u - t1) return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -3700000000.0) tmp = Float64(Float64(Float64(Float64(-v) / u) * t1) / u); elseif (u <= 9.5e-98) tmp = Float64(Float64(-v) / t1); elseif (u <= 6.2e+140) tmp = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))); 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 <= -3700000000.0) tmp = ((-v / u) * t1) / u; elseif (u <= 9.5e-98) tmp = -v / t1; elseif (u <= 6.2e+140) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); else tmp = ((t1 / u) * -v) / (u - t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -3700000000.0], N[(N[(N[((-v) / u), $MachinePrecision] * t1), $MachinePrecision] / u), $MachinePrecision], If[LessEqual[u, 9.5e-98], N[((-v) / t1), $MachinePrecision], If[LessEqual[u, 6.2e+140], N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t1 / u), $MachinePrecision] * (-v)), $MachinePrecision] / N[(u - t1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3700000000:\\
\;\;\;\;\frac{\frac{-v}{u} \cdot t1}{u}\\
\mathbf{elif}\;u \leq 9.5 \cdot 10^{-98}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{elif}\;u \leq 6.2 \cdot 10^{+140}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t1}{u} \cdot \left(-v\right)}{u - t1}\\
\end{array}
\end{array}
if u < -3.7e9Initial program 80.7%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6485.7
Applied rewrites85.7%
Applied rewrites88.6%
if -3.7e9 < u < 9.5000000000000001e-98Initial program 57.2%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6483.1
Applied rewrites83.1%
if 9.5000000000000001e-98 < u < 6.2000000000000001e140Initial program 84.0%
if 6.2000000000000001e140 < u Initial program 74.2%
Applied rewrites99.1%
Taylor expanded in u around inf
lower-/.f6495.1
Applied rewrites95.1%
(FPCore (u v t1)
:precision binary64
(if (<= u -3700000000.0)
(/ (* (/ (- v) u) t1) u)
(if (<= u 9.5e-98)
(/ (- v) t1)
(if (<= u 6.2e+140)
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))
(* (/ v u) (/ (- t1) u))))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -3700000000.0) {
tmp = ((-v / u) * t1) / u;
} else if (u <= 9.5e-98) {
tmp = -v / t1;
} else if (u <= 6.2e+140) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else {
tmp = (v / u) * (-t1 / 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 <= (-3700000000.0d0)) then
tmp = ((-v / u) * t1) / u
else if (u <= 9.5d-98) then
tmp = -v / t1
else if (u <= 6.2d+140) then
tmp = (-t1 * v) / ((t1 + u) * (t1 + u))
else
tmp = (v / u) * (-t1 / u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= -3700000000.0) {
tmp = ((-v / u) * t1) / u;
} else if (u <= 9.5e-98) {
tmp = -v / t1;
} else if (u <= 6.2e+140) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else {
tmp = (v / u) * (-t1 / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -3700000000.0: tmp = ((-v / u) * t1) / u elif u <= 9.5e-98: tmp = -v / t1 elif u <= 6.2e+140: tmp = (-t1 * v) / ((t1 + u) * (t1 + u)) else: tmp = (v / u) * (-t1 / u) return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -3700000000.0) tmp = Float64(Float64(Float64(Float64(-v) / u) * t1) / u); elseif (u <= 9.5e-98) tmp = Float64(Float64(-v) / t1); elseif (u <= 6.2e+140) tmp = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))); else tmp = Float64(Float64(v / u) * Float64(Float64(-t1) / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -3700000000.0) tmp = ((-v / u) * t1) / u; elseif (u <= 9.5e-98) tmp = -v / t1; elseif (u <= 6.2e+140) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); else tmp = (v / u) * (-t1 / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -3700000000.0], N[(N[(N[((-v) / u), $MachinePrecision] * t1), $MachinePrecision] / u), $MachinePrecision], If[LessEqual[u, 9.5e-98], N[((-v) / t1), $MachinePrecision], If[LessEqual[u, 6.2e+140], N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(v / u), $MachinePrecision] * N[((-t1) / u), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3700000000:\\
\;\;\;\;\frac{\frac{-v}{u} \cdot t1}{u}\\
\mathbf{elif}\;u \leq 9.5 \cdot 10^{-98}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{elif}\;u \leq 6.2 \cdot 10^{+140}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u} \cdot \frac{-t1}{u}\\
\end{array}
\end{array}
if u < -3.7e9Initial program 80.7%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6485.7
Applied rewrites85.7%
Applied rewrites88.6%
if -3.7e9 < u < 9.5000000000000001e-98Initial program 57.2%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6483.1
Applied rewrites83.1%
if 9.5000000000000001e-98 < u < 6.2000000000000001e140Initial program 84.0%
if 6.2000000000000001e140 < u Initial program 74.2%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6495.0
Applied rewrites95.0%
Final simplification86.8%
(FPCore (u v t1) :precision binary64 (if (or (<= u -3700000000.0) (not (<= u 1.15e+76))) (* (/ v u) (/ (- t1) u)) (/ (* -1.0 v) (+ u t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -3700000000.0) || !(u <= 1.15e+76)) {
tmp = (v / u) * (-t1 / u);
} else {
tmp = (-1.0 * 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 <= (-3700000000.0d0)) .or. (.not. (u <= 1.15d+76))) then
tmp = (v / u) * (-t1 / u)
else
tmp = ((-1.0d0) * v) / (u + t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -3700000000.0) || !(u <= 1.15e+76)) {
tmp = (v / u) * (-t1 / u);
} else {
tmp = (-1.0 * v) / (u + t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -3700000000.0) or not (u <= 1.15e+76): tmp = (v / u) * (-t1 / u) else: tmp = (-1.0 * v) / (u + t1) return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -3700000000.0) || !(u <= 1.15e+76)) tmp = Float64(Float64(v / u) * Float64(Float64(-t1) / u)); else tmp = Float64(Float64(-1.0 * v) / Float64(u + t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -3700000000.0) || ~((u <= 1.15e+76))) tmp = (v / u) * (-t1 / u); else tmp = (-1.0 * v) / (u + t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -3700000000.0], N[Not[LessEqual[u, 1.15e+76]], $MachinePrecision]], N[(N[(v / u), $MachinePrecision] * N[((-t1) / u), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * v), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3700000000 \lor \neg \left(u \leq 1.15 \cdot 10^{+76}\right):\\
\;\;\;\;\frac{v}{u} \cdot \frac{-t1}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1 \cdot v}{u + t1}\\
\end{array}
\end{array}
if u < -3.7e9 or 1.15000000000000001e76 < u Initial program 79.3%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6488.5
Applied rewrites88.5%
if -3.7e9 < u < 1.15000000000000001e76Initial program 65.1%
Applied rewrites97.0%
Taylor expanded in u around 0
Applied rewrites78.2%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6478.2
Applied rewrites78.2%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqr-neg-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
lower-neg.f6478.9
Applied rewrites78.9%
Final simplification83.3%
(FPCore (u v t1) :precision binary64 (if (<= u -3700000000.0) (/ (* (/ (- v) u) t1) u) (if (<= u 1.15e+76) (/ (* -1.0 v) (+ u t1)) (* (/ v u) (/ (- t1) u)))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -3700000000.0) {
tmp = ((-v / u) * t1) / u;
} else if (u <= 1.15e+76) {
tmp = (-1.0 * v) / (u + t1);
} else {
tmp = (v / u) * (-t1 / 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 <= (-3700000000.0d0)) then
tmp = ((-v / u) * t1) / u
else if (u <= 1.15d+76) then
tmp = ((-1.0d0) * v) / (u + t1)
else
tmp = (v / u) * (-t1 / u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= -3700000000.0) {
tmp = ((-v / u) * t1) / u;
} else if (u <= 1.15e+76) {
tmp = (-1.0 * v) / (u + t1);
} else {
tmp = (v / u) * (-t1 / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -3700000000.0: tmp = ((-v / u) * t1) / u elif u <= 1.15e+76: tmp = (-1.0 * v) / (u + t1) else: tmp = (v / u) * (-t1 / u) return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -3700000000.0) tmp = Float64(Float64(Float64(Float64(-v) / u) * t1) / u); elseif (u <= 1.15e+76) tmp = Float64(Float64(-1.0 * v) / Float64(u + t1)); else tmp = Float64(Float64(v / u) * Float64(Float64(-t1) / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -3700000000.0) tmp = ((-v / u) * t1) / u; elseif (u <= 1.15e+76) tmp = (-1.0 * v) / (u + t1); else tmp = (v / u) * (-t1 / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -3700000000.0], N[(N[(N[((-v) / u), $MachinePrecision] * t1), $MachinePrecision] / u), $MachinePrecision], If[LessEqual[u, 1.15e+76], N[(N[(-1.0 * v), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision], N[(N[(v / u), $MachinePrecision] * N[((-t1) / u), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3700000000:\\
\;\;\;\;\frac{\frac{-v}{u} \cdot t1}{u}\\
\mathbf{elif}\;u \leq 1.15 \cdot 10^{+76}:\\
\;\;\;\;\frac{-1 \cdot v}{u + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u} \cdot \frac{-t1}{u}\\
\end{array}
\end{array}
if u < -3.7e9Initial program 80.7%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6485.7
Applied rewrites85.7%
Applied rewrites88.6%
if -3.7e9 < u < 1.15000000000000001e76Initial program 65.1%
Applied rewrites97.0%
Taylor expanded in u around 0
Applied rewrites78.2%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6478.2
Applied rewrites78.2%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqr-neg-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
lower-neg.f6478.9
Applied rewrites78.9%
if 1.15000000000000001e76 < u Initial program 77.6%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6492.0
Applied rewrites92.0%
Final simplification84.0%
(FPCore (u v t1) :precision binary64 (if (<= t1 -1.3e-80) (/ v (- (fabs u) t1)) (if (<= t1 4.1e+24) (* (- v) (/ (/ t1 u) u)) (/ (* -1.0 v) (+ u t1)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.3e-80) {
tmp = v / (fabs(u) - t1);
} else if (t1 <= 4.1e+24) {
tmp = -v * ((t1 / u) / u);
} else {
tmp = (-1.0 * 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 <= (-1.3d-80)) then
tmp = v / (abs(u) - t1)
else if (t1 <= 4.1d+24) then
tmp = -v * ((t1 / u) / u)
else
tmp = ((-1.0d0) * v) / (u + t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.3e-80) {
tmp = v / (Math.abs(u) - t1);
} else if (t1 <= 4.1e+24) {
tmp = -v * ((t1 / u) / u);
} else {
tmp = (-1.0 * v) / (u + t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -1.3e-80: tmp = v / (math.fabs(u) - t1) elif t1 <= 4.1e+24: tmp = -v * ((t1 / u) / u) else: tmp = (-1.0 * v) / (u + t1) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.3e-80) tmp = Float64(v / Float64(abs(u) - t1)); elseif (t1 <= 4.1e+24) tmp = Float64(Float64(-v) * Float64(Float64(t1 / u) / u)); else tmp = Float64(Float64(-1.0 * v) / Float64(u + t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -1.3e-80) tmp = v / (abs(u) - t1); elseif (t1 <= 4.1e+24) tmp = -v * ((t1 / u) / u); else tmp = (-1.0 * v) / (u + t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -1.3e-80], N[(v / N[(N[Abs[u], $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 4.1e+24], N[((-v) * N[(N[(t1 / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * v), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.3 \cdot 10^{-80}:\\
\;\;\;\;\frac{v}{\left|u\right| - t1}\\
\mathbf{elif}\;t1 \leq 4.1 \cdot 10^{+24}:\\
\;\;\;\;\left(-v\right) \cdot \frac{\frac{t1}{u}}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1 \cdot v}{u + t1}\\
\end{array}
\end{array}
if t1 < -1.3e-80Initial program 64.8%
Applied rewrites98.4%
Taylor expanded in u around 0
Applied rewrites76.1%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6476.6
Applied rewrites76.6%
Taylor expanded in u around 0
lower-/.f64N/A
lower--.f64N/A
lower-fabs.f6476.6
Applied rewrites76.6%
if -1.3e-80 < t1 < 4.1000000000000001e24Initial program 81.6%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6486.2
Applied rewrites86.2%
Applied rewrites82.7%
if 4.1000000000000001e24 < t1 Initial program 66.3%
Applied rewrites98.6%
Taylor expanded in u around 0
Applied rewrites85.6%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6485.4
Applied rewrites85.4%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqr-neg-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
lower-neg.f6485.6
Applied rewrites85.6%
Final simplification81.6%
(FPCore (u v t1) :precision binary64 (if (<= u 2.8e+172) (* (- v) (/ (/ t1 (- u t1)) (- u t1))) (/ (* (/ t1 u) (- v)) (- u t1))))
double code(double u, double v, double t1) {
double tmp;
if (u <= 2.8e+172) {
tmp = -v * ((t1 / (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 <= 2.8d+172) then
tmp = -v * ((t1 / (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 <= 2.8e+172) {
tmp = -v * ((t1 / (u - t1)) / (u - t1));
} else {
tmp = ((t1 / u) * -v) / (u - t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= 2.8e+172: tmp = -v * ((t1 / (u - t1)) / (u - t1)) else: tmp = ((t1 / u) * -v) / (u - t1) return tmp
function code(u, v, t1) tmp = 0.0 if (u <= 2.8e+172) tmp = Float64(Float64(-v) * Float64(Float64(t1 / 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 <= 2.8e+172) tmp = -v * ((t1 / (u - t1)) / (u - t1)); else tmp = ((t1 / u) * -v) / (u - t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, 2.8e+172], N[((-v) * N[(N[(t1 / N[(u - t1), $MachinePrecision]), $MachinePrecision] / N[(u - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t1 / u), $MachinePrecision] * (-v)), $MachinePrecision] / N[(u - t1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq 2.8 \cdot 10^{+172}:\\
\;\;\;\;\left(-v\right) \cdot \frac{\frac{t1}{u - t1}}{u - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t1}{u} \cdot \left(-v\right)}{u - t1}\\
\end{array}
\end{array}
if u < 2.8e172Initial program 70.9%
Applied rewrites96.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.9
Applied rewrites94.9%
if 2.8e172 < u Initial program 75.3%
Applied rewrites99.0%
Taylor expanded in u around inf
lower-/.f6496.8
Applied rewrites96.8%
(FPCore (u v t1) :precision binary64 (if (<= t1 -1.3e-80) (/ v (- (fabs u) t1)) (if (<= t1 4.1e+24) (* (/ (- v) (* u u)) t1) (/ (* -1.0 v) (+ u t1)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.3e-80) {
tmp = v / (fabs(u) - t1);
} else if (t1 <= 4.1e+24) {
tmp = (-v / (u * u)) * t1;
} else {
tmp = (-1.0 * 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 <= (-1.3d-80)) then
tmp = v / (abs(u) - t1)
else if (t1 <= 4.1d+24) then
tmp = (-v / (u * u)) * t1
else
tmp = ((-1.0d0) * v) / (u + t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.3e-80) {
tmp = v / (Math.abs(u) - t1);
} else if (t1 <= 4.1e+24) {
tmp = (-v / (u * u)) * t1;
} else {
tmp = (-1.0 * v) / (u + t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -1.3e-80: tmp = v / (math.fabs(u) - t1) elif t1 <= 4.1e+24: tmp = (-v / (u * u)) * t1 else: tmp = (-1.0 * v) / (u + t1) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.3e-80) tmp = Float64(v / Float64(abs(u) - t1)); elseif (t1 <= 4.1e+24) tmp = Float64(Float64(Float64(-v) / Float64(u * u)) * t1); else tmp = Float64(Float64(-1.0 * v) / Float64(u + t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -1.3e-80) tmp = v / (abs(u) - t1); elseif (t1 <= 4.1e+24) tmp = (-v / (u * u)) * t1; else tmp = (-1.0 * v) / (u + t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -1.3e-80], N[(v / N[(N[Abs[u], $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 4.1e+24], N[(N[((-v) / N[(u * u), $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision], N[(N[(-1.0 * v), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.3 \cdot 10^{-80}:\\
\;\;\;\;\frac{v}{\left|u\right| - t1}\\
\mathbf{elif}\;t1 \leq 4.1 \cdot 10^{+24}:\\
\;\;\;\;\frac{-v}{u \cdot u} \cdot t1\\
\mathbf{else}:\\
\;\;\;\;\frac{-1 \cdot v}{u + t1}\\
\end{array}
\end{array}
if t1 < -1.3e-80Initial program 64.8%
Applied rewrites98.4%
Taylor expanded in u around 0
Applied rewrites76.1%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6476.6
Applied rewrites76.6%
Taylor expanded in u around 0
lower-/.f64N/A
lower--.f64N/A
lower-fabs.f6476.6
Applied rewrites76.6%
if -1.3e-80 < t1 < 4.1000000000000001e24Initial program 81.6%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6474.3
Applied rewrites74.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6479.4
Applied rewrites79.4%
if 4.1000000000000001e24 < t1 Initial program 66.3%
Applied rewrites98.6%
Taylor expanded in u around 0
Applied rewrites85.6%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6485.4
Applied rewrites85.4%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqr-neg-revN/A
sqrt-prodN/A
rem-square-sqrtN/A
lower-neg.f6485.6
Applied rewrites85.6%
Final simplification80.4%
(FPCore (u v t1) :precision binary64 (if (<= t1 -1.3e-80) (/ v (- (fabs u) t1)) (if (<= t1 4.1e+24) (* (/ (- v) (* u u)) t1) (/ (* -1.0 v) (+ (- u) t1)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.3e-80) {
tmp = v / (fabs(u) - t1);
} else if (t1 <= 4.1e+24) {
tmp = (-v / (u * u)) * t1;
} else {
tmp = (-1.0 * 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 <= (-1.3d-80)) then
tmp = v / (abs(u) - t1)
else if (t1 <= 4.1d+24) then
tmp = (-v / (u * u)) * t1
else
tmp = ((-1.0d0) * v) / (-u + t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.3e-80) {
tmp = v / (Math.abs(u) - t1);
} else if (t1 <= 4.1e+24) {
tmp = (-v / (u * u)) * t1;
} else {
tmp = (-1.0 * v) / (-u + t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -1.3e-80: tmp = v / (math.fabs(u) - t1) elif t1 <= 4.1e+24: tmp = (-v / (u * u)) * t1 else: tmp = (-1.0 * v) / (-u + t1) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.3e-80) tmp = Float64(v / Float64(abs(u) - t1)); elseif (t1 <= 4.1e+24) tmp = Float64(Float64(Float64(-v) / Float64(u * u)) * t1); else tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -1.3e-80) tmp = v / (abs(u) - t1); elseif (t1 <= 4.1e+24) tmp = (-v / (u * u)) * t1; else tmp = (-1.0 * v) / (-u + t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -1.3e-80], N[(v / N[(N[Abs[u], $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 4.1e+24], N[(N[((-v) / N[(u * u), $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.3 \cdot 10^{-80}:\\
\;\;\;\;\frac{v}{\left|u\right| - t1}\\
\mathbf{elif}\;t1 \leq 4.1 \cdot 10^{+24}:\\
\;\;\;\;\frac{-v}{u \cdot u} \cdot t1\\
\mathbf{else}:\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\end{array}
\end{array}
if t1 < -1.3e-80Initial program 64.8%
Applied rewrites98.4%
Taylor expanded in u around 0
Applied rewrites76.1%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6476.6
Applied rewrites76.6%
Taylor expanded in u around 0
lower-/.f64N/A
lower--.f64N/A
lower-fabs.f6476.6
Applied rewrites76.6%
if -1.3e-80 < t1 < 4.1000000000000001e24Initial program 81.6%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6474.3
Applied rewrites74.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6479.4
Applied rewrites79.4%
if 4.1000000000000001e24 < t1 Initial program 66.3%
Applied rewrites98.6%
Taylor expanded in u around 0
Applied rewrites85.6%
Final simplification80.4%
(FPCore (u v t1) :precision binary64 (if (<= t1 -1.3e-80) (/ v (- (fabs u) t1)) (if (<= t1 4.1e+24) (* v (/ (- t1) (* u u))) (/ (* -1.0 v) (+ (- u) t1)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.3e-80) {
tmp = v / (fabs(u) - t1);
} else if (t1 <= 4.1e+24) {
tmp = v * (-t1 / (u * u));
} else {
tmp = (-1.0 * 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 <= (-1.3d-80)) then
tmp = v / (abs(u) - t1)
else if (t1 <= 4.1d+24) then
tmp = v * (-t1 / (u * u))
else
tmp = ((-1.0d0) * v) / (-u + t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.3e-80) {
tmp = v / (Math.abs(u) - t1);
} else if (t1 <= 4.1e+24) {
tmp = v * (-t1 / (u * u));
} else {
tmp = (-1.0 * v) / (-u + t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -1.3e-80: tmp = v / (math.fabs(u) - t1) elif t1 <= 4.1e+24: tmp = v * (-t1 / (u * u)) else: tmp = (-1.0 * v) / (-u + t1) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.3e-80) tmp = Float64(v / Float64(abs(u) - t1)); elseif (t1 <= 4.1e+24) tmp = Float64(v * Float64(Float64(-t1) / Float64(u * u))); else tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -1.3e-80) tmp = v / (abs(u) - t1); elseif (t1 <= 4.1e+24) tmp = v * (-t1 / (u * u)); else tmp = (-1.0 * v) / (-u + t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -1.3e-80], N[(v / N[(N[Abs[u], $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 4.1e+24], N[(v * N[((-t1) / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.3 \cdot 10^{-80}:\\
\;\;\;\;\frac{v}{\left|u\right| - t1}\\
\mathbf{elif}\;t1 \leq 4.1 \cdot 10^{+24}:\\
\;\;\;\;v \cdot \frac{-t1}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\end{array}
\end{array}
if t1 < -1.3e-80Initial program 64.8%
Applied rewrites98.4%
Taylor expanded in u around 0
Applied rewrites76.1%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6476.6
Applied rewrites76.6%
Taylor expanded in u around 0
lower-/.f64N/A
lower--.f64N/A
lower-fabs.f6476.6
Applied rewrites76.6%
if -1.3e-80 < t1 < 4.1000000000000001e24Initial program 81.6%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6474.3
Applied rewrites74.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6476.6
Applied rewrites76.6%
if 4.1000000000000001e24 < t1 Initial program 66.3%
Applied rewrites98.6%
Taylor expanded in u around 0
Applied rewrites85.6%
Final simplification79.3%
(FPCore (u v t1) :precision binary64 (if (or (<= u -105000000000.0) (not (<= u 4.5e+162))) (/ (* v t1) (* u u)) (/ v (- (fabs u) t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -105000000000.0) || !(u <= 4.5e+162)) {
tmp = (v * t1) / (u * u);
} else {
tmp = v / (fabs(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 <= (-105000000000.0d0)) .or. (.not. (u <= 4.5d+162))) then
tmp = (v * t1) / (u * u)
else
tmp = v / (abs(u) - t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -105000000000.0) || !(u <= 4.5e+162)) {
tmp = (v * t1) / (u * u);
} else {
tmp = v / (Math.abs(u) - t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -105000000000.0) or not (u <= 4.5e+162): tmp = (v * t1) / (u * u) else: tmp = v / (math.fabs(u) - t1) return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -105000000000.0) || !(u <= 4.5e+162)) tmp = Float64(Float64(v * t1) / Float64(u * u)); else tmp = Float64(v / Float64(abs(u) - t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -105000000000.0) || ~((u <= 4.5e+162))) tmp = (v * t1) / (u * u); else tmp = v / (abs(u) - t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -105000000000.0], N[Not[LessEqual[u, 4.5e+162]], $MachinePrecision]], N[(N[(v * t1), $MachinePrecision] / N[(u * u), $MachinePrecision]), $MachinePrecision], N[(v / N[(N[Abs[u], $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -105000000000 \lor \neg \left(u \leq 4.5 \cdot 10^{+162}\right):\\
\;\;\;\;\frac{v \cdot t1}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{\left|u\right| - t1}\\
\end{array}
\end{array}
if u < -1.05e11 or 4.49999999999999972e162 < u Initial program 78.4%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6489.9
Applied rewrites89.9%
Applied rewrites91.7%
Applied rewrites65.3%
if -1.05e11 < u < 4.49999999999999972e162Initial program 67.0%
Applied rewrites97.2%
Taylor expanded in u around 0
Applied rewrites75.7%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6475.8
Applied rewrites75.8%
Taylor expanded in u around 0
lower-/.f64N/A
lower--.f64N/A
lower-fabs.f6475.8
Applied rewrites75.8%
Final simplification71.6%
(FPCore (u v t1) :precision binary64 (/ v (- (fabs u) t1)))
double code(double u, double v, double t1) {
return v / (fabs(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 / (abs(u) - t1)
end function
public static double code(double u, double v, double t1) {
return v / (Math.abs(u) - t1);
}
def code(u, v, t1): return v / (math.fabs(u) - t1)
function code(u, v, t1) return Float64(v / Float64(abs(u) - t1)) end
function tmp = code(u, v, t1) tmp = v / (abs(u) - t1); end
code[u_, v_, t1_] := N[(v / N[(N[Abs[u], $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{\left|u\right| - t1}
\end{array}
Initial program 71.6%
Applied rewrites96.7%
Taylor expanded in u around 0
Applied rewrites63.0%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6463.0
Applied rewrites63.0%
Taylor expanded in u around 0
lower-/.f64N/A
lower--.f64N/A
lower-fabs.f6463.0
Applied rewrites63.0%
(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.6%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6455.3
Applied rewrites55.3%
herbie shell --seed 2024351
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))