
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1): return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}
(FPCore (u v t1) :precision binary64 (/ (* (/ t1 (- 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 69.3%
Applied rewrites94.6%
Final simplification94.6%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))))
(if (<= t1 -1.8e+41)
(/ (* -1.0 v) (+ (- u) t1))
(if (<= t1 -5.5e-204)
t_1
(if (<= t1 1.75e-172)
(* v (/ (/ (- t1) u) u))
(if (<= t1 4.2e+76) t_1 (/ (fma (* (/ v t1) u) 2.0 (- v)) t1)))))))
double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double tmp;
if (t1 <= -1.8e+41) {
tmp = (-1.0 * v) / (-u + t1);
} else if (t1 <= -5.5e-204) {
tmp = t_1;
} else if (t1 <= 1.75e-172) {
tmp = v * ((-t1 / u) / u);
} else if (t1 <= 4.2e+76) {
tmp = t_1;
} else {
tmp = fma(((v / t1) * u), 2.0, -v) / t1;
}
return tmp;
}
function code(u, v, t1) t_1 = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) tmp = 0.0 if (t1 <= -1.8e+41) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); elseif (t1 <= -5.5e-204) tmp = t_1; elseif (t1 <= 1.75e-172) tmp = Float64(v * Float64(Float64(Float64(-t1) / u) / u)); elseif (t1 <= 4.2e+76) tmp = t_1; else tmp = Float64(fma(Float64(Float64(v / t1) * u), 2.0, Float64(-v)) / t1); end return tmp end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.8e+41], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, -5.5e-204], t$95$1, If[LessEqual[t1, 1.75e-172], N[(v * N[(N[((-t1) / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 4.2e+76], t$95$1, N[(N[(N[(N[(v / t1), $MachinePrecision] * u), $MachinePrecision] * 2.0 + (-v)), $MachinePrecision] / t1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{if}\;t1 \leq -1.8 \cdot 10^{+41}:\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{elif}\;t1 \leq -5.5 \cdot 10^{-204}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 1.75 \cdot 10^{-172}:\\
\;\;\;\;v \cdot \frac{\frac{-t1}{u}}{u}\\
\mathbf{elif}\;t1 \leq 4.2 \cdot 10^{+76}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{v}{t1} \cdot u, 2, -v\right)}{t1}\\
\end{array}
\end{array}
if t1 < -1.80000000000000013e41Initial program 60.7%
Applied rewrites97.2%
Taylor expanded in u around 0
Applied rewrites93.1%
if -1.80000000000000013e41 < t1 < -5.4999999999999999e-204 or 1.75000000000000014e-172 < t1 < 4.20000000000000013e76Initial program 92.1%
if -5.4999999999999999e-204 < t1 < 1.75000000000000014e-172Initial program 66.6%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6479.1
Applied rewrites79.1%
Applied rewrites84.9%
if 4.20000000000000013e76 < t1 Initial program 43.9%
Taylor expanded in u around 0
associate-*r/N/A
unpow2N/A
associate-/r*N/A
associate-/l*N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6488.8
Applied rewrites88.8%
Final simplification89.9%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))))
(if (<= t1 -1.8e+41)
(/ (* -1.0 v) (+ (- u) t1))
(if (<= t1 -5.5e-204)
t_1
(if (<= t1 1.75e-172)
(* v (/ (/ (- t1) u) u))
(if (<= t1 6.2e+76) t_1 (* (- v) (/ (fma (/ u t1) -2.0 1.0) t1))))))))
double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double tmp;
if (t1 <= -1.8e+41) {
tmp = (-1.0 * v) / (-u + t1);
} else if (t1 <= -5.5e-204) {
tmp = t_1;
} else if (t1 <= 1.75e-172) {
tmp = v * ((-t1 / u) / u);
} else if (t1 <= 6.2e+76) {
tmp = t_1;
} else {
tmp = -v * (fma((u / t1), -2.0, 1.0) / t1);
}
return tmp;
}
function code(u, v, t1) t_1 = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) tmp = 0.0 if (t1 <= -1.8e+41) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); elseif (t1 <= -5.5e-204) tmp = t_1; elseif (t1 <= 1.75e-172) tmp = Float64(v * Float64(Float64(Float64(-t1) / u) / u)); elseif (t1 <= 6.2e+76) tmp = t_1; else tmp = Float64(Float64(-v) * Float64(fma(Float64(u / t1), -2.0, 1.0) / t1)); end return tmp end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.8e+41], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, -5.5e-204], t$95$1, If[LessEqual[t1, 1.75e-172], N[(v * N[(N[((-t1) / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 6.2e+76], t$95$1, N[((-v) * N[(N[(N[(u / t1), $MachinePrecision] * -2.0 + 1.0), $MachinePrecision] / t1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{if}\;t1 \leq -1.8 \cdot 10^{+41}:\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{elif}\;t1 \leq -5.5 \cdot 10^{-204}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 1.75 \cdot 10^{-172}:\\
\;\;\;\;v \cdot \frac{\frac{-t1}{u}}{u}\\
\mathbf{elif}\;t1 \leq 6.2 \cdot 10^{+76}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(-v\right) \cdot \frac{\mathsf{fma}\left(\frac{u}{t1}, -2, 1\right)}{t1}\\
\end{array}
\end{array}
if t1 < -1.80000000000000013e41Initial program 60.7%
Applied rewrites97.2%
Taylor expanded in u around 0
Applied rewrites93.1%
if -1.80000000000000013e41 < t1 < -5.4999999999999999e-204 or 1.75000000000000014e-172 < t1 < 6.20000000000000023e76Initial program 92.1%
if -5.4999999999999999e-204 < t1 < 1.75000000000000014e-172Initial program 66.6%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6479.1
Applied rewrites79.1%
Applied rewrites84.9%
if 6.20000000000000023e76 < t1 Initial program 43.9%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6488.0
Applied rewrites88.0%
Applied rewrites87.8%
Taylor expanded in u around 0
mul-1-negN/A
metadata-evalN/A
distribute-lft-neg-outN/A
unpow2N/A
associate-/r*N/A
associate-/l*N/A
distribute-neg-inN/A
div-addN/A
*-lft-identityN/A
associate-*r/N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
distribute-rgt-inN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
Applied rewrites88.6%
Final simplification89.8%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
(t_2 (/ (* -1.0 v) (+ (- u) t1))))
(if (<= t1 -1.8e+41)
t_2
(if (<= t1 -5.5e-204)
t_1
(if (<= t1 1.75e-172)
(* v (/ (/ (- t1) u) u))
(if (<= t1 9.6e+69) t_1 t_2))))))
double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double t_2 = (-1.0 * v) / (-u + t1);
double tmp;
if (t1 <= -1.8e+41) {
tmp = t_2;
} else if (t1 <= -5.5e-204) {
tmp = t_1;
} else if (t1 <= 1.75e-172) {
tmp = v * ((-t1 / u) / u);
} else if (t1 <= 9.6e+69) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-t1 * v) / ((t1 + u) * (t1 + u))
t_2 = ((-1.0d0) * v) / (-u + t1)
if (t1 <= (-1.8d+41)) then
tmp = t_2
else if (t1 <= (-5.5d-204)) then
tmp = t_1
else if (t1 <= 1.75d-172) then
tmp = v * ((-t1 / u) / u)
else if (t1 <= 9.6d+69) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double t_2 = (-1.0 * v) / (-u + t1);
double tmp;
if (t1 <= -1.8e+41) {
tmp = t_2;
} else if (t1 <= -5.5e-204) {
tmp = t_1;
} else if (t1 <= 1.75e-172) {
tmp = v * ((-t1 / u) / u);
} else if (t1 <= 9.6e+69) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(u, v, t1): t_1 = (-t1 * v) / ((t1 + u) * (t1 + u)) t_2 = (-1.0 * v) / (-u + t1) tmp = 0 if t1 <= -1.8e+41: tmp = t_2 elif t1 <= -5.5e-204: tmp = t_1 elif t1 <= 1.75e-172: tmp = v * ((-t1 / u) / u) elif t1 <= 9.6e+69: 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(-1.0 * v) / Float64(Float64(-u) + t1)) tmp = 0.0 if (t1 <= -1.8e+41) tmp = t_2; elseif (t1 <= -5.5e-204) tmp = t_1; elseif (t1 <= 1.75e-172) tmp = Float64(v * Float64(Float64(Float64(-t1) / u) / u)); elseif (t1 <= 9.6e+69) 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 = (-1.0 * v) / (-u + t1); tmp = 0.0; if (t1 <= -1.8e+41) tmp = t_2; elseif (t1 <= -5.5e-204) tmp = t_1; elseif (t1 <= 1.75e-172) tmp = v * ((-t1 / u) / u); elseif (t1 <= 9.6e+69) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.8e+41], t$95$2, If[LessEqual[t1, -5.5e-204], t$95$1, If[LessEqual[t1, 1.75e-172], N[(v * N[(N[((-t1) / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 9.6e+69], 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{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{if}\;t1 \leq -1.8 \cdot 10^{+41}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t1 \leq -5.5 \cdot 10^{-204}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 1.75 \cdot 10^{-172}:\\
\;\;\;\;v \cdot \frac{\frac{-t1}{u}}{u}\\
\mathbf{elif}\;t1 \leq 9.6 \cdot 10^{+69}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t1 < -1.80000000000000013e41 or 9.6000000000000007e69 < t1 Initial program 52.0%
Applied rewrites97.0%
Taylor expanded in u around 0
Applied rewrites90.5%
if -1.80000000000000013e41 < t1 < -5.4999999999999999e-204 or 1.75000000000000014e-172 < t1 < 9.6000000000000007e69Initial program 92.1%
if -5.4999999999999999e-204 < t1 < 1.75000000000000014e-172Initial program 66.6%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6479.1
Applied rewrites79.1%
Applied rewrites84.9%
Final simplification89.7%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (* -1.0 v) (+ (- u) t1))))
(if (<= t1 -2.8e+16)
t_1
(if (<= t1 -4.8e-132)
(* (/ (/ (- v) u) u) t1)
(if (<= t1 1.7e+54) (* v (/ (/ (- t1) u) u)) t_1)))))
double code(double u, double v, double t1) {
double t_1 = (-1.0 * v) / (-u + t1);
double tmp;
if (t1 <= -2.8e+16) {
tmp = t_1;
} else if (t1 <= -4.8e-132) {
tmp = ((-v / u) / u) * t1;
} else if (t1 <= 1.7e+54) {
tmp = v * ((-t1 / u) / u);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: tmp
t_1 = ((-1.0d0) * v) / (-u + t1)
if (t1 <= (-2.8d+16)) then
tmp = t_1
else if (t1 <= (-4.8d-132)) then
tmp = ((-v / u) / u) * t1
else if (t1 <= 1.7d+54) then
tmp = v * ((-t1 / u) / u)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (-1.0 * v) / (-u + t1);
double tmp;
if (t1 <= -2.8e+16) {
tmp = t_1;
} else if (t1 <= -4.8e-132) {
tmp = ((-v / u) / u) * t1;
} else if (t1 <= 1.7e+54) {
tmp = v * ((-t1 / u) / u);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (-1.0 * v) / (-u + t1) tmp = 0 if t1 <= -2.8e+16: tmp = t_1 elif t1 <= -4.8e-132: tmp = ((-v / u) / u) * t1 elif t1 <= 1.7e+54: tmp = v * ((-t1 / u) / u) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)) tmp = 0.0 if (t1 <= -2.8e+16) tmp = t_1; elseif (t1 <= -4.8e-132) tmp = Float64(Float64(Float64(Float64(-v) / u) / u) * t1); elseif (t1 <= 1.7e+54) tmp = Float64(v * Float64(Float64(Float64(-t1) / u) / u)); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-1.0 * v) / (-u + t1); tmp = 0.0; if (t1 <= -2.8e+16) tmp = t_1; elseif (t1 <= -4.8e-132) tmp = ((-v / u) / u) * t1; elseif (t1 <= 1.7e+54) tmp = v * ((-t1 / u) / u); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -2.8e+16], t$95$1, If[LessEqual[t1, -4.8e-132], N[(N[(N[((-v) / u), $MachinePrecision] / u), $MachinePrecision] * t1), $MachinePrecision], If[LessEqual[t1, 1.7e+54], N[(v * N[(N[((-t1) / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{if}\;t1 \leq -2.8 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq -4.8 \cdot 10^{-132}:\\
\;\;\;\;\frac{\frac{-v}{u}}{u} \cdot t1\\
\mathbf{elif}\;t1 \leq 1.7 \cdot 10^{+54}:\\
\;\;\;\;v \cdot \frac{\frac{-t1}{u}}{u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -2.8e16 or 1.7e54 < t1 Initial program 52.5%
Applied rewrites97.0%
Taylor expanded in u around 0
Applied rewrites90.6%
if -2.8e16 < t1 < -4.80000000000000031e-132Initial program 84.8%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6471.5
Applied rewrites71.5%
Applied rewrites71.3%
Taylor expanded in u around 0
Applied rewrites71.3%
if -4.80000000000000031e-132 < t1 < 1.7e54Initial program 80.5%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6481.4
Applied rewrites81.4%
Applied rewrites83.4%
Final simplification84.9%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.8e+16) (not (<= t1 3.05e+56))) (/ (* -1.0 v) (+ (- u) t1)) (* (/ (- v) u) (/ t1 u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.8e+16) || !(t1 <= 3.05e+56)) {
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 ((t1 <= (-2.8d+16)) .or. (.not. (t1 <= 3.05d+56))) 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 ((t1 <= -2.8e+16) || !(t1 <= 3.05e+56)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (-v / u) * (t1 / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.8e+16) or not (t1 <= 3.05e+56): tmp = (-1.0 * v) / (-u + t1) else: tmp = (-v / u) * (t1 / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.8e+16) || !(t1 <= 3.05e+56)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(Float64(-v) / u) * Float64(t1 / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -2.8e+16) || ~((t1 <= 3.05e+56))) tmp = (-1.0 * v) / (-u + t1); else tmp = (-v / u) * (t1 / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -2.8e+16], N[Not[LessEqual[t1, 3.05e+56]], $MachinePrecision]], 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}\;t1 \leq -2.8 \cdot 10^{+16} \lor \neg \left(t1 \leq 3.05 \cdot 10^{+56}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u} \cdot \frac{t1}{u}\\
\end{array}
\end{array}
if t1 < -2.8e16 or 3.0500000000000001e56 < t1 Initial program 52.5%
Applied rewrites97.0%
Taylor expanded in u around 0
Applied rewrites90.6%
if -2.8e16 < t1 < 3.0500000000000001e56Initial program 81.4%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6479.2
Applied rewrites79.2%
Final simplification84.0%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.8e+16) (not (<= t1 1.7e+54))) (/ (* -1.0 v) (+ (- u) t1)) (* (/ (/ (- v) u) u) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.8e+16) || !(t1 <= 1.7e+54)) {
tmp = (-1.0 * 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 <= (-2.8d+16)) .or. (.not. (t1 <= 1.7d+54))) then
tmp = ((-1.0d0) * 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 <= -2.8e+16) || !(t1 <= 1.7e+54)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = ((-v / u) / u) * t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.8e+16) or not (t1 <= 1.7e+54): tmp = (-1.0 * v) / (-u + t1) else: tmp = ((-v / u) / u) * t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.8e+16) || !(t1 <= 1.7e+54)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(Float64(Float64(-v) / u) / u) * t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -2.8e+16) || ~((t1 <= 1.7e+54))) tmp = (-1.0 * v) / (-u + t1); else tmp = ((-v / u) / u) * t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -2.8e+16], N[Not[LessEqual[t1, 1.7e+54]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-v) / u), $MachinePrecision] / u), $MachinePrecision] * t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.8 \cdot 10^{+16} \lor \neg \left(t1 \leq 1.7 \cdot 10^{+54}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-v}{u}}{u} \cdot t1\\
\end{array}
\end{array}
if t1 < -2.8e16 or 1.7e54 < t1 Initial program 52.5%
Applied rewrites97.0%
Taylor expanded in u around 0
Applied rewrites90.6%
if -2.8e16 < t1 < 1.7e54Initial program 81.4%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6479.2
Applied rewrites79.2%
Applied rewrites78.9%
Taylor expanded in u around 0
Applied rewrites77.7%
Final simplification83.1%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -4.7e+14) (not (<= t1 5.6e+14))) (/ (* -1.0 v) (+ (- u) t1)) (* (- v) (/ t1 (* u u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -4.7e+14) || !(t1 <= 5.6e+14)) {
tmp = (-1.0 * 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 <= (-4.7d+14)) .or. (.not. (t1 <= 5.6d+14))) then
tmp = ((-1.0d0) * 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 <= -4.7e+14) || !(t1 <= 5.6e+14)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = -v * (t1 / (u * u));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -4.7e+14) or not (t1 <= 5.6e+14): tmp = (-1.0 * v) / (-u + t1) else: tmp = -v * (t1 / (u * u)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -4.7e+14) || !(t1 <= 5.6e+14)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(-v) * Float64(t1 / Float64(u * u))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -4.7e+14) || ~((t1 <= 5.6e+14))) tmp = (-1.0 * v) / (-u + t1); else tmp = -v * (t1 / (u * u)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -4.7e+14], N[Not[LessEqual[t1, 5.6e+14]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / 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.7 \cdot 10^{+14} \lor \neg \left(t1 \leq 5.6 \cdot 10^{+14}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\left(-v\right) \cdot \frac{t1}{u \cdot u}\\
\end{array}
\end{array}
if t1 < -4.7e14 or 5.6e14 < t1 Initial program 53.7%
Applied rewrites97.2%
Taylor expanded in u around 0
Applied rewrites87.8%
if -4.7e14 < t1 < 5.6e14Initial program 81.9%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6480.2
Applied rewrites80.2%
Applied rewrites71.7%
Final simplification78.9%
(FPCore (u v t1) :precision binary64 (/ (* -1.0 v) (+ (- u) t1)))
double code(double u, double v, double t1) {
return (-1.0 * 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 = ((-1.0d0) * v) / (-u + t1)
end function
public static double code(double u, double v, double t1) {
return (-1.0 * v) / (-u + t1);
}
def code(u, v, t1): return (-1.0 * v) / (-u + t1)
function code(u, v, t1) return Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)) end
function tmp = code(u, v, t1) tmp = (-1.0 * v) / (-u + t1); end
code[u_, v_, t1_] := N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-1 \cdot v}{\left(-u\right) + t1}
\end{array}
Initial program 69.3%
Applied rewrites94.6%
Taylor expanded in u around 0
Applied rewrites59.5%
Final simplification59.5%
(FPCore (u v t1) :precision binary64 (* (- v) (/ -1.0 (- u t1))))
double code(double u, double v, double t1) {
return -v * (-1.0 / (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 * ((-1.0d0) / (u - t1))
end function
public static double code(double u, double v, double t1) {
return -v * (-1.0 / (u - t1));
}
def code(u, v, t1): return -v * (-1.0 / (u - t1))
function code(u, v, t1) return Float64(Float64(-v) * Float64(-1.0 / Float64(u - t1))) end
function tmp = code(u, v, t1) tmp = -v * (-1.0 / (u - t1)); end
code[u_, v_, t1_] := N[((-v) * N[(-1.0 / N[(u - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-v\right) \cdot \frac{-1}{u - t1}
\end{array}
Initial program 69.3%
Applied rewrites94.6%
Taylor expanded in u around 0
Applied rewrites59.5%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6459.4
Applied rewrites59.4%
(FPCore (u v t1) :precision binary64 (/ (- v) t1))
double code(double u, double v, double t1) {
return -v / t1;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = -v / t1
end function
public static double code(double u, double v, double t1) {
return -v / t1;
}
def code(u, v, t1): return -v / t1
function code(u, v, t1) return Float64(Float64(-v) / t1) end
function tmp = code(u, v, t1) tmp = -v / t1; end
code[u_, v_, t1_] := N[((-v) / t1), $MachinePrecision]
\begin{array}{l}
\\
\frac{-v}{t1}
\end{array}
Initial program 69.3%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6452.5
Applied rewrites52.5%
herbie shell --seed 2025017
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))