
(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 12 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 75.5%
Applied rewrites96.9%
Final simplification96.9%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))) (t_2 (/ (- v) t1)))
(if (<= t_1 (- INFINITY))
t_2
(if (<= t_1 -2e-308)
t_1
(if (<= t_1 0.0)
(* (- t1) (/ (/ v (- u t1)) u))
(if (<= t_1 2e+283) t_1 t_2))))))
double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double t_2 = -v / t1;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 <= -2e-308) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = -t1 * ((v / (u - t1)) / u);
} else if (t_1 <= 2e+283) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double t_2 = -v / t1;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = t_2;
} else if (t_1 <= -2e-308) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = -t1 * ((v / (u - t1)) / u);
} else if (t_1 <= 2e+283) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(u, v, t1): t_1 = (-t1 * v) / ((t1 + u) * (t1 + u)) t_2 = -v / t1 tmp = 0 if t_1 <= -math.inf: tmp = t_2 elif t_1 <= -2e-308: tmp = t_1 elif t_1 <= 0.0: tmp = -t1 * ((v / (u - t1)) / u) elif t_1 <= 2e+283: tmp = t_1 else: tmp = t_2 return tmp
function code(u, v, t1) t_1 = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) t_2 = Float64(Float64(-v) / t1) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_2; elseif (t_1 <= -2e-308) tmp = t_1; elseif (t_1 <= 0.0) tmp = Float64(Float64(-t1) * Float64(Float64(v / Float64(u - t1)) / u)); elseif (t_1 <= 2e+283) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-t1 * v) / ((t1 + u) * (t1 + u)); t_2 = -v / t1; tmp = 0.0; if (t_1 <= -Inf) tmp = t_2; elseif (t_1 <= -2e-308) tmp = t_1; elseif (t_1 <= 0.0) tmp = -t1 * ((v / (u - t1)) / u); elseif (t_1 <= 2e+283) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-v) / t1), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, If[LessEqual[t$95$1, -2e-308], t$95$1, If[LessEqual[t$95$1, 0.0], N[((-t1) * N[(N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+283], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
t_2 := \frac{-v}{t1}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-308}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\left(-t1\right) \cdot \frac{\frac{v}{u - t1}}{u}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+283}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 (neg.f64 t1) v) (*.f64 (+.f64 t1 u) (+.f64 t1 u))) < -inf.0 or 1.99999999999999991e283 < (/.f64 (*.f64 (neg.f64 t1) v) (*.f64 (+.f64 t1 u) (+.f64 t1 u))) Initial program 24.2%
Taylor expanded in u around 0
Applied rewrites94.0%
if -inf.0 < (/.f64 (*.f64 (neg.f64 t1) v) (*.f64 (+.f64 t1 u) (+.f64 t1 u))) < -1.9999999999999998e-308 or -0.0 < (/.f64 (*.f64 (neg.f64 t1) v) (*.f64 (+.f64 t1 u) (+.f64 t1 u))) < 1.99999999999999991e283Initial program 98.9%
if -1.9999999999999998e-308 < (/.f64 (*.f64 (neg.f64 t1) v) (*.f64 (+.f64 t1 u) (+.f64 t1 u))) < -0.0Initial program 76.7%
Applied rewrites97.4%
Taylor expanded in u around inf
Applied rewrites71.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-neg.f64N/A
distribute-rgt-neg-inN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lift-*.f64N/A
lower-/.f6470.6
Applied rewrites70.6%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f6486.6
Applied rewrites86.6%
Final simplification92.8%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))) (if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+283))) (/ (- v) t1) t_1)))
double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+283)) {
tmp = -v / t1;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+283)) {
tmp = -v / t1;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (-t1 * v) / ((t1 + u) * (t1 + u)) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e+283): tmp = -v / t1 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+283)) tmp = Float64(Float64(-v) / t1); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-t1 * v) / ((t1 + u) * (t1 + u)); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 2e+283))) tmp = -v / t1; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+283]], $MachinePrecision]], N[((-v) / t1), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{+283}\right):\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 (neg.f64 t1) v) (*.f64 (+.f64 t1 u) (+.f64 t1 u))) < -inf.0 or 1.99999999999999991e283 < (/.f64 (*.f64 (neg.f64 t1) v) (*.f64 (+.f64 t1 u) (+.f64 t1 u))) Initial program 24.2%
Taylor expanded in u around 0
Applied rewrites94.0%
if -inf.0 < (/.f64 (*.f64 (neg.f64 t1) v) (*.f64 (+.f64 t1 u) (+.f64 t1 u))) < 1.99999999999999991e283Initial program 87.4%
Final simplification88.6%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -9.5e-75) (not (<= t1 8.2e-119))) (/ v (- u t1)) (/ (* t1 (/ (- v) u)) u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -9.5e-75) || !(t1 <= 8.2e-119)) {
tmp = v / (u - t1);
} else {
tmp = (t1 * (-v / u)) / 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 ((t1 <= (-9.5d-75)) .or. (.not. (t1 <= 8.2d-119))) then
tmp = v / (u - t1)
else
tmp = (t1 * (-v / u)) / u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -9.5e-75) || !(t1 <= 8.2e-119)) {
tmp = v / (u - t1);
} else {
tmp = (t1 * (-v / u)) / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -9.5e-75) or not (t1 <= 8.2e-119): tmp = v / (u - t1) else: tmp = (t1 * (-v / u)) / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -9.5e-75) || !(t1 <= 8.2e-119)) tmp = Float64(v / Float64(u - t1)); else tmp = Float64(Float64(t1 * Float64(Float64(-v) / u)) / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -9.5e-75) || ~((t1 <= 8.2e-119))) tmp = v / (u - t1); else tmp = (t1 * (-v / u)) / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -9.5e-75], N[Not[LessEqual[t1, 8.2e-119]], $MachinePrecision]], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision], N[(N[(t1 * N[((-v) / u), $MachinePrecision]), $MachinePrecision] / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -9.5 \cdot 10^{-75} \lor \neg \left(t1 \leq 8.2 \cdot 10^{-119}\right):\\
\;\;\;\;\frac{v}{u - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1 \cdot \frac{-v}{u}}{u}\\
\end{array}
\end{array}
if t1 < -9.4999999999999991e-75 or 8.20000000000000041e-119 < t1 Initial program 71.5%
Applied rewrites98.6%
Taylor expanded in u around 0
Applied rewrites82.8%
if -9.4999999999999991e-75 < t1 < 8.20000000000000041e-119Initial program 84.0%
Applied rewrites93.1%
Taylor expanded in u around 0
Applied rewrites30.2%
Taylor expanded in u around inf
Applied rewrites14.8%
Taylor expanded in u around inf
Applied rewrites85.8%
Final simplification83.8%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -9.5e-75) (not (<= t1 8.2e-119))) (/ v (- u t1)) (* (/ t1 u) (/ (- v) u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -9.5e-75) || !(t1 <= 8.2e-119)) {
tmp = v / (u - t1);
} else {
tmp = (t1 / u) * (-v / u);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-9.5d-75)) .or. (.not. (t1 <= 8.2d-119))) then
tmp = v / (u - t1)
else
tmp = (t1 / u) * (-v / u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -9.5e-75) || !(t1 <= 8.2e-119)) {
tmp = v / (u - t1);
} else {
tmp = (t1 / u) * (-v / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -9.5e-75) or not (t1 <= 8.2e-119): tmp = v / (u - t1) else: tmp = (t1 / u) * (-v / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -9.5e-75) || !(t1 <= 8.2e-119)) tmp = Float64(v / Float64(u - t1)); else tmp = Float64(Float64(t1 / u) * Float64(Float64(-v) / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -9.5e-75) || ~((t1 <= 8.2e-119))) tmp = v / (u - t1); else tmp = (t1 / u) * (-v / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -9.5e-75], N[Not[LessEqual[t1, 8.2e-119]], $MachinePrecision]], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision], N[(N[(t1 / u), $MachinePrecision] * N[((-v) / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -9.5 \cdot 10^{-75} \lor \neg \left(t1 \leq 8.2 \cdot 10^{-119}\right):\\
\;\;\;\;\frac{v}{u - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1}{u} \cdot \frac{-v}{u}\\
\end{array}
\end{array}
if t1 < -9.4999999999999991e-75 or 8.20000000000000041e-119 < t1 Initial program 71.5%
Applied rewrites98.6%
Taylor expanded in u around 0
Applied rewrites82.8%
if -9.4999999999999991e-75 < t1 < 8.20000000000000041e-119Initial program 84.0%
Taylor expanded in u around inf
Applied rewrites80.5%
Final simplification82.1%
(FPCore (u v t1) :precision binary64 (if (<= u 3.1e+133) (* (- v) (/ (/ t1 (- u t1)) (- u t1))) (/ (* t1 (/ (- v) u)) u)))
double code(double u, double v, double t1) {
double tmp;
if (u <= 3.1e+133) {
tmp = -v * ((t1 / (u - t1)) / (u - t1));
} else {
tmp = (t1 * (-v / u)) / u;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (u <= 3.1d+133) then
tmp = -v * ((t1 / (u - t1)) / (u - t1))
else
tmp = (t1 * (-v / u)) / u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= 3.1e+133) {
tmp = -v * ((t1 / (u - t1)) / (u - t1));
} else {
tmp = (t1 * (-v / u)) / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= 3.1e+133: tmp = -v * ((t1 / (u - t1)) / (u - t1)) else: tmp = (t1 * (-v / u)) / u return tmp
function code(u, v, t1) tmp = 0.0 if (u <= 3.1e+133) tmp = Float64(Float64(-v) * Float64(Float64(t1 / Float64(u - t1)) / Float64(u - t1))); else tmp = Float64(Float64(t1 * Float64(Float64(-v) / u)) / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= 3.1e+133) tmp = -v * ((t1 / (u - t1)) / (u - t1)); else tmp = (t1 * (-v / u)) / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, 3.1e+133], N[((-v) * N[(N[(t1 / N[(u - t1), $MachinePrecision]), $MachinePrecision] / N[(u - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t1 * N[((-v) / u), $MachinePrecision]), $MachinePrecision] / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq 3.1 \cdot 10^{+133}:\\
\;\;\;\;\left(-v\right) \cdot \frac{\frac{t1}{u - t1}}{u - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1 \cdot \frac{-v}{u}}{u}\\
\end{array}
\end{array}
if u < 3.1e133Initial program 74.9%
Applied rewrites96.8%
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lower-/.f6494.5
Applied rewrites94.5%
if 3.1e133 < u Initial program 79.6%
Applied rewrites97.0%
Taylor expanded in u around 0
Applied rewrites40.1%
Taylor expanded in u around inf
Applied rewrites40.1%
Taylor expanded in u around inf
Applied rewrites99.9%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -4e-84) (not (<= t1 8.2e-119))) (/ v (- u t1)) (/ (* (- t1) v) (* u u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -4e-84) || !(t1 <= 8.2e-119)) {
tmp = v / (u - t1);
} else {
tmp = (-t1 * v) / (u * 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 ((t1 <= (-4d-84)) .or. (.not. (t1 <= 8.2d-119))) then
tmp = v / (u - t1)
else
tmp = (-t1 * v) / (u * u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -4e-84) || !(t1 <= 8.2e-119)) {
tmp = v / (u - t1);
} else {
tmp = (-t1 * v) / (u * u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -4e-84) or not (t1 <= 8.2e-119): tmp = v / (u - t1) else: tmp = (-t1 * v) / (u * u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -4e-84) || !(t1 <= 8.2e-119)) tmp = Float64(v / Float64(u - t1)); else tmp = Float64(Float64(Float64(-t1) * v) / Float64(u * u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -4e-84) || ~((t1 <= 8.2e-119))) tmp = v / (u - t1); else tmp = (-t1 * v) / (u * u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -4e-84], N[Not[LessEqual[t1, 8.2e-119]], $MachinePrecision]], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) * v), $MachinePrecision] / N[(u * u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -4 \cdot 10^{-84} \lor \neg \left(t1 \leq 8.2 \cdot 10^{-119}\right):\\
\;\;\;\;\frac{v}{u - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{u \cdot u}\\
\end{array}
\end{array}
if t1 < -4.0000000000000001e-84 or 8.20000000000000041e-119 < t1 Initial program 71.1%
Applied rewrites98.7%
Taylor expanded in u around 0
Applied rewrites82.1%
if -4.0000000000000001e-84 < t1 < 8.20000000000000041e-119Initial program 85.7%
Taylor expanded in u around inf
Applied rewrites81.5%
Final simplification81.9%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -4e-84) (not (<= t1 8.2e-119))) (/ v (- u t1)) (* (/ (- v) (* u u)) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -4e-84) || !(t1 <= 8.2e-119)) {
tmp = v / (u - t1);
} else {
tmp = (-v / (u * 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 <= (-4d-84)) .or. (.not. (t1 <= 8.2d-119))) then
tmp = v / (u - t1)
else
tmp = (-v / (u * u)) * t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -4e-84) || !(t1 <= 8.2e-119)) {
tmp = v / (u - t1);
} else {
tmp = (-v / (u * u)) * t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -4e-84) or not (t1 <= 8.2e-119): tmp = v / (u - t1) else: tmp = (-v / (u * u)) * t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -4e-84) || !(t1 <= 8.2e-119)) tmp = Float64(v / Float64(u - t1)); else tmp = Float64(Float64(Float64(-v) / Float64(u * u)) * t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -4e-84) || ~((t1 <= 8.2e-119))) tmp = v / (u - t1); else tmp = (-v / (u * u)) * t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -4e-84], N[Not[LessEqual[t1, 8.2e-119]], $MachinePrecision]], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision], N[(N[((-v) / N[(u * u), $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -4 \cdot 10^{-84} \lor \neg \left(t1 \leq 8.2 \cdot 10^{-119}\right):\\
\;\;\;\;\frac{v}{u - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u \cdot u} \cdot t1\\
\end{array}
\end{array}
if t1 < -4.0000000000000001e-84 or 8.20000000000000041e-119 < t1 Initial program 71.1%
Applied rewrites98.7%
Taylor expanded in u around 0
Applied rewrites82.1%
if -4.0000000000000001e-84 < t1 < 8.20000000000000041e-119Initial program 85.7%
Taylor expanded in u around inf
Applied rewrites81.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6480.1
Applied rewrites80.1%
Final simplification81.5%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -4e-84) (not (<= t1 8.2e-119))) (/ v (- u t1)) (* v (/ (- t1) (* u u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -4e-84) || !(t1 <= 8.2e-119)) {
tmp = v / (u - t1);
} else {
tmp = v * (-t1 / (u * 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 ((t1 <= (-4d-84)) .or. (.not. (t1 <= 8.2d-119))) then
tmp = v / (u - t1)
else
tmp = v * (-t1 / (u * u))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -4e-84) || !(t1 <= 8.2e-119)) {
tmp = v / (u - t1);
} else {
tmp = v * (-t1 / (u * u));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -4e-84) or not (t1 <= 8.2e-119): tmp = v / (u - t1) else: tmp = v * (-t1 / (u * u)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -4e-84) || !(t1 <= 8.2e-119)) tmp = Float64(v / Float64(u - t1)); else tmp = Float64(v * Float64(Float64(-t1) / Float64(u * u))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -4e-84) || ~((t1 <= 8.2e-119))) tmp = v / (u - t1); else tmp = v * (-t1 / (u * u)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -4e-84], N[Not[LessEqual[t1, 8.2e-119]], $MachinePrecision]], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision], N[(v * N[((-t1) / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -4 \cdot 10^{-84} \lor \neg \left(t1 \leq 8.2 \cdot 10^{-119}\right):\\
\;\;\;\;\frac{v}{u - t1}\\
\mathbf{else}:\\
\;\;\;\;v \cdot \frac{-t1}{u \cdot u}\\
\end{array}
\end{array}
if t1 < -4.0000000000000001e-84 or 8.20000000000000041e-119 < t1 Initial program 71.1%
Applied rewrites98.7%
Taylor expanded in u around 0
Applied rewrites82.1%
if -4.0000000000000001e-84 < t1 < 8.20000000000000041e-119Initial program 85.7%
Taylor expanded in u around inf
Applied rewrites81.5%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6478.0
Applied rewrites78.0%
Final simplification80.8%
(FPCore (u v t1) :precision binary64 (if (or (<= u -5.8e+152) (not (<= u 1.3e+133))) (/ v u) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -5.8e+152) || !(u <= 1.3e+133)) {
tmp = v / u;
} else {
tmp = -v / 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 <= (-5.8d+152)) .or. (.not. (u <= 1.3d+133))) then
tmp = v / u
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -5.8e+152) || !(u <= 1.3e+133)) {
tmp = v / u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -5.8e+152) or not (u <= 1.3e+133): tmp = v / u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -5.8e+152) || !(u <= 1.3e+133)) tmp = Float64(v / u); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -5.8e+152) || ~((u <= 1.3e+133))) tmp = v / u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -5.8e+152], N[Not[LessEqual[u, 1.3e+133]], $MachinePrecision]], N[(v / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -5.8 \cdot 10^{+152} \lor \neg \left(u \leq 1.3 \cdot 10^{+133}\right):\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -5.7999999999999997e152 or 1.2999999999999999e133 < u Initial program 75.1%
Applied rewrites95.7%
Taylor expanded in u around 0
Applied rewrites48.6%
Taylor expanded in u around inf
Applied rewrites44.3%
if -5.7999999999999997e152 < u < 1.2999999999999999e133Initial program 75.6%
Taylor expanded in u around 0
Applied rewrites70.6%
Final simplification63.9%
(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(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 75.5%
Applied rewrites96.9%
Taylor expanded in u around 0
Applied rewrites65.9%
Final simplification65.9%
(FPCore (u v t1) :precision binary64 (/ v u))
double code(double u, double v, double t1) {
return v / 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 = v / u
end function
public static double code(double u, double v, double t1) {
return v / u;
}
def code(u, v, t1): return v / u
function code(u, v, t1) return Float64(v / u) end
function tmp = code(u, v, t1) tmp = v / u; end
code[u_, v_, t1_] := N[(v / u), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{u}
\end{array}
Initial program 75.5%
Applied rewrites96.9%
Taylor expanded in u around 0
Applied rewrites65.9%
Taylor expanded in u around inf
Applied rewrites18.8%
Final simplification18.8%
herbie shell --seed 2025020
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))