
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1): return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1): return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}
(FPCore (u v t1) :precision binary64 (/ (* (/ t1 (- u t1)) v) (+ (- u) t1)))
double code(double u, double v, double t1) {
return ((t1 / (u - t1)) * v) / (-u + t1);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = ((t1 / (u - t1)) * v) / (-u + t1)
end function
public static double code(double u, double v, double t1) {
return ((t1 / (u - t1)) * v) / (-u + t1);
}
def code(u, v, t1): return ((t1 / (u - t1)) * v) / (-u + t1)
function code(u, v, t1) return Float64(Float64(Float64(t1 / Float64(u - t1)) * v) / Float64(Float64(-u) + t1)) end
function tmp = code(u, v, t1) tmp = ((t1 / (u - t1)) * v) / (-u + t1); end
code[u_, v_, t1_] := N[(N[(N[(t1 / N[(u - t1), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{t1}{u - t1} \cdot v}{\left(-u\right) + t1}
\end{array}
Initial program 72.8%
Applied rewrites97.5%
Final simplification97.5%
(FPCore (u v t1) :precision binary64 (if (<= (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))) 4e+281) (/ (/ (* v t1) (- t1 u)) (- u t1)) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if (((-t1 * v) / ((t1 + u) * (t1 + u))) <= 4e+281) {
tmp = ((v * t1) / (t1 - u)) / (u - t1);
} 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 * v) / ((t1 + u) * (t1 + u))) <= 4d+281) then
tmp = ((v * t1) / (t1 - u)) / (u - t1)
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (((-t1 * v) / ((t1 + u) * (t1 + u))) <= 4e+281) {
tmp = ((v * t1) / (t1 - u)) / (u - t1);
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if ((-t1 * v) / ((t1 + u) * (t1 + u))) <= 4e+281: tmp = ((v * t1) / (t1 - u)) / (u - t1) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) <= 4e+281) tmp = Float64(Float64(Float64(v * t1) / Float64(t1 - u)) / Float64(u - t1)); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (((-t1 * v) / ((t1 + u) * (t1 + u))) <= 4e+281) tmp = ((v * t1) / (t1 - u)) / (u - t1); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4e+281], N[(N[(N[(v * t1), $MachinePrecision] / N[(t1 - u), $MachinePrecision]), $MachinePrecision] / N[(u - t1), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \leq 4 \cdot 10^{+281}:\\
\;\;\;\;\frac{\frac{v \cdot t1}{t1 - u}}{u - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (neg.f64 t1) v) (*.f64 (+.f64 t1 u) (+.f64 t1 u))) < 4.0000000000000001e281Initial program 86.3%
Applied rewrites97.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-2negN/A
lift-neg.f64N/A
distribute-rgt-neg-inN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lift-*.f64N/A
lift--.f64N/A
flip--N/A
+-commutativeN/A
distribute-neg-frac2N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
sqr-neg-revN/A
distribute-rgt-neg-outN/A
distribute-neg-inN/A
fp-cancel-sub-sign-invN/A
Applied rewrites97.7%
if 4.0000000000000001e281 < (/.f64 (*.f64 (neg.f64 t1) v) (*.f64 (+.f64 t1 u) (+.f64 t1 u))) Initial program 9.8%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6476.9
Applied rewrites76.9%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1e-41) (not (<= t1 9e-5))) (/ (* -1.0 v) (+ (- u) t1)) (/ (* (/ (- v) u) t1) u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1e-41) || !(t1 <= 9e-5)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = ((-v / u) * t1) / u;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-1d-41)) .or. (.not. (t1 <= 9d-5))) then
tmp = ((-1.0d0) * v) / (-u + t1)
else
tmp = ((-v / u) * t1) / u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1e-41) || !(t1 <= 9e-5)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = ((-v / u) * t1) / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1e-41) or not (t1 <= 9e-5): tmp = (-1.0 * v) / (-u + t1) else: tmp = ((-v / u) * t1) / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1e-41) || !(t1 <= 9e-5)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(Float64(Float64(-v) / u) * t1) / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -1e-41) || ~((t1 <= 9e-5))) tmp = (-1.0 * v) / (-u + t1); else tmp = ((-v / u) * t1) / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1e-41], N[Not[LessEqual[t1, 9e-5]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-v) / u), $MachinePrecision] * t1), $MachinePrecision] / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1 \cdot 10^{-41} \lor \neg \left(t1 \leq 9 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-v}{u} \cdot t1}{u}\\
\end{array}
\end{array}
if t1 < -1.00000000000000001e-41 or 9.00000000000000057e-5 < t1 Initial program 59.5%
Applied rewrites99.1%
Taylor expanded in u around 0
Applied rewrites81.8%
if -1.00000000000000001e-41 < t1 < 9.00000000000000057e-5Initial program 87.4%
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-/.f6484.8
Applied rewrites84.8%
Applied rewrites85.6%
Final simplification83.6%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1e-41) (not (<= t1 9e-5))) (/ (* -1.0 v) (+ (- u) t1)) (/ (* (/ t1 u) v) (- u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1e-41) || !(t1 <= 9e-5)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = ((t1 / u) * v) / -u;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-1d-41)) .or. (.not. (t1 <= 9d-5))) then
tmp = ((-1.0d0) * v) / (-u + t1)
else
tmp = ((t1 / u) * v) / -u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1e-41) || !(t1 <= 9e-5)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = ((t1 / u) * v) / -u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1e-41) or not (t1 <= 9e-5): tmp = (-1.0 * v) / (-u + t1) else: tmp = ((t1 / u) * v) / -u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1e-41) || !(t1 <= 9e-5)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); 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 <= -1e-41) || ~((t1 <= 9e-5))) tmp = (-1.0 * v) / (-u + t1); else tmp = ((t1 / u) * v) / -u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1e-41], N[Not[LessEqual[t1, 9e-5]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t1 / u), $MachinePrecision] * v), $MachinePrecision] / (-u)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1 \cdot 10^{-41} \lor \neg \left(t1 \leq 9 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t1}{u} \cdot v}{-u}\\
\end{array}
\end{array}
if t1 < -1.00000000000000001e-41 or 9.00000000000000057e-5 < t1 Initial program 59.5%
Applied rewrites99.1%
Taylor expanded in u around 0
Applied rewrites81.8%
if -1.00000000000000001e-41 < t1 < 9.00000000000000057e-5Initial program 87.4%
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-/.f6484.8
Applied rewrites84.8%
Applied rewrites85.6%
Applied rewrites85.6%
Final simplification83.6%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.12e-41) (not (<= t1 9e-5))) (/ (* -1.0 v) (+ (- u) t1)) (* (/ v u) (/ (- t1) u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.12e-41) || !(t1 <= 9e-5)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (v / u) * (-t1 / u);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-1.12d-41)) .or. (.not. (t1 <= 9d-5))) then
tmp = ((-1.0d0) * v) / (-u + t1)
else
tmp = (v / u) * (-t1 / u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.12e-41) || !(t1 <= 9e-5)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (v / u) * (-t1 / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.12e-41) or not (t1 <= 9e-5): tmp = (-1.0 * v) / (-u + t1) else: tmp = (v / u) * (-t1 / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.12e-41) || !(t1 <= 9e-5)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); 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 <= -1.12e-41) || ~((t1 <= 9e-5))) tmp = (-1.0 * v) / (-u + t1); else tmp = (v / u) * (-t1 / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.12e-41], N[Not[LessEqual[t1, 9e-5]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[(N[(v / u), $MachinePrecision] * N[((-t1) / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.12 \cdot 10^{-41} \lor \neg \left(t1 \leq 9 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u} \cdot \frac{-t1}{u}\\
\end{array}
\end{array}
if t1 < -1.11999999999999999e-41 or 9.00000000000000057e-5 < t1 Initial program 59.5%
Applied rewrites99.1%
Taylor expanded in u around 0
Applied rewrites81.8%
if -1.11999999999999999e-41 < t1 < 9.00000000000000057e-5Initial program 87.4%
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-/.f6484.8
Applied rewrites84.8%
Final simplification83.2%
(FPCore (u v t1) :precision binary64 (if (<= t1 -4.2e+90) (/ (* -1.0 v) (+ (- u) t1)) (if (<= t1 1.2e+117) (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))) (/ (- v) t1))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -4.2e+90) {
tmp = (-1.0 * v) / (-u + t1);
} else if (t1 <= 1.2e+117) {
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 <= (-4.2d+90)) then
tmp = ((-1.0d0) * v) / (-u + t1)
else if (t1 <= 1.2d+117) 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 <= -4.2e+90) {
tmp = (-1.0 * v) / (-u + t1);
} else if (t1 <= 1.2e+117) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -4.2e+90: tmp = (-1.0 * v) / (-u + t1) elif t1 <= 1.2e+117: tmp = (-t1 * v) / ((t1 + u) * (t1 + u)) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -4.2e+90) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); elseif (t1 <= 1.2e+117) 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 <= -4.2e+90) tmp = (-1.0 * v) / (-u + t1); elseif (t1 <= 1.2e+117) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -4.2e+90], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 1.2e+117], 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 -4.2 \cdot 10^{+90}:\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{elif}\;t1 \leq 1.2 \cdot 10^{+117}:\\
\;\;\;\;\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 < -4.19999999999999961e90Initial program 58.0%
Applied rewrites98.4%
Taylor expanded in u around 0
Applied rewrites87.3%
if -4.19999999999999961e90 < t1 < 1.1999999999999999e117Initial program 88.5%
if 1.1999999999999999e117 < t1 Initial program 29.8%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6484.9
Applied rewrites84.9%
Final simplification87.7%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1e-41) (not (<= t1 9e-5))) (/ (* -1.0 v) (+ (- u) t1)) (/ (* (- t1) v) (* u u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1e-41) || !(t1 <= 9e-5)) {
tmp = (-1.0 * 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 <= (-1d-41)) .or. (.not. (t1 <= 9d-5))) then
tmp = ((-1.0d0) * 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 <= -1e-41) || !(t1 <= 9e-5)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (-t1 * v) / (u * u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1e-41) or not (t1 <= 9e-5): tmp = (-1.0 * v) / (-u + t1) else: tmp = (-t1 * v) / (u * u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1e-41) || !(t1 <= 9e-5)) tmp = Float64(Float64(-1.0 * v) / Float64(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 <= -1e-41) || ~((t1 <= 9e-5))) tmp = (-1.0 * v) / (-u + t1); else tmp = (-t1 * v) / (u * u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1e-41], N[Not[LessEqual[t1, 9e-5]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / 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 -1 \cdot 10^{-41} \lor \neg \left(t1 \leq 9 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{u \cdot u}\\
\end{array}
\end{array}
if t1 < -1.00000000000000001e-41 or 9.00000000000000057e-5 < t1 Initial program 59.5%
Applied rewrites99.1%
Taylor expanded in u around 0
Applied rewrites81.8%
if -1.00000000000000001e-41 < t1 < 9.00000000000000057e-5Initial program 87.4%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6480.1
Applied rewrites80.1%
Final simplification81.0%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.12e-41) (not (<= t1 9e-5))) (/ (* -1.0 v) (+ (- u) t1)) (* (/ (- t1) (* u u)) v)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.12e-41) || !(t1 <= 9e-5)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (-t1 / (u * u)) * v;
}
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 <= (-1.12d-41)) .or. (.not. (t1 <= 9d-5))) then
tmp = ((-1.0d0) * v) / (-u + t1)
else
tmp = (-t1 / (u * u)) * v
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.12e-41) || !(t1 <= 9e-5)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (-t1 / (u * u)) * v;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.12e-41) or not (t1 <= 9e-5): tmp = (-1.0 * v) / (-u + t1) else: tmp = (-t1 / (u * u)) * v return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.12e-41) || !(t1 <= 9e-5)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(Float64(-t1) / Float64(u * u)) * v); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -1.12e-41) || ~((t1 <= 9e-5))) tmp = (-1.0 * v) / (-u + t1); else tmp = (-t1 / (u * u)) * v; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.12e-41], N[Not[LessEqual[t1, 9e-5]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) / N[(u * u), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.12 \cdot 10^{-41} \lor \neg \left(t1 \leq 9 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t1}{u \cdot u} \cdot v\\
\end{array}
\end{array}
if t1 < -1.11999999999999999e-41 or 9.00000000000000057e-5 < t1 Initial program 59.5%
Applied rewrites99.1%
Taylor expanded in u around 0
Applied rewrites81.8%
if -1.11999999999999999e-41 < t1 < 9.00000000000000057e-5Initial program 87.4%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6480.1
Applied rewrites80.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6476.4
Applied rewrites76.4%
Final simplification79.2%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.12e-41) (not (<= t1 9e-5))) (/ (* -1.0 v) (+ (- u) t1)) (* (/ (- v) (* u u)) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.12e-41) || !(t1 <= 9e-5)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (-v / (u * u)) * t1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-1.12d-41)) .or. (.not. (t1 <= 9d-5))) then
tmp = ((-1.0d0) * v) / (-u + t1)
else
tmp = (-v / (u * u)) * t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.12e-41) || !(t1 <= 9e-5)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (-v / (u * u)) * t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.12e-41) or not (t1 <= 9e-5): tmp = (-1.0 * v) / (-u + t1) else: tmp = (-v / (u * u)) * t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.12e-41) || !(t1 <= 9e-5)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(Float64(-v) / Float64(u * u)) * t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -1.12e-41) || ~((t1 <= 9e-5))) tmp = (-1.0 * v) / (-u + t1); else tmp = (-v / (u * u)) * t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.12e-41], N[Not[LessEqual[t1, 9e-5]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[(N[((-v) / N[(u * u), $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.12 \cdot 10^{-41} \lor \neg \left(t1 \leq 9 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u \cdot u} \cdot t1\\
\end{array}
\end{array}
if t1 < -1.11999999999999999e-41 or 9.00000000000000057e-5 < t1 Initial program 59.5%
Applied rewrites99.1%
Taylor expanded in u around 0
Applied rewrites81.8%
if -1.11999999999999999e-41 < t1 < 9.00000000000000057e-5Initial program 87.4%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6480.1
Applied rewrites80.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.6
Applied rewrites75.6%
Final simplification78.8%
(FPCore (u v t1) :precision binary64 (/ (* -1.0 v) (+ (- u) t1)))
double code(double u, double v, double t1) {
return (-1.0 * v) / (-u + t1);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(u, v, t1)
use fmin_fmax_functions
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = ((-1.0d0) * v) / (-u + t1)
end function
public static double code(double u, double v, double t1) {
return (-1.0 * v) / (-u + t1);
}
def code(u, v, t1): return (-1.0 * v) / (-u + t1)
function code(u, v, t1) return Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)) end
function tmp = code(u, v, t1) tmp = (-1.0 * v) / (-u + t1); end
code[u_, v_, t1_] := N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-1 \cdot v}{\left(-u\right) + t1}
\end{array}
Initial program 72.8%
Applied rewrites97.5%
Taylor expanded in u around 0
Applied rewrites59.0%
Final simplification59.0%
(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 72.8%
Applied rewrites97.5%
Taylor expanded in u around 0
Applied rewrites59.0%
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 72.8%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6450.8
Applied rewrites50.8%
herbie shell --seed 2024364
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))