
(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 (* (/ (- v) (- u t1)) (/ t1 (- u t1))))
double code(double u, double v, double t1) {
return (-v / (u - t1)) * (t1 / (u - t1));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-v / (u - t1)) * (t1 / (u - t1))
end function
public static double code(double u, double v, double t1) {
return (-v / (u - t1)) * (t1 / (u - t1));
}
def code(u, v, t1): return (-v / (u - t1)) * (t1 / (u - t1))
function code(u, v, t1) return Float64(Float64(Float64(-v) / Float64(u - t1)) * Float64(t1 / Float64(u - t1))) end
function tmp = code(u, v, t1) tmp = (-v / (u - t1)) * (t1 / (u - t1)); end
code[u_, v_, t1_] := N[(N[((-v) / N[(u - t1), $MachinePrecision]), $MachinePrecision] * N[(t1 / N[(u - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-v}{u - t1} \cdot \frac{t1}{u - t1}
\end{array}
Initial program 71.5%
Applied rewrites95.1%
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
lift-neg.f6495.7
Applied rewrites95.7%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))))
(if (<= t1 -2.6e+92)
(/ (* -1.0 (- v)) (- u t1))
(if (<= t1 -2.9e-84)
t_1
(if (<= t1 2.25e-253)
(* (- v) (/ (/ t1 u) (- u t1)))
(if (<= t1 1.2e+138) t_1 (/ (fma (/ v t1) (+ u u) (- v)) t1)))))))
double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double tmp;
if (t1 <= -2.6e+92) {
tmp = (-1.0 * -v) / (u - t1);
} else if (t1 <= -2.9e-84) {
tmp = t_1;
} else if (t1 <= 2.25e-253) {
tmp = -v * ((t1 / u) / (u - t1));
} else if (t1 <= 1.2e+138) {
tmp = t_1;
} else {
tmp = fma((v / t1), (u + u), -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 <= -2.6e+92) tmp = Float64(Float64(-1.0 * Float64(-v)) / Float64(u - t1)); elseif (t1 <= -2.9e-84) tmp = t_1; elseif (t1 <= 2.25e-253) tmp = Float64(Float64(-v) * Float64(Float64(t1 / u) / Float64(u - t1))); elseif (t1 <= 1.2e+138) tmp = t_1; else tmp = Float64(fma(Float64(v / t1), Float64(u + u), 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, -2.6e+92], N[(N[(-1.0 * (-v)), $MachinePrecision] / N[(u - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, -2.9e-84], t$95$1, If[LessEqual[t1, 2.25e-253], N[((-v) * N[(N[(t1 / u), $MachinePrecision] / N[(u - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 1.2e+138], t$95$1, N[(N[(N[(v / t1), $MachinePrecision] * N[(u + u), $MachinePrecision] + (-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 -2.6 \cdot 10^{+92}:\\
\;\;\;\;\frac{-1 \cdot \left(-v\right)}{u - t1}\\
\mathbf{elif}\;t1 \leq -2.9 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 2.25 \cdot 10^{-253}:\\
\;\;\;\;\left(-v\right) \cdot \frac{\frac{t1}{u}}{u - t1}\\
\mathbf{elif}\;t1 \leq 1.2 \cdot 10^{+138}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{v}{t1}, u + u, -v\right)}{t1}\\
\end{array}
\end{array}
if t1 < -2.5999999999999999e92Initial program 47.9%
Applied rewrites99.2%
Taylor expanded in u around 0
Applied rewrites95.1%
if -2.5999999999999999e92 < t1 < -2.90000000000000019e-84 or 2.25000000000000014e-253 < t1 < 1.2e138Initial program 88.8%
if -2.90000000000000019e-84 < t1 < 2.25000000000000014e-253Initial program 68.2%
Applied rewrites85.1%
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-/.f6490.9
Applied rewrites90.9%
Taylor expanded in u around inf
lower-/.f6482.4
Applied rewrites82.4%
if 1.2e138 < t1 Initial program 45.4%
Taylor expanded in t1 around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6490.7
Applied rewrites90.7%
Applied rewrites93.8%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))))
(if (<= t1 -2.6e+92)
(/ (* -1.0 (- v)) (- u t1))
(if (<= t1 -2.9e-84)
t_1
(if (<= t1 2.25e-253)
(* (- v) (/ (/ t1 u) (- u t1)))
(if (<= t1 1.2e+138) t_1 (/ (- v) t1)))))))
double code(double u, double v, double t1) {
double t_1 = (-t1 * v) / ((t1 + u) * (t1 + u));
double tmp;
if (t1 <= -2.6e+92) {
tmp = (-1.0 * -v) / (u - t1);
} else if (t1 <= -2.9e-84) {
tmp = t_1;
} else if (t1 <= 2.25e-253) {
tmp = -v * ((t1 / u) / (u - t1));
} else if (t1 <= 1.2e+138) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (-t1 * v) / ((t1 + u) * (t1 + u))
if (t1 <= (-2.6d+92)) then
tmp = ((-1.0d0) * -v) / (u - t1)
else if (t1 <= (-2.9d-84)) then
tmp = t_1
else if (t1 <= 2.25d-253) then
tmp = -v * ((t1 / u) / (u - t1))
else if (t1 <= 1.2d+138) then
tmp = t_1
else
tmp = -v / t1
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 tmp;
if (t1 <= -2.6e+92) {
tmp = (-1.0 * -v) / (u - t1);
} else if (t1 <= -2.9e-84) {
tmp = t_1;
} else if (t1 <= 2.25e-253) {
tmp = -v * ((t1 / u) / (u - t1));
} else if (t1 <= 1.2e+138) {
tmp = t_1;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): t_1 = (-t1 * v) / ((t1 + u) * (t1 + u)) tmp = 0 if t1 <= -2.6e+92: tmp = (-1.0 * -v) / (u - t1) elif t1 <= -2.9e-84: tmp = t_1 elif t1 <= 2.25e-253: tmp = -v * ((t1 / u) / (u - t1)) elif t1 <= 1.2e+138: tmp = t_1 else: tmp = -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 <= -2.6e+92) tmp = Float64(Float64(-1.0 * Float64(-v)) / Float64(u - t1)); elseif (t1 <= -2.9e-84) tmp = t_1; elseif (t1 <= 2.25e-253) tmp = Float64(Float64(-v) * Float64(Float64(t1 / u) / Float64(u - t1))); elseif (t1 <= 1.2e+138) tmp = t_1; else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-t1 * v) / ((t1 + u) * (t1 + u)); tmp = 0.0; if (t1 <= -2.6e+92) tmp = (-1.0 * -v) / (u - t1); elseif (t1 <= -2.9e-84) tmp = t_1; elseif (t1 <= 2.25e-253) tmp = -v * ((t1 / u) / (u - t1)); elseif (t1 <= 1.2e+138) tmp = t_1; else tmp = -v / t1; 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[LessEqual[t1, -2.6e+92], N[(N[(-1.0 * (-v)), $MachinePrecision] / N[(u - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, -2.9e-84], t$95$1, If[LessEqual[t1, 2.25e-253], N[((-v) * N[(N[(t1 / u), $MachinePrecision] / N[(u - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 1.2e+138], t$95$1, N[((-v) / 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 -2.6 \cdot 10^{+92}:\\
\;\;\;\;\frac{-1 \cdot \left(-v\right)}{u - t1}\\
\mathbf{elif}\;t1 \leq -2.9 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 2.25 \cdot 10^{-253}:\\
\;\;\;\;\left(-v\right) \cdot \frac{\frac{t1}{u}}{u - t1}\\
\mathbf{elif}\;t1 \leq 1.2 \cdot 10^{+138}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if t1 < -2.5999999999999999e92Initial program 47.9%
Applied rewrites99.2%
Taylor expanded in u around 0
Applied rewrites95.1%
if -2.5999999999999999e92 < t1 < -2.90000000000000019e-84 or 2.25000000000000014e-253 < t1 < 1.2e138Initial program 88.8%
if -2.90000000000000019e-84 < t1 < 2.25000000000000014e-253Initial program 68.2%
Applied rewrites85.1%
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-/.f6490.9
Applied rewrites90.9%
Taylor expanded in u around inf
lower-/.f6482.4
Applied rewrites82.4%
if 1.2e138 < t1 Initial program 45.4%
Taylor expanded in u around 0
lower-*.f64N/A
lower-/.f6493.1
Applied rewrites93.1%
Applied rewrites93.1%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -1.75e+103)
(/ (* -1.0 (- v)) (- u t1))
(if (<= t1 1.5e+185)
(* (- v) (/ (- t1) (* (- (- u t1)) (- u t1))))
(/ (fma (/ v t1) (+ u u) (- v)) t1))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.75e+103) {
tmp = (-1.0 * -v) / (u - t1);
} else if (t1 <= 1.5e+185) {
tmp = -v * (-t1 / (-(u - t1) * (u - t1)));
} else {
tmp = fma((v / t1), (u + u), -v) / t1;
}
return tmp;
}
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.75e+103) tmp = Float64(Float64(-1.0 * Float64(-v)) / Float64(u - t1)); elseif (t1 <= 1.5e+185) tmp = Float64(Float64(-v) * Float64(Float64(-t1) / Float64(Float64(-Float64(u - t1)) * Float64(u - t1)))); else tmp = Float64(fma(Float64(v / t1), Float64(u + u), Float64(-v)) / t1); end return tmp end
code[u_, v_, t1_] := If[LessEqual[t1, -1.75e+103], N[(N[(-1.0 * (-v)), $MachinePrecision] / N[(u - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 1.5e+185], N[((-v) * N[((-t1) / N[((-N[(u - t1), $MachinePrecision]) * N[(u - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(v / t1), $MachinePrecision] * N[(u + u), $MachinePrecision] + (-v)), $MachinePrecision] / t1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.75 \cdot 10^{+103}:\\
\;\;\;\;\frac{-1 \cdot \left(-v\right)}{u - t1}\\
\mathbf{elif}\;t1 \leq 1.5 \cdot 10^{+185}:\\
\;\;\;\;\left(-v\right) \cdot \frac{-t1}{\left(-\left(u - t1\right)\right) \cdot \left(u - t1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{v}{t1}, u + u, -v\right)}{t1}\\
\end{array}
\end{array}
if t1 < -1.75e103Initial program 46.7%
Applied rewrites99.2%
Taylor expanded in u around 0
Applied rewrites95.0%
if -1.75e103 < t1 < 1.49999999999999997e185Initial program 81.5%
Applied rewrites93.7%
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-/.f6491.7
Applied rewrites91.7%
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-neg.f6484.0
Applied rewrites84.0%
if 1.49999999999999997e185 < t1 Initial program 40.5%
Taylor expanded in t1 around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6496.1
Applied rewrites96.1%
Applied rewrites99.9%
(FPCore (u v t1) :precision binary64 (if (<= t1 -2.6e+92) (/ (* -1.0 (- v)) (- u t1)) (if (<= t1 1.2e+138) (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))) (/ (- v) t1))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -2.6e+92) {
tmp = (-1.0 * -v) / (u - t1);
} else if (t1 <= 1.2e+138) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + 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 (t1 <= (-2.6d+92)) then
tmp = ((-1.0d0) * -v) / (u - t1)
else if (t1 <= 1.2d+138) then
tmp = (-t1 * v) / ((t1 + u) * (t1 + u))
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -2.6e+92) {
tmp = (-1.0 * -v) / (u - t1);
} else if (t1 <= 1.2e+138) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -2.6e+92: tmp = (-1.0 * -v) / (u - t1) elif t1 <= 1.2e+138: tmp = (-t1 * v) / ((t1 + u) * (t1 + u)) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -2.6e+92) tmp = Float64(Float64(-1.0 * Float64(-v)) / Float64(u - t1)); elseif (t1 <= 1.2e+138) tmp = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -2.6e+92) tmp = (-1.0 * -v) / (u - t1); elseif (t1 <= 1.2e+138) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -2.6e+92], N[(N[(-1.0 * (-v)), $MachinePrecision] / N[(u - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 1.2e+138], N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.6 \cdot 10^{+92}:\\
\;\;\;\;\frac{-1 \cdot \left(-v\right)}{u - t1}\\
\mathbf{elif}\;t1 \leq 1.2 \cdot 10^{+138}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if t1 < -2.5999999999999999e92Initial program 47.9%
Applied rewrites99.2%
Taylor expanded in u around 0
Applied rewrites95.1%
if -2.5999999999999999e92 < t1 < 1.2e138Initial program 81.9%
if 1.2e138 < t1 Initial program 45.4%
Taylor expanded in u around 0
lower-*.f64N/A
lower-/.f6493.1
Applied rewrites93.1%
Applied rewrites93.1%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (/ v t1) (/ t1 u))))
(if (<= u -2.25e+226)
t_1
(if (<= u 4.8e+189) (/ (* -1.0 (- v)) (- u t1)) t_1))))
double code(double u, double v, double t1) {
double t_1 = (v / t1) * (t1 / u);
double tmp;
if (u <= -2.25e+226) {
tmp = t_1;
} else if (u <= 4.8e+189) {
tmp = (-1.0 * -v) / (u - t1);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: tmp
t_1 = (v / t1) * (t1 / u)
if (u <= (-2.25d+226)) then
tmp = t_1
else if (u <= 4.8d+189) then
tmp = ((-1.0d0) * -v) / (u - t1)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (v / t1) * (t1 / u);
double tmp;
if (u <= -2.25e+226) {
tmp = t_1;
} else if (u <= 4.8e+189) {
tmp = (-1.0 * -v) / (u - t1);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (v / t1) * (t1 / u) tmp = 0 if u <= -2.25e+226: tmp = t_1 elif u <= 4.8e+189: tmp = (-1.0 * -v) / (u - t1) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(v / t1) * Float64(t1 / u)) tmp = 0.0 if (u <= -2.25e+226) tmp = t_1; elseif (u <= 4.8e+189) tmp = Float64(Float64(-1.0 * Float64(-v)) / Float64(u - t1)); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (v / t1) * (t1 / u); tmp = 0.0; if (u <= -2.25e+226) tmp = t_1; elseif (u <= 4.8e+189) tmp = (-1.0 * -v) / (u - t1); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[(v / t1), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -2.25e+226], t$95$1, If[LessEqual[u, 4.8e+189], N[(N[(-1.0 * (-v)), $MachinePrecision] / N[(u - t1), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{t1} \cdot \frac{t1}{u}\\
\mathbf{if}\;u \leq -2.25 \cdot 10^{+226}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;u \leq 4.8 \cdot 10^{+189}:\\
\;\;\;\;\frac{-1 \cdot \left(-v\right)}{u - t1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if u < -2.24999999999999995e226 or 4.8000000000000001e189 < u Initial program 88.4%
Applied rewrites99.2%
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
lift-neg.f6499.2
Applied rewrites99.2%
Taylor expanded in u around 0
lower-/.f6471.1
Applied rewrites71.1%
Taylor expanded in u around inf
lower-/.f6469.7
Applied rewrites69.7%
if -2.24999999999999995e226 < u < 4.8000000000000001e189Initial program 68.3%
Applied rewrites94.4%
Taylor expanded in u around 0
Applied rewrites61.4%
(FPCore (u v t1) :precision binary64 (* (- v) (/ (/ t1 (- u t1)) (- u t1))))
double code(double u, double v, double t1) {
return -v * ((t1 / (u - t1)) / (u - t1));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = -v * ((t1 / (u - t1)) / (u - t1))
end function
public static double code(double u, double v, double t1) {
return -v * ((t1 / (u - t1)) / (u - t1));
}
def code(u, v, t1): return -v * ((t1 / (u - t1)) / (u - t1))
function code(u, v, t1) return Float64(Float64(-v) * Float64(Float64(t1 / Float64(u - t1)) / Float64(u - t1))) end
function tmp = code(u, v, t1) tmp = -v * ((t1 / (u - t1)) / (u - t1)); end
code[u_, v_, t1_] := N[((-v) * N[(N[(t1 / N[(u - t1), $MachinePrecision]), $MachinePrecision] / N[(u - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-v\right) \cdot \frac{\frac{t1}{u - t1}}{u - t1}
\end{array}
Initial program 71.5%
Applied rewrites95.1%
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-/.f6493.6
Applied rewrites93.6%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (/ (* -1.0 v) (- u t1)))) (if (<= u -2.1e+83) t_1 (if (<= u 1.15e+162) (/ (- v) t1) t_1))))
double code(double u, double v, double t1) {
double t_1 = (-1.0 * v) / (u - t1);
double tmp;
if (u <= -2.1e+83) {
tmp = t_1;
} else if (u <= 1.15e+162) {
tmp = -v / t1;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: tmp
t_1 = ((-1.0d0) * v) / (u - t1)
if (u <= (-2.1d+83)) then
tmp = t_1
else if (u <= 1.15d+162) then
tmp = -v / t1
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (-1.0 * v) / (u - t1);
double tmp;
if (u <= -2.1e+83) {
tmp = t_1;
} else if (u <= 1.15e+162) {
tmp = -v / t1;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (-1.0 * v) / (u - t1) tmp = 0 if u <= -2.1e+83: tmp = t_1 elif u <= 1.15e+162: tmp = -v / t1 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-1.0 * v) / Float64(u - t1)) tmp = 0.0 if (u <= -2.1e+83) tmp = t_1; elseif (u <= 1.15e+162) tmp = Float64(Float64(-v) / t1); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-1.0 * v) / (u - t1); tmp = 0.0; if (u <= -2.1e+83) tmp = t_1; elseif (u <= 1.15e+162) tmp = -v / t1; 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[u, -2.1e+83], t$95$1, If[LessEqual[u, 1.15e+162], N[((-v) / t1), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-1 \cdot v}{u - t1}\\
\mathbf{if}\;u \leq -2.1 \cdot 10^{+83}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;u \leq 1.15 \cdot 10^{+162}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if u < -2.10000000000000002e83 or 1.14999999999999997e162 < u Initial program 79.9%
Applied rewrites76.1%
Taylor expanded in u around 0
Applied rewrites41.8%
if -2.10000000000000002e83 < u < 1.14999999999999997e162Initial program 68.0%
Taylor expanded in u around 0
lower-*.f64N/A
lower-/.f6464.0
Applied rewrites64.0%
Applied rewrites64.0%
(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 * Float64(-v)) / 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 \left(-v\right)}{u - t1}
\end{array}
Initial program 71.5%
Applied rewrites95.1%
Taylor expanded in u around 0
Applied rewrites59.1%
(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 71.5%
Applied rewrites95.1%
Taylor expanded in u around 0
Applied rewrites59.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6458.9
Applied rewrites58.9%
(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.5%
Taylor expanded in u around 0
lower-*.f64N/A
lower-/.f6450.3
Applied rewrites50.3%
Applied rewrites50.3%
(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(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.5%
Applied rewrites37.5%
Taylor expanded in u around 0
lower-/.f6413.3
Applied rewrites13.3%
herbie shell --seed 2024363 -o localize:costs -o setup:simplify -o generate:simplify
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))