
(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)) * Float64(-v)) / Float64(u + t1)) end
function tmp = code(u, v, t1) tmp = ((t1 / (u + t1)) * -v) / (u + t1); end
code[u_, v_, t1_] := N[(N[(N[(t1 / N[(u + t1), $MachinePrecision]), $MachinePrecision] * (-v)), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{t1}{u + t1} \cdot \left(-v\right)}{u + t1}
\end{array}
Initial program 75.7%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6498.4
Applied rewrites98.4%
lift-*.f64N/A
lift-neg.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
lift-+.f64N/A
lift-+.f6498.7
Applied rewrites98.7%
Final simplification98.7%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* t1 (/ (- v) (fma (fma 2.0 u t1) t1 (* u u))))))
(if (<= t1 -3.75e+124)
(/ (fma u (/ v t1) (- v)) (+ u t1))
(if (<= t1 -3.2e-98)
t_1
(if (<= t1 3.7e-176)
(/ (* v (/ (- t1) u)) u)
(if (<= t1 1.55e+110) t_1 (/ (- v) t1)))))))
double code(double u, double v, double t1) {
double t_1 = t1 * (-v / fma(fma(2.0, u, t1), t1, (u * u)));
double tmp;
if (t1 <= -3.75e+124) {
tmp = fma(u, (v / t1), -v) / (u + t1);
} else if (t1 <= -3.2e-98) {
tmp = t_1;
} else if (t1 <= 3.7e-176) {
tmp = (v * (-t1 / u)) / u;
} else if (t1 <= 1.55e+110) {
tmp = t_1;
} else {
tmp = -v / t1;
}
return tmp;
}
function code(u, v, t1) t_1 = Float64(t1 * Float64(Float64(-v) / fma(fma(2.0, u, t1), t1, Float64(u * u)))) tmp = 0.0 if (t1 <= -3.75e+124) tmp = Float64(fma(u, Float64(v / t1), Float64(-v)) / Float64(u + t1)); elseif (t1 <= -3.2e-98) tmp = t_1; elseif (t1 <= 3.7e-176) tmp = Float64(Float64(v * Float64(Float64(-t1) / u)) / u); elseif (t1 <= 1.55e+110) tmp = t_1; else tmp = Float64(Float64(-v) / t1); end return tmp end
code[u_, v_, t1_] := Block[{t$95$1 = N[(t1 * N[((-v) / N[(N[(2.0 * u + t1), $MachinePrecision] * t1 + N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -3.75e+124], N[(N[(u * N[(v / t1), $MachinePrecision] + (-v)), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, -3.2e-98], t$95$1, If[LessEqual[t1, 3.7e-176], N[(N[(v * N[((-t1) / u), $MachinePrecision]), $MachinePrecision] / u), $MachinePrecision], If[LessEqual[t1, 1.55e+110], t$95$1, N[((-v) / t1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t1 \cdot \frac{-v}{\mathsf{fma}\left(\mathsf{fma}\left(2, u, t1\right), t1, u \cdot u\right)}\\
\mathbf{if}\;t1 \leq -3.75 \cdot 10^{+124}:\\
\;\;\;\;\frac{\mathsf{fma}\left(u, \frac{v}{t1}, -v\right)}{u + t1}\\
\mathbf{elif}\;t1 \leq -3.2 \cdot 10^{-98}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 3.7 \cdot 10^{-176}:\\
\;\;\;\;\frac{v \cdot \frac{-t1}{u}}{u}\\
\mathbf{elif}\;t1 \leq 1.55 \cdot 10^{+110}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if t1 < -3.75000000000000019e124Initial program 45.4%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6468.9
Applied rewrites68.9%
Taylor expanded in u around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lift-neg.f6496.8
Applied rewrites96.8%
if -3.75000000000000019e124 < t1 < -3.2000000000000001e-98 or 3.69999999999999984e-176 < t1 < 1.55000000000000009e110Initial program 86.9%
Taylor expanded in u around 0
Applied rewrites58.0%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-neg.f64N/A
lower-/.f6463.9
lift-+.f64N/A
+-commutativeN/A
lift-+.f6463.9
+-commutative63.9
Applied rewrites63.9%
Taylor expanded in t1 around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6491.4
Applied rewrites91.4%
if -3.2000000000000001e-98 < t1 < 3.69999999999999984e-176Initial program 81.9%
Taylor expanded in u around inf
associate-*r/N/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
mul-1-negN/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lift-neg.f6489.8
Applied rewrites89.8%
lift-*.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
distribute-frac-negN/A
mul-1-negN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
distribute-frac-negN/A
lift-/.f64N/A
lift-neg.f6491.0
Applied rewrites91.0%
if 1.55000000000000009e110 < t1 Initial program 48.9%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6490.8
Applied rewrites90.8%
Final simplification91.8%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.3e+129) (not (<= t1 3.6e+85))) (/ (fma u (/ v t1) (- v)) (+ u t1)) (/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.3e+129) || !(t1 <= 3.6e+85)) {
tmp = fma(u, (v / t1), -v) / (u + t1);
} else {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
}
return tmp;
}
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.3e+129) || !(t1 <= 3.6e+85)) tmp = Float64(fma(u, Float64(v / t1), Float64(-v)) / Float64(u + t1)); else tmp = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))); end return tmp end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -2.3e+129], N[Not[LessEqual[t1, 3.6e+85]], $MachinePrecision]], N[(N[(u * N[(v / t1), $MachinePrecision] + (-v)), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.3 \cdot 10^{+129} \lor \neg \left(t1 \leq 3.6 \cdot 10^{+85}\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(u, \frac{v}{t1}, -v\right)}{u + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\end{array}
\end{array}
if t1 < -2.2999999999999999e129 or 3.5999999999999998e85 < t1 Initial program 47.7%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6466.6
Applied rewrites66.6%
Taylor expanded in u around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lift-neg.f6492.9
Applied rewrites92.9%
if -2.2999999999999999e129 < t1 < 3.5999999999999998e85Initial program 85.6%
Final simplification87.5%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -8.2e+119) (not (<= t1 1.45e+41))) (/ (- v) (+ u t1)) (/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -8.2e+119) || !(t1 <= 1.45e+41)) {
tmp = -v / (u + t1);
} else {
tmp = (-t1 * v) / ((t1 + 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 <= (-8.2d+119)) .or. (.not. (t1 <= 1.45d+41))) then
tmp = -v / (u + t1)
else
tmp = (-t1 * v) / ((t1 + u) * (t1 + u))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -8.2e+119) || !(t1 <= 1.45e+41)) {
tmp = -v / (u + t1);
} else {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -8.2e+119) or not (t1 <= 1.45e+41): tmp = -v / (u + t1) else: tmp = (-t1 * v) / ((t1 + u) * (t1 + u)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -8.2e+119) || !(t1 <= 1.45e+41)) tmp = Float64(Float64(-v) / Float64(u + t1)); else tmp = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -8.2e+119) || ~((t1 <= 1.45e+41))) tmp = -v / (u + t1); else tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -8.2e+119], N[Not[LessEqual[t1, 1.45e+41]], $MachinePrecision]], N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -8.2 \cdot 10^{+119} \lor \neg \left(t1 \leq 1.45 \cdot 10^{+41}\right):\\
\;\;\;\;\frac{-v}{u + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\end{array}
\end{array}
if t1 < -8.1999999999999994e119 or 1.44999999999999994e41 < t1 Initial program 54.3%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6471.2
Applied rewrites71.2%
Taylor expanded in u around 0
mul-1-negN/A
lift-neg.f6491.5
Applied rewrites91.5%
if -8.1999999999999994e119 < t1 < 1.44999999999999994e41Initial program 85.5%
Final simplification87.4%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.2e-47) (not (<= t1 9e-107))) (/ (- v) (+ u t1)) (/ (* v (/ (- t1) u)) u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.2e-47) || !(t1 <= 9e-107)) {
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 <= (-2.2d-47)) .or. (.not. (t1 <= 9d-107))) 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 <= -2.2e-47) || !(t1 <= 9e-107)) {
tmp = -v / (u + t1);
} else {
tmp = (v * (-t1 / u)) / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.2e-47) or not (t1 <= 9e-107): tmp = -v / (u + t1) else: tmp = (v * (-t1 / u)) / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.2e-47) || !(t1 <= 9e-107)) tmp = Float64(Float64(-v) / Float64(u + t1)); else tmp = Float64(Float64(v * Float64(Float64(-t1) / u)) / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -2.2e-47) || ~((t1 <= 9e-107))) tmp = -v / (u + t1); else tmp = (v * (-t1 / u)) / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -2.2e-47], N[Not[LessEqual[t1, 9e-107]], $MachinePrecision]], N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision], N[(N[(v * N[((-t1) / u), $MachinePrecision]), $MachinePrecision] / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.2 \cdot 10^{-47} \lor \neg \left(t1 \leq 9 \cdot 10^{-107}\right):\\
\;\;\;\;\frac{-v}{u + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v \cdot \frac{-t1}{u}}{u}\\
\end{array}
\end{array}
if t1 < -2.20000000000000019e-47 or 9.00000000000000032e-107 < t1 Initial program 70.1%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6481.7
Applied rewrites81.7%
Taylor expanded in u around 0
mul-1-negN/A
lift-neg.f6481.4
Applied rewrites81.4%
if -2.20000000000000019e-47 < t1 < 9.00000000000000032e-107Initial program 84.8%
Taylor expanded in u around inf
associate-*r/N/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
mul-1-negN/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lift-neg.f6483.1
Applied rewrites83.1%
lift-*.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
distribute-frac-negN/A
mul-1-negN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
distribute-frac-negN/A
lift-/.f64N/A
lift-neg.f6484.0
Applied rewrites84.0%
Final simplification82.4%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.2e-47) (not (<= t1 9e-107))) (/ (- v) (+ u t1)) (* (/ (- v) u) (/ t1 u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.2e-47) || !(t1 <= 9e-107)) {
tmp = -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.2d-47)) .or. (.not. (t1 <= 9d-107))) then
tmp = -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.2e-47) || !(t1 <= 9e-107)) {
tmp = -v / (u + t1);
} else {
tmp = (-v / u) * (t1 / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.2e-47) or not (t1 <= 9e-107): tmp = -v / (u + t1) else: tmp = (-v / u) * (t1 / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.2e-47) || !(t1 <= 9e-107)) tmp = Float64(Float64(-v) / 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.2e-47) || ~((t1 <= 9e-107))) tmp = -v / (u + t1); else tmp = (-v / u) * (t1 / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -2.2e-47], N[Not[LessEqual[t1, 9e-107]], $MachinePrecision]], N[((-v) / 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.2 \cdot 10^{-47} \lor \neg \left(t1 \leq 9 \cdot 10^{-107}\right):\\
\;\;\;\;\frac{-v}{u + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u} \cdot \frac{t1}{u}\\
\end{array}
\end{array}
if t1 < -2.20000000000000019e-47 or 9.00000000000000032e-107 < t1 Initial program 70.1%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6481.7
Applied rewrites81.7%
Taylor expanded in u around 0
mul-1-negN/A
lift-neg.f6481.4
Applied rewrites81.4%
if -2.20000000000000019e-47 < t1 < 9.00000000000000032e-107Initial program 84.8%
Taylor expanded in u around inf
associate-*r/N/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
mul-1-negN/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lift-neg.f6483.1
Applied rewrites83.1%
Final simplification82.0%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.2e-47) (not (<= t1 9e-107))) (/ (- v) (+ u t1)) (/ (* (- t1) v) (* u u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.2e-47) || !(t1 <= 9e-107)) {
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 <= (-2.2d-47)) .or. (.not. (t1 <= 9d-107))) 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 <= -2.2e-47) || !(t1 <= 9e-107)) {
tmp = -v / (u + t1);
} else {
tmp = (-t1 * v) / (u * u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.2e-47) or not (t1 <= 9e-107): tmp = -v / (u + t1) else: tmp = (-t1 * v) / (u * u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.2e-47) || !(t1 <= 9e-107)) tmp = Float64(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 <= -2.2e-47) || ~((t1 <= 9e-107))) tmp = -v / (u + t1); else tmp = (-t1 * v) / (u * u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -2.2e-47], N[Not[LessEqual[t1, 9e-107]], $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 -2.2 \cdot 10^{-47} \lor \neg \left(t1 \leq 9 \cdot 10^{-107}\right):\\
\;\;\;\;\frac{-v}{u + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{u \cdot u}\\
\end{array}
\end{array}
if t1 < -2.20000000000000019e-47 or 9.00000000000000032e-107 < t1 Initial program 70.1%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6481.7
Applied rewrites81.7%
Taylor expanded in u around 0
mul-1-negN/A
lift-neg.f6481.4
Applied rewrites81.4%
if -2.20000000000000019e-47 < t1 < 9.00000000000000032e-107Initial program 84.8%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6476.7
Applied rewrites76.7%
Final simplification79.6%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -9.2e-48) (not (<= t1 9e-107))) (/ (- v) (+ u t1)) (* (- t1) (/ v (* u u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -9.2e-48) || !(t1 <= 9e-107)) {
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.2d-48)) .or. (.not. (t1 <= 9d-107))) 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.2e-48) || !(t1 <= 9e-107)) {
tmp = -v / (u + t1);
} else {
tmp = -t1 * (v / (u * u));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -9.2e-48) or not (t1 <= 9e-107): tmp = -v / (u + t1) else: tmp = -t1 * (v / (u * u)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -9.2e-48) || !(t1 <= 9e-107)) tmp = Float64(Float64(-v) / Float64(u + t1)); else tmp = Float64(Float64(-t1) * Float64(v / Float64(u * u))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -9.2e-48) || ~((t1 <= 9e-107))) tmp = -v / (u + t1); else tmp = -t1 * (v / (u * u)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -9.2e-48], N[Not[LessEqual[t1, 9e-107]], $MachinePrecision]], N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision], N[((-t1) * N[(v / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -9.2 \cdot 10^{-48} \lor \neg \left(t1 \leq 9 \cdot 10^{-107}\right):\\
\;\;\;\;\frac{-v}{u + t1}\\
\mathbf{else}:\\
\;\;\;\;\left(-t1\right) \cdot \frac{v}{u \cdot u}\\
\end{array}
\end{array}
if t1 < -9.2000000000000003e-48 or 9.00000000000000032e-107 < t1 Initial program 70.1%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6481.7
Applied rewrites81.7%
Taylor expanded in u around 0
mul-1-negN/A
lift-neg.f6481.4
Applied rewrites81.4%
if -9.2000000000000003e-48 < t1 < 9.00000000000000032e-107Initial program 84.8%
Taylor expanded in u around inf
associate-*r/N/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
mul-1-negN/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lift-neg.f6483.1
Applied rewrites83.1%
lift-*.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
distribute-lft-neg-outN/A
mul-1-negN/A
unpow2N/A
associate-*r/N/A
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6475.6
Applied rewrites75.6%
Final simplification79.2%
(FPCore (u v t1) :precision binary64 (* (/ (- t1) (+ u t1)) (/ v (+ u t1))))
double code(double u, double v, double t1) {
return (-t1 / (u + t1)) * (v / (u + t1));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 / (u + t1)) * (v / (u + t1))
end function
public static double code(double u, double v, double t1) {
return (-t1 / (u + t1)) * (v / (u + t1));
}
def code(u, v, t1): return (-t1 / (u + t1)) * (v / (u + t1))
function code(u, v, t1) return Float64(Float64(Float64(-t1) / Float64(u + t1)) * Float64(v / Float64(u + t1))) end
function tmp = code(u, v, t1) tmp = (-t1 / (u + t1)) * (v / (u + t1)); end
code[u_, v_, t1_] := N[(N[((-t1) / N[(u + t1), $MachinePrecision]), $MachinePrecision] * N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-t1}{u + t1} \cdot \frac{v}{u + t1}
\end{array}
Initial program 75.7%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6498.4
Applied rewrites98.4%
(FPCore (u v t1) :precision binary64 (/ (- v) (+ u t1)))
double code(double u, double v, double t1) {
return -v / (u + t1);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = -v / (u + t1)
end function
public static double code(double u, double v, double t1) {
return -v / (u + t1);
}
def code(u, v, t1): return -v / (u + t1)
function code(u, v, t1) return Float64(Float64(-v) / Float64(u + t1)) end
function tmp = code(u, v, t1) tmp = -v / (u + t1); end
code[u_, v_, t1_] := N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-v}{u + t1}
\end{array}
Initial program 75.7%
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
mul-1-negN/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6483.4
Applied rewrites83.4%
Taylor expanded in u around 0
mul-1-negN/A
lift-neg.f6462.7
Applied rewrites62.7%
(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 75.7%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6455.4
Applied rewrites55.4%
herbie shell --seed 2025060
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))