
(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 73.2%
Applied rewrites96.2%
Final simplification96.2%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* v (/ (- t1) (fma (fma 2.0 t1 u) u (* t1 t1)))))
(t_2 (/ (* -1.0 v) (- t1 u))))
(if (<= t1 -1.5e+81)
t_2
(if (<= t1 -6.5e-259)
t_1
(if (<= t1 3.9e-176)
(/ (* (/ (- v) u) t1) u)
(if (<= t1 1.95e+111) t_1 t_2))))))
double code(double u, double v, double t1) {
double t_1 = v * (-t1 / fma(fma(2.0, t1, u), u, (t1 * t1)));
double t_2 = (-1.0 * v) / (t1 - u);
double tmp;
if (t1 <= -1.5e+81) {
tmp = t_2;
} else if (t1 <= -6.5e-259) {
tmp = t_1;
} else if (t1 <= 3.9e-176) {
tmp = ((-v / u) * t1) / u;
} else if (t1 <= 1.95e+111) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(u, v, t1) t_1 = Float64(v * Float64(Float64(-t1) / fma(fma(2.0, t1, u), u, Float64(t1 * t1)))) t_2 = Float64(Float64(-1.0 * v) / Float64(t1 - u)) tmp = 0.0 if (t1 <= -1.5e+81) tmp = t_2; elseif (t1 <= -6.5e-259) tmp = t_1; elseif (t1 <= 3.9e-176) tmp = Float64(Float64(Float64(Float64(-v) / u) * t1) / u); elseif (t1 <= 1.95e+111) tmp = t_1; else tmp = t_2; end return tmp end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v * N[((-t1) / N[(N[(2.0 * t1 + u), $MachinePrecision] * u + N[(t1 * t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(-1.0 * v), $MachinePrecision] / N[(t1 - u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.5e+81], t$95$2, If[LessEqual[t1, -6.5e-259], t$95$1, If[LessEqual[t1, 3.9e-176], N[(N[(N[((-v) / u), $MachinePrecision] * t1), $MachinePrecision] / u), $MachinePrecision], If[LessEqual[t1, 1.95e+111], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := v \cdot \frac{-t1}{\mathsf{fma}\left(\mathsf{fma}\left(2, t1, u\right), u, t1 \cdot t1\right)}\\
t_2 := \frac{-1 \cdot v}{t1 - u}\\
\mathbf{if}\;t1 \leq -1.5 \cdot 10^{+81}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t1 \leq -6.5 \cdot 10^{-259}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 3.9 \cdot 10^{-176}:\\
\;\;\;\;\frac{\frac{-v}{u} \cdot t1}{u}\\
\mathbf{elif}\;t1 \leq 1.95 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t1 < -1.49999999999999999e81 or 1.9499999999999999e111 < t1 Initial program 58.6%
Applied rewrites99.9%
Taylor expanded in u around 0
Applied rewrites89.7%
lift-/.f64N/A
frac-2negN/A
lift--.f64N/A
flip--N/A
+-commutativeN/A
distribute-neg-fracN/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-neg-inN/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
sqr-neg-revN/A
+-commutativeN/A
Applied rewrites89.7%
if -1.49999999999999999e81 < t1 < -6.50000000000000045e-259 or 3.8999999999999997e-176 < t1 < 1.9499999999999999e111Initial program 85.8%
Taylor expanded in u around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6485.8
Applied rewrites85.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6490.7
Applied rewrites90.7%
if -6.50000000000000045e-259 < t1 < 3.8999999999999997e-176Initial program 65.7%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6485.9
Applied rewrites85.9%
Applied rewrites87.8%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
(t_2 (/ (* -1.0 v) (- t1 u))))
(if (<= t1 -1.5e+81)
t_2
(if (<= t1 -1.12e-111)
t_1
(if (<= t1 1.25e-220)
(* (- v) (/ (/ t1 u) u))
(if (<= t1 2.1e+110) 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) / (t1 - u);
double tmp;
if (t1 <= -1.5e+81) {
tmp = t_2;
} else if (t1 <= -1.12e-111) {
tmp = t_1;
} else if (t1 <= 1.25e-220) {
tmp = -v * ((t1 / u) / u);
} else if (t1 <= 2.1e+110) {
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) / (t1 - u)
if (t1 <= (-1.5d+81)) then
tmp = t_2
else if (t1 <= (-1.12d-111)) then
tmp = t_1
else if (t1 <= 1.25d-220) then
tmp = -v * ((t1 / u) / u)
else if (t1 <= 2.1d+110) 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) / (t1 - u);
double tmp;
if (t1 <= -1.5e+81) {
tmp = t_2;
} else if (t1 <= -1.12e-111) {
tmp = t_1;
} else if (t1 <= 1.25e-220) {
tmp = -v * ((t1 / u) / u);
} else if (t1 <= 2.1e+110) {
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) / (t1 - u) tmp = 0 if t1 <= -1.5e+81: tmp = t_2 elif t1 <= -1.12e-111: tmp = t_1 elif t1 <= 1.25e-220: tmp = -v * ((t1 / u) / u) elif t1 <= 2.1e+110: 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(t1 - u)) tmp = 0.0 if (t1 <= -1.5e+81) tmp = t_2; elseif (t1 <= -1.12e-111) tmp = t_1; elseif (t1 <= 1.25e-220) tmp = Float64(Float64(-v) * Float64(Float64(t1 / u) / u)); elseif (t1 <= 2.1e+110) 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) / (t1 - u); tmp = 0.0; if (t1 <= -1.5e+81) tmp = t_2; elseif (t1 <= -1.12e-111) tmp = t_1; elseif (t1 <= 1.25e-220) tmp = -v * ((t1 / u) / u); elseif (t1 <= 2.1e+110) 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[(t1 - u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.5e+81], t$95$2, If[LessEqual[t1, -1.12e-111], t$95$1, If[LessEqual[t1, 1.25e-220], N[((-v) * N[(N[(t1 / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 2.1e+110], 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}{t1 - u}\\
\mathbf{if}\;t1 \leq -1.5 \cdot 10^{+81}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t1 \leq -1.12 \cdot 10^{-111}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 1.25 \cdot 10^{-220}:\\
\;\;\;\;\left(-v\right) \cdot \frac{\frac{t1}{u}}{u}\\
\mathbf{elif}\;t1 \leq 2.1 \cdot 10^{+110}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t1 < -1.49999999999999999e81 or 2.10000000000000015e110 < t1 Initial program 58.6%
Applied rewrites99.9%
Taylor expanded in u around 0
Applied rewrites89.7%
lift-/.f64N/A
frac-2negN/A
lift--.f64N/A
flip--N/A
+-commutativeN/A
distribute-neg-fracN/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-neg-inN/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
sqr-neg-revN/A
+-commutativeN/A
Applied rewrites89.7%
if -1.49999999999999999e81 < t1 < -1.12000000000000009e-111 or 1.25e-220 < t1 < 2.10000000000000015e110Initial program 88.8%
if -1.12000000000000009e-111 < t1 < 1.25e-220Initial program 66.0%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6485.9
Applied rewrites85.9%
Applied rewrites87.2%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -9e-83) (not (<= t1 3.6e+34))) (/ (* -1.0 v) (- t1 u)) (/ (* (/ t1 u) v) (- u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -9e-83) || !(t1 <= 3.6e+34)) {
tmp = (-1.0 * v) / (t1 - u);
} else {
tmp = ((t1 / u) * v) / -u;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-9d-83)) .or. (.not. (t1 <= 3.6d+34))) then
tmp = ((-1.0d0) * v) / (t1 - u)
else
tmp = ((t1 / u) * v) / -u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -9e-83) || !(t1 <= 3.6e+34)) {
tmp = (-1.0 * v) / (t1 - u);
} else {
tmp = ((t1 / u) * v) / -u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -9e-83) or not (t1 <= 3.6e+34): tmp = (-1.0 * v) / (t1 - u) else: tmp = ((t1 / u) * v) / -u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -9e-83) || !(t1 <= 3.6e+34)) tmp = Float64(Float64(-1.0 * v) / Float64(t1 - u)); else tmp = Float64(Float64(Float64(t1 / u) * v) / Float64(-u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -9e-83) || ~((t1 <= 3.6e+34))) tmp = (-1.0 * v) / (t1 - u); else tmp = ((t1 / u) * v) / -u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -9e-83], N[Not[LessEqual[t1, 3.6e+34]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[(t1 - u), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t1 / u), $MachinePrecision] * v), $MachinePrecision] / (-u)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -9 \cdot 10^{-83} \lor \neg \left(t1 \leq 3.6 \cdot 10^{+34}\right):\\
\;\;\;\;\frac{-1 \cdot v}{t1 - u}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t1}{u} \cdot v}{-u}\\
\end{array}
\end{array}
if t1 < -8.99999999999999995e-83 or 3.6e34 < t1 Initial program 70.4%
Applied rewrites99.9%
Taylor expanded in u around 0
Applied rewrites85.2%
lift-/.f64N/A
frac-2negN/A
lift--.f64N/A
flip--N/A
+-commutativeN/A
distribute-neg-fracN/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-neg-inN/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
sqr-neg-revN/A
+-commutativeN/A
Applied rewrites85.2%
if -8.99999999999999995e-83 < t1 < 3.6e34Initial program 76.0%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6481.2
Applied rewrites81.2%
Applied rewrites81.2%
Final simplification83.2%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -9e-83) (not (<= t1 3.6e+34))) (/ (* -1.0 v) (- t1 u)) (* (/ v u) (/ (- t1) u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -9e-83) || !(t1 <= 3.6e+34)) {
tmp = (-1.0 * v) / (t1 - u);
} else {
tmp = (v / u) * (-t1 / u);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-9d-83)) .or. (.not. (t1 <= 3.6d+34))) then
tmp = ((-1.0d0) * v) / (t1 - u)
else
tmp = (v / u) * (-t1 / u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -9e-83) || !(t1 <= 3.6e+34)) {
tmp = (-1.0 * v) / (t1 - u);
} else {
tmp = (v / u) * (-t1 / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -9e-83) or not (t1 <= 3.6e+34): tmp = (-1.0 * v) / (t1 - u) else: tmp = (v / u) * (-t1 / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -9e-83) || !(t1 <= 3.6e+34)) tmp = Float64(Float64(-1.0 * v) / Float64(t1 - u)); else tmp = Float64(Float64(v / u) * Float64(Float64(-t1) / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -9e-83) || ~((t1 <= 3.6e+34))) tmp = (-1.0 * v) / (t1 - u); else tmp = (v / u) * (-t1 / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -9e-83], N[Not[LessEqual[t1, 3.6e+34]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[(t1 - u), $MachinePrecision]), $MachinePrecision], N[(N[(v / u), $MachinePrecision] * N[((-t1) / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -9 \cdot 10^{-83} \lor \neg \left(t1 \leq 3.6 \cdot 10^{+34}\right):\\
\;\;\;\;\frac{-1 \cdot v}{t1 - u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u} \cdot \frac{-t1}{u}\\
\end{array}
\end{array}
if t1 < -8.99999999999999995e-83 or 3.6e34 < t1 Initial program 70.4%
Applied rewrites99.9%
Taylor expanded in u around 0
Applied rewrites85.2%
lift-/.f64N/A
frac-2negN/A
lift--.f64N/A
flip--N/A
+-commutativeN/A
distribute-neg-fracN/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-neg-inN/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
sqr-neg-revN/A
+-commutativeN/A
Applied rewrites85.2%
if -8.99999999999999995e-83 < t1 < 3.6e34Initial program 76.0%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6481.2
Applied rewrites81.2%
Final simplification83.2%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -9e-83) (not (<= t1 1.35e-16))) (/ (* -1.0 v) (- t1 u)) (* (- v) (/ (/ t1 u) u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -9e-83) || !(t1 <= 1.35e-16)) {
tmp = (-1.0 * v) / (t1 - u);
} 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 <= (-9d-83)) .or. (.not. (t1 <= 1.35d-16))) then
tmp = ((-1.0d0) * v) / (t1 - u)
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 <= -9e-83) || !(t1 <= 1.35e-16)) {
tmp = (-1.0 * v) / (t1 - u);
} else {
tmp = -v * ((t1 / u) / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -9e-83) or not (t1 <= 1.35e-16): tmp = (-1.0 * v) / (t1 - u) else: tmp = -v * ((t1 / u) / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -9e-83) || !(t1 <= 1.35e-16)) tmp = Float64(Float64(-1.0 * v) / Float64(t1 - u)); 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 <= -9e-83) || ~((t1 <= 1.35e-16))) tmp = (-1.0 * v) / (t1 - u); else tmp = -v * ((t1 / u) / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -9e-83], N[Not[LessEqual[t1, 1.35e-16]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[(t1 - u), $MachinePrecision]), $MachinePrecision], N[((-v) * N[(N[(t1 / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -9 \cdot 10^{-83} \lor \neg \left(t1 \leq 1.35 \cdot 10^{-16}\right):\\
\;\;\;\;\frac{-1 \cdot v}{t1 - u}\\
\mathbf{else}:\\
\;\;\;\;\left(-v\right) \cdot \frac{\frac{t1}{u}}{u}\\
\end{array}
\end{array}
if t1 < -8.99999999999999995e-83 or 1.35e-16 < t1 Initial program 71.5%
Applied rewrites99.3%
Taylor expanded in u around 0
Applied rewrites82.1%
lift-/.f64N/A
frac-2negN/A
lift--.f64N/A
flip--N/A
+-commutativeN/A
distribute-neg-fracN/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-neg-inN/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
sqr-neg-revN/A
+-commutativeN/A
Applied rewrites82.1%
if -8.99999999999999995e-83 < t1 < 1.35e-16Initial program 75.3%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6483.6
Applied rewrites83.6%
Applied rewrites81.8%
Final simplification81.9%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -9e-83) (not (<= t1 1.35e-16))) (/ (* -1.0 v) (- t1 u)) (* (- t1) (/ v (* u u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -9e-83) || !(t1 <= 1.35e-16)) {
tmp = (-1.0 * v) / (t1 - u);
} 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 <= (-9d-83)) .or. (.not. (t1 <= 1.35d-16))) then
tmp = ((-1.0d0) * v) / (t1 - u)
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 <= -9e-83) || !(t1 <= 1.35e-16)) {
tmp = (-1.0 * v) / (t1 - u);
} else {
tmp = -t1 * (v / (u * u));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -9e-83) or not (t1 <= 1.35e-16): tmp = (-1.0 * v) / (t1 - u) else: tmp = -t1 * (v / (u * u)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -9e-83) || !(t1 <= 1.35e-16)) tmp = Float64(Float64(-1.0 * v) / Float64(t1 - u)); 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 <= -9e-83) || ~((t1 <= 1.35e-16))) tmp = (-1.0 * v) / (t1 - u); else tmp = -t1 * (v / (u * u)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -9e-83], N[Not[LessEqual[t1, 1.35e-16]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[(t1 - u), $MachinePrecision]), $MachinePrecision], N[((-t1) * N[(v / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -9 \cdot 10^{-83} \lor \neg \left(t1 \leq 1.35 \cdot 10^{-16}\right):\\
\;\;\;\;\frac{-1 \cdot v}{t1 - u}\\
\mathbf{else}:\\
\;\;\;\;\left(-t1\right) \cdot \frac{v}{u \cdot u}\\
\end{array}
\end{array}
if t1 < -8.99999999999999995e-83 or 1.35e-16 < t1 Initial program 71.5%
Applied rewrites99.3%
Taylor expanded in u around 0
Applied rewrites82.1%
lift-/.f64N/A
frac-2negN/A
lift--.f64N/A
flip--N/A
+-commutativeN/A
distribute-neg-fracN/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-neg-inN/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
sqr-neg-revN/A
+-commutativeN/A
Applied rewrites82.1%
if -8.99999999999999995e-83 < t1 < 1.35e-16Initial program 75.3%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6483.6
Applied rewrites83.6%
Taylor expanded in u around 0
Applied rewrites75.2%
Final simplification79.0%
(FPCore (u v t1) :precision binary64 (if (or (<= u -1.2e+116) (not (<= u 6e+138))) (* v (/ -1.0 (- u))) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.2e+116) || !(u <= 6e+138)) {
tmp = v * (-1.0 / -u);
} else {
tmp = -v / t1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((u <= (-1.2d+116)) .or. (.not. (u <= 6d+138))) then
tmp = v * ((-1.0d0) / -u)
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.2e+116) || !(u <= 6e+138)) {
tmp = v * (-1.0 / -u);
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -1.2e+116) or not (u <= 6e+138): tmp = v * (-1.0 / -u) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -1.2e+116) || !(u <= 6e+138)) tmp = Float64(v * Float64(-1.0 / Float64(-u))); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -1.2e+116) || ~((u <= 6e+138))) tmp = v * (-1.0 / -u); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -1.2e+116], N[Not[LessEqual[u, 6e+138]], $MachinePrecision]], N[(v * N[(-1.0 / (-u)), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.2 \cdot 10^{+116} \lor \neg \left(u \leq 6 \cdot 10^{+138}\right):\\
\;\;\;\;v \cdot \frac{-1}{-u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -1.2e116 or 6.0000000000000002e138 < u Initial program 77.2%
Applied rewrites98.4%
Taylor expanded in u around 0
Applied rewrites51.7%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
remove-double-negN/A
*-commutativeN/A
associate-/l*N/A
lift--.f64N/A
flip--N/A
+-commutativeN/A
distribute-neg-fracN/A
Applied rewrites51.7%
Taylor expanded in u around inf
mul-1-negN/A
lower-neg.f6445.0
Applied rewrites45.0%
if -1.2e116 < u < 6.0000000000000002e138Initial program 71.3%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6461.3
Applied rewrites61.3%
Final simplification56.0%
(FPCore (u v t1) :precision binary64 (/ (* -1.0 v) (- t1 u)))
double code(double u, double v, double t1) {
return (-1.0 * v) / (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 = ((-1.0d0) * v) / (t1 - u)
end function
public static double code(double u, double v, double t1) {
return (-1.0 * v) / (t1 - u);
}
def code(u, v, t1): return (-1.0 * v) / (t1 - u)
function code(u, v, t1) return Float64(Float64(-1.0 * v) / Float64(t1 - u)) end
function tmp = code(u, v, t1) tmp = (-1.0 * v) / (t1 - u); end
code[u_, v_, t1_] := N[(N[(-1.0 * v), $MachinePrecision] / N[(t1 - u), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-1 \cdot v}{t1 - u}
\end{array}
Initial program 73.2%
Applied rewrites96.2%
Taylor expanded in u around 0
Applied rewrites59.0%
lift-/.f64N/A
frac-2negN/A
lift--.f64N/A
flip--N/A
+-commutativeN/A
distribute-neg-fracN/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-neg-inN/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
sqr-neg-revN/A
+-commutativeN/A
Applied rewrites59.0%
(FPCore (u v t1) :precision binary64 (* v (/ -1.0 (- t1 u))))
double code(double u, double v, double t1) {
return v * (-1.0 / (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 = v * ((-1.0d0) / (t1 - u))
end function
public static double code(double u, double v, double t1) {
return v * (-1.0 / (t1 - u));
}
def code(u, v, t1): return v * (-1.0 / (t1 - u))
function code(u, v, t1) return Float64(v * Float64(-1.0 / Float64(t1 - u))) end
function tmp = code(u, v, t1) tmp = v * (-1.0 / (t1 - u)); end
code[u_, v_, t1_] := N[(v * N[(-1.0 / N[(t1 - u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
v \cdot \frac{-1}{t1 - u}
\end{array}
Initial program 73.2%
Applied rewrites96.2%
Taylor expanded in u around 0
Applied rewrites59.0%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
remove-double-negN/A
*-commutativeN/A
associate-/l*N/A
lift--.f64N/A
flip--N/A
+-commutativeN/A
distribute-neg-fracN/A
Applied rewrites59.0%
(FPCore (u v t1) :precision binary64 (/ (- v) t1))
double code(double u, double v, double t1) {
return -v / t1;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = -v / t1
end function
public static double code(double u, double v, double t1) {
return -v / t1;
}
def code(u, v, t1): return -v / t1
function code(u, v, t1) return Float64(Float64(-v) / t1) end
function tmp = code(u, v, t1) tmp = -v / t1; end
code[u_, v_, t1_] := N[((-v) / t1), $MachinePrecision]
\begin{array}{l}
\\
\frac{-v}{t1}
\end{array}
Initial program 73.2%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6448.4
Applied rewrites48.4%
herbie shell --seed 2024354
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))