
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
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(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y - z) / (((t - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
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(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y - z) / (((t - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- (+ 1.0 t) z) a))) (- x (- (/ y t_1) (/ z t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((1.0 + t) - z) / a;
return x - ((y / t_1) - (z / t_1));
}
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(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
t_1 = ((1.0d0 + t) - z) / a
code = x - ((y / t_1) - (z / t_1))
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((1.0 + t) - z) / a;
return x - ((y / t_1) - (z / t_1));
}
def code(x, y, z, t, a): t_1 = ((1.0 + t) - z) / a return x - ((y / t_1) - (z / t_1))
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(1.0 + t) - z) / a) return Float64(x - Float64(Float64(y / t_1) - Float64(z / t_1))) end
function tmp = code(x, y, z, t, a) t_1 = ((1.0 + t) - z) / a; tmp = x - ((y / t_1) - (z / t_1)); end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision] / a), $MachinePrecision]}, N[(x - N[(N[(y / t$95$1), $MachinePrecision] - N[(z / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(1 + t\right) - z}{a}\\
x - \left(\frac{y}{t\_1} - \frac{z}{t\_1}\right)
\end{array}
\end{array}
Initial program 97.2%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6497.2
Applied rewrites97.2%
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
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(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y - z) / (((t - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
Initial program 97.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (/ (- y z) (- (/ t a) (/ z a))))))
(if (<= t -1.0)
t_1
(if (<= t 8.5e+60) (- x (* (- y z) (/ a (- 1.0 z)))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - ((y - z) / ((t / a) - (z / a)));
double tmp;
if (t <= -1.0) {
tmp = t_1;
} else if (t <= 8.5e+60) {
tmp = x - ((y - z) * (a / (1.0 - z)));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x - ((y - z) / ((t / a) - (z / a)))
if (t <= (-1.0d0)) then
tmp = t_1
else if (t <= 8.5d+60) then
tmp = x - ((y - z) * (a / (1.0d0 - z)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x - ((y - z) / ((t / a) - (z / a)));
double tmp;
if (t <= -1.0) {
tmp = t_1;
} else if (t <= 8.5e+60) {
tmp = x - ((y - z) * (a / (1.0 - z)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - ((y - z) / ((t / a) - (z / a))) tmp = 0 if t <= -1.0: tmp = t_1 elif t <= 8.5e+60: tmp = x - ((y - z) * (a / (1.0 - z))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(Float64(y - z) / Float64(Float64(t / a) - Float64(z / a)))) tmp = 0.0 if (t <= -1.0) tmp = t_1; elseif (t <= 8.5e+60) tmp = Float64(x - Float64(Float64(y - z) * Float64(a / Float64(1.0 - z)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - ((y - z) / ((t / a) - (z / a))); tmp = 0.0; if (t <= -1.0) tmp = t_1; elseif (t <= 8.5e+60) tmp = x - ((y - z) * (a / (1.0 - z))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(t / a), $MachinePrecision] - N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.0], t$95$1, If[LessEqual[t, 8.5e+60], N[(x - N[(N[(y - z), $MachinePrecision] * N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y - z}{\frac{t}{a} - \frac{z}{a}}\\
\mathbf{if}\;t \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{+60}:\\
\;\;\;\;x - \left(y - z\right) \cdot \frac{a}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1 or 8.50000000000000064e60 < t Initial program 96.6%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
associate--l+N/A
div-subN/A
div-add-revN/A
lower--.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f6492.6
Applied rewrites92.6%
Taylor expanded in t around inf
Applied rewrites92.4%
if -1 < t < 8.50000000000000064e60Initial program 97.7%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6485.2
Applied rewrites85.2%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6495.3
Applied rewrites95.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma a (/ z (- t z)) x)))
(if (<= z -2.25e+17)
t_1
(if (<= z 3.9e+39) (- x (/ (- y z) (/ (+ t 1.0) a))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(a, (z / (t - z)), x);
double tmp;
if (z <= -2.25e+17) {
tmp = t_1;
} else if (z <= 3.9e+39) {
tmp = x - ((y - z) / ((t + 1.0) / a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(a, Float64(z / Float64(t - z)), x) tmp = 0.0 if (z <= -2.25e+17) tmp = t_1; elseif (z <= 3.9e+39) tmp = Float64(x - Float64(Float64(y - z) / Float64(Float64(t + 1.0) / a))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -2.25e+17], t$95$1, If[LessEqual[z, 3.9e+39], N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(t + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, \frac{z}{t - z}, x\right)\\
\mathbf{if}\;z \leq -2.25 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+39}:\\
\;\;\;\;x - \frac{y - z}{\frac{t + 1}{a}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.25e17 or 3.9000000000000001e39 < z Initial program 94.9%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6494.9
Applied rewrites94.9%
Taylor expanded in y around 0
sub-divN/A
associate--l+N/A
+-commutativeN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f6486.7
Applied rewrites86.7%
Taylor expanded in t around inf
Applied rewrites86.7%
if -2.25e17 < z < 3.9000000000000001e39Initial program 99.1%
Taylor expanded in z around 0
Applied rewrites96.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (/ (- y z) (/ t a)))))
(if (<= t -5.5e+64)
t_1
(if (<= t 1.02e+43) (- x (* (- y z) (/ a (- 1.0 z)))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - ((y - z) / (t / a));
double tmp;
if (t <= -5.5e+64) {
tmp = t_1;
} else if (t <= 1.02e+43) {
tmp = x - ((y - z) * (a / (1.0 - z)));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x - ((y - z) / (t / a))
if (t <= (-5.5d+64)) then
tmp = t_1
else if (t <= 1.02d+43) then
tmp = x - ((y - z) * (a / (1.0d0 - z)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x - ((y - z) / (t / a));
double tmp;
if (t <= -5.5e+64) {
tmp = t_1;
} else if (t <= 1.02e+43) {
tmp = x - ((y - z) * (a / (1.0 - z)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - ((y - z) / (t / a)) tmp = 0 if t <= -5.5e+64: tmp = t_1 elif t <= 1.02e+43: tmp = x - ((y - z) * (a / (1.0 - z))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(Float64(y - z) / Float64(t / a))) tmp = 0.0 if (t <= -5.5e+64) tmp = t_1; elseif (t <= 1.02e+43) tmp = Float64(x - Float64(Float64(y - z) * Float64(a / Float64(1.0 - z)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - ((y - z) / (t / a)); tmp = 0.0; if (t <= -5.5e+64) tmp = t_1; elseif (t <= 1.02e+43) tmp = x - ((y - z) * (a / (1.0 - z))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(N[(y - z), $MachinePrecision] / N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.5e+64], t$95$1, If[LessEqual[t, 1.02e+43], N[(x - N[(N[(y - z), $MachinePrecision] * N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y - z}{\frac{t}{a}}\\
\mathbf{if}\;t \leq -5.5 \cdot 10^{+64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.02 \cdot 10^{+43}:\\
\;\;\;\;x - \left(y - z\right) \cdot \frac{a}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.4999999999999996e64 or 1.02e43 < t Initial program 97.0%
Taylor expanded in t around inf
Applied rewrites85.7%
if -5.4999999999999996e64 < t < 1.02e43Initial program 97.4%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6483.9
Applied rewrites83.9%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6493.5
Applied rewrites93.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ (- z y) (- (+ 1.0 t) z)) a))
(t_2 (/ (- y z) (/ (+ (- t z) 1.0) a))))
(if (<= t_2 -5e+95)
t_1
(if (<= t_2 1e+139) (fma a (/ z (- (+ t 1.0) z)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - y) / ((1.0 + t) - z)) * a;
double t_2 = (y - z) / (((t - z) + 1.0) / a);
double tmp;
if (t_2 <= -5e+95) {
tmp = t_1;
} else if (t_2 <= 1e+139) {
tmp = fma(a, (z / ((t + 1.0) - z)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(z - y) / Float64(Float64(1.0 + t) - z)) * a) t_2 = Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a)) tmp = 0.0 if (t_2 <= -5e+95) tmp = t_1; elseif (t_2 <= 1e+139) tmp = fma(a, Float64(z / Float64(Float64(t + 1.0) - z)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+95], t$95$1, If[LessEqual[t$95$2, 1e+139], N[(a * N[(z / N[(N[(t + 1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - y}{\left(1 + t\right) - z} \cdot a\\
t_2 := \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+139}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{z}{\left(t + 1\right) - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -5.00000000000000025e95 or 1.00000000000000003e139 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 99.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
lower-+.f6485.6
Applied rewrites85.6%
if -5.00000000000000025e95 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < 1.00000000000000003e139Initial program 96.2%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6496.2
Applied rewrites96.2%
Taylor expanded in y around 0
sub-divN/A
associate--l+N/A
+-commutativeN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f6485.0
Applied rewrites85.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z y) (/ (- (+ 1.0 t) z) a)))
(t_2 (/ (- y z) (/ (+ (- t z) 1.0) a))))
(if (<= t_2 -5e+95)
t_1
(if (<= t_2 1e+139) (fma a (/ z (- (+ t 1.0) z)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - y) / (((1.0 + t) - z) / a);
double t_2 = (y - z) / (((t - z) + 1.0) / a);
double tmp;
if (t_2 <= -5e+95) {
tmp = t_1;
} else if (t_2 <= 1e+139) {
tmp = fma(a, (z / ((t + 1.0) - z)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - y) / Float64(Float64(Float64(1.0 + t) - z) / a)) t_2 = Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a)) tmp = 0.0 if (t_2 <= -5e+95) tmp = t_1; elseif (t_2 <= 1e+139) tmp = fma(a, Float64(z / Float64(Float64(t + 1.0) - z)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - y), $MachinePrecision] / N[(N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+95], t$95$1, If[LessEqual[t$95$2, 1e+139], N[(a * N[(z / N[(N[(t + 1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - y}{\frac{\left(1 + t\right) - z}{a}}\\
t_2 := \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+139}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{z}{\left(t + 1\right) - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -5.00000000000000025e95 or 1.00000000000000003e139 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 99.8%
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
associate--l+N/A
div-subN/A
div-add-revN/A
lower--.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
sub-divN/A
div-add-revN/A
lower-/.f64N/A
lower--.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lift-+.f6485.5
Applied rewrites85.5%
if -5.00000000000000025e95 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < 1.00000000000000003e139Initial program 96.2%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6496.2
Applied rewrites96.2%
Taylor expanded in y around 0
sub-divN/A
associate--l+N/A
+-commutativeN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f6485.0
Applied rewrites85.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma a (/ z (- (+ t 1.0) z)) x)))
(if (<= z -1.25e-87)
t_1
(if (<= z 2.7e-7) (- x (* a (/ y (+ 1.0 t)))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(a, (z / ((t + 1.0) - z)), x);
double tmp;
if (z <= -1.25e-87) {
tmp = t_1;
} else if (z <= 2.7e-7) {
tmp = x - (a * (y / (1.0 + t)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(a, Float64(z / Float64(Float64(t + 1.0) - z)), x) tmp = 0.0 if (z <= -1.25e-87) tmp = t_1; elseif (z <= 2.7e-7) tmp = Float64(x - Float64(a * Float64(y / Float64(1.0 + t)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[(z / N[(N[(t + 1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -1.25e-87], t$95$1, If[LessEqual[z, 2.7e-7], N[(x - N[(a * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, \frac{z}{\left(t + 1\right) - z}, x\right)\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{-87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-7}:\\
\;\;\;\;x - a \cdot \frac{y}{1 + t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.25000000000000011e-87 or 2.70000000000000009e-7 < z Initial program 95.6%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6495.6
Applied rewrites95.6%
Taylor expanded in y around 0
sub-divN/A
associate--l+N/A
+-commutativeN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f6483.4
Applied rewrites83.4%
if -1.25000000000000011e-87 < z < 2.70000000000000009e-7Initial program 99.2%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6494.0
Applied rewrites94.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma a (/ z (- t z)) x))) (if (<= z -2.15e+17) t_1 (if (<= z 0.75) (- x (* a (/ y (+ 1.0 t)))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(a, (z / (t - z)), x);
double tmp;
if (z <= -2.15e+17) {
tmp = t_1;
} else if (z <= 0.75) {
tmp = x - (a * (y / (1.0 + t)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(a, Float64(z / Float64(t - z)), x) tmp = 0.0 if (z <= -2.15e+17) tmp = t_1; elseif (z <= 0.75) tmp = Float64(x - Float64(a * Float64(y / Float64(1.0 + t)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -2.15e+17], t$95$1, If[LessEqual[z, 0.75], N[(x - N[(a * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, \frac{z}{t - z}, x\right)\\
\mathbf{if}\;z \leq -2.15 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.75:\\
\;\;\;\;x - a \cdot \frac{y}{1 + t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.15e17 or 0.75 < z Initial program 95.1%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6495.1
Applied rewrites95.1%
Taylor expanded in y around 0
sub-divN/A
associate--l+N/A
+-commutativeN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f6485.6
Applied rewrites85.6%
Taylor expanded in t around inf
Applied rewrites85.5%
if -2.15e17 < z < 0.75Initial program 99.1%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6492.2
Applied rewrites92.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y z) (/ (+ (- t z) 1.0) a)))
(t_2 (* (/ (- z y) (- t z)) a)))
(if (<= t_1 -1e+305)
(- x (* a y))
(if (<= t_1 -5e+95)
t_2
(if (<= t_1 1e-95)
(fma a (/ z (- t z)) x)
(if (<= t_1 1e+139) (fma a (/ z (- 1.0 z)) x) t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - z) / (((t - z) + 1.0) / a);
double t_2 = ((z - y) / (t - z)) * a;
double tmp;
if (t_1 <= -1e+305) {
tmp = x - (a * y);
} else if (t_1 <= -5e+95) {
tmp = t_2;
} else if (t_1 <= 1e-95) {
tmp = fma(a, (z / (t - z)), x);
} else if (t_1 <= 1e+139) {
tmp = fma(a, (z / (1.0 - z)), x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a)) t_2 = Float64(Float64(Float64(z - y) / Float64(t - z)) * a) tmp = 0.0 if (t_1 <= -1e+305) tmp = Float64(x - Float64(a * y)); elseif (t_1 <= -5e+95) tmp = t_2; elseif (t_1 <= 1e-95) tmp = fma(a, Float64(z / Float64(t - z)), x); elseif (t_1 <= 1e+139) tmp = fma(a, Float64(z / Float64(1.0 - z)), x); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z - y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+305], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5e+95], t$95$2, If[LessEqual[t$95$1, 1e-95], N[(a * N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 1e+139], N[(a * N[(z / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}\\
t_2 := \frac{z - y}{t - z} \cdot a\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+305}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{+95}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{-95}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{z}{t - z}, x\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+139}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{z}{1 - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -9.9999999999999994e304Initial program 100.0%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6488.7
Applied rewrites88.7%
Taylor expanded in z around 0
lower-*.f6477.5
Applied rewrites77.5%
if -9.9999999999999994e304 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -5.00000000000000025e95 or 1.00000000000000003e139 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 99.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
lower-+.f6484.0
Applied rewrites84.0%
Taylor expanded in t around inf
Applied rewrites62.0%
if -5.00000000000000025e95 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < 9.99999999999999989e-96Initial program 95.1%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6495.1
Applied rewrites95.1%
Taylor expanded in y around 0
sub-divN/A
associate--l+N/A
+-commutativeN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f6488.0
Applied rewrites88.0%
Taylor expanded in t around inf
Applied rewrites85.4%
if 9.99999999999999989e-96 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < 1.00000000000000003e139Initial program 99.8%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
sub-divN/A
associate--l+N/A
+-commutativeN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f6475.2
Applied rewrites75.2%
Taylor expanded in t around 0
Applied rewrites65.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* (- y z) a))) (t_2 (fma a (/ z (- t z)) x)))
(if (<= z -1.8e-39)
t_2
(if (<= z -1.7e-145)
t_1
(if (<= z 4e-234) (- x (/ y (/ t a))) (if (<= z 0.085) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - ((y - z) * a);
double t_2 = fma(a, (z / (t - z)), x);
double tmp;
if (z <= -1.8e-39) {
tmp = t_2;
} else if (z <= -1.7e-145) {
tmp = t_1;
} else if (z <= 4e-234) {
tmp = x - (y / (t / a));
} else if (z <= 0.085) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x - Float64(Float64(y - z) * a)) t_2 = fma(a, Float64(z / Float64(t - z)), x) tmp = 0.0 if (z <= -1.8e-39) tmp = t_2; elseif (z <= -1.7e-145) tmp = t_1; elseif (z <= 4e-234) tmp = Float64(x - Float64(y / Float64(t / a))); elseif (z <= 0.085) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(N[(y - z), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(a * N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -1.8e-39], t$95$2, If[LessEqual[z, -1.7e-145], t$95$1, If[LessEqual[z, 4e-234], N[(x - N[(y / N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.085], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \left(y - z\right) \cdot a\\
t_2 := \mathsf{fma}\left(a, \frac{z}{t - z}, x\right)\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{-39}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{-145}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-234}:\\
\;\;\;\;x - \frac{y}{\frac{t}{a}}\\
\mathbf{elif}\;z \leq 0.085:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -1.8e-39 or 0.0850000000000000061 < z Initial program 95.4%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6495.4
Applied rewrites95.4%
Taylor expanded in y around 0
sub-divN/A
associate--l+N/A
+-commutativeN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f6484.4
Applied rewrites84.4%
Taylor expanded in t around inf
Applied rewrites83.4%
if -1.8e-39 < z < -1.6999999999999999e-145 or 3.9999999999999998e-234 < z < 0.0850000000000000061Initial program 99.2%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6472.8
Applied rewrites72.8%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6472.8
Applied rewrites72.8%
Taylor expanded in z around 0
Applied rewrites72.4%
if -1.6999999999999999e-145 < z < 3.9999999999999998e-234Initial program 99.3%
Taylor expanded in t around inf
Applied rewrites67.4%
Taylor expanded in y around inf
Applied rewrites66.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (/ y (/ t a)))))
(if (<= t -1.08e+27)
t_1
(if (<= t -8e-217)
(- x (* (- y z) a))
(if (<= t 2.3e+43) (fma a (/ z (- 1.0 z)) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y / (t / a));
double tmp;
if (t <= -1.08e+27) {
tmp = t_1;
} else if (t <= -8e-217) {
tmp = x - ((y - z) * a);
} else if (t <= 2.3e+43) {
tmp = fma(a, (z / (1.0 - z)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x - Float64(y / Float64(t / a))) tmp = 0.0 if (t <= -1.08e+27) tmp = t_1; elseif (t <= -8e-217) tmp = Float64(x - Float64(Float64(y - z) * a)); elseif (t <= 2.3e+43) tmp = fma(a, Float64(z / Float64(1.0 - z)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y / N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.08e+27], t$95$1, If[LessEqual[t, -8e-217], N[(x - N[(N[(y - z), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.3e+43], N[(a * N[(z / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{\frac{t}{a}}\\
\mathbf{if}\;t \leq -1.08 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -8 \cdot 10^{-217}:\\
\;\;\;\;x - \left(y - z\right) \cdot a\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{+43}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{z}{1 - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.08e27 or 2.3000000000000002e43 < t Initial program 96.8%
Taylor expanded in t around inf
Applied rewrites84.7%
Taylor expanded in y around inf
Applied rewrites78.5%
if -1.08e27 < t < -8.00000000000000066e-217Initial program 97.2%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6482.8
Applied rewrites82.8%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6493.4
Applied rewrites93.4%
Taylor expanded in z around 0
Applied rewrites60.6%
if -8.00000000000000066e-217 < t < 2.3000000000000002e43Initial program 97.7%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6497.7
Applied rewrites97.7%
Taylor expanded in y around 0
sub-divN/A
associate--l+N/A
+-commutativeN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f6470.5
Applied rewrites70.5%
Taylor expanded in t around 0
Applied rewrites69.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (/ y (/ t a)))))
(if (<= t -1.08e+27)
t_1
(if (<= t 6.2e-86)
(- x (* (- y z) a))
(if (<= t 1.02e+43) (- x a) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y / (t / a));
double tmp;
if (t <= -1.08e+27) {
tmp = t_1;
} else if (t <= 6.2e-86) {
tmp = x - ((y - z) * a);
} else if (t <= 1.02e+43) {
tmp = x - a;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x - (y / (t / a))
if (t <= (-1.08d+27)) then
tmp = t_1
else if (t <= 6.2d-86) then
tmp = x - ((y - z) * a)
else if (t <= 1.02d+43) then
tmp = x - a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y / (t / a));
double tmp;
if (t <= -1.08e+27) {
tmp = t_1;
} else if (t <= 6.2e-86) {
tmp = x - ((y - z) * a);
} else if (t <= 1.02e+43) {
tmp = x - a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (y / (t / a)) tmp = 0 if t <= -1.08e+27: tmp = t_1 elif t <= 6.2e-86: tmp = x - ((y - z) * a) elif t <= 1.02e+43: tmp = x - a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(y / Float64(t / a))) tmp = 0.0 if (t <= -1.08e+27) tmp = t_1; elseif (t <= 6.2e-86) tmp = Float64(x - Float64(Float64(y - z) * a)); elseif (t <= 1.02e+43) tmp = Float64(x - a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (y / (t / a)); tmp = 0.0; if (t <= -1.08e+27) tmp = t_1; elseif (t <= 6.2e-86) tmp = x - ((y - z) * a); elseif (t <= 1.02e+43) tmp = x - a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y / N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.08e+27], t$95$1, If[LessEqual[t, 6.2e-86], N[(x - N[(N[(y - z), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.02e+43], N[(x - a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{\frac{t}{a}}\\
\mathbf{if}\;t \leq -1.08 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{-86}:\\
\;\;\;\;x - \left(y - z\right) \cdot a\\
\mathbf{elif}\;t \leq 1.02 \cdot 10^{+43}:\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.08e27 or 1.02e43 < t Initial program 96.8%
Taylor expanded in t around inf
Applied rewrites84.7%
Taylor expanded in y around inf
Applied rewrites78.5%
if -1.08e27 < t < 6.19999999999999977e-86Initial program 97.4%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6485.9
Applied rewrites85.9%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6495.9
Applied rewrites95.9%
Taylor expanded in z around 0
Applied rewrites62.6%
if 6.19999999999999977e-86 < t < 1.02e43Initial program 98.1%
Taylor expanded in z around inf
Applied rewrites61.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -75.0) (- x a) (if (<= z 0.106) (- x (* (- y z) a)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -75.0) {
tmp = x - a;
} else if (z <= 0.106) {
tmp = x - ((y - z) * a);
} else {
tmp = x - a;
}
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(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-75.0d0)) then
tmp = x - a
else if (z <= 0.106d0) then
tmp = x - ((y - z) * a)
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -75.0) {
tmp = x - a;
} else if (z <= 0.106) {
tmp = x - ((y - z) * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -75.0: tmp = x - a elif z <= 0.106: tmp = x - ((y - z) * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -75.0) tmp = Float64(x - a); elseif (z <= 0.106) tmp = Float64(x - Float64(Float64(y - z) * a)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -75.0) tmp = x - a; elseif (z <= 0.106) tmp = x - ((y - z) * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -75.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 0.106], N[(x - N[(N[(y - z), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -75:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 0.106:\\
\;\;\;\;x - \left(y - z\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -75 or 0.105999999999999997 < z Initial program 95.2%
Taylor expanded in z around inf
Applied rewrites76.2%
if -75 < z < 0.105999999999999997Initial program 99.2%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6474.5
Applied rewrites74.5%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6474.5
Applied rewrites74.5%
Taylor expanded in z around 0
Applied rewrites74.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.95e-19) (- x a) (if (<= z 0.225) (- x (* a y)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.95e-19) {
tmp = x - a;
} else if (z <= 0.225) {
tmp = x - (a * y);
} else {
tmp = x - a;
}
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(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-1.95d-19)) then
tmp = x - a
else if (z <= 0.225d0) then
tmp = x - (a * y)
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.95e-19) {
tmp = x - a;
} else if (z <= 0.225) {
tmp = x - (a * y);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.95e-19: tmp = x - a elif z <= 0.225: tmp = x - (a * y) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.95e-19) tmp = Float64(x - a); elseif (z <= 0.225) tmp = Float64(x - Float64(a * y)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.95e-19) tmp = x - a; elseif (z <= 0.225) tmp = x - (a * y); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.95e-19], N[(x - a), $MachinePrecision], If[LessEqual[z, 0.225], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{-19}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 0.225:\\
\;\;\;\;x - a \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.94999999999999998e-19 or 0.225000000000000006 < z Initial program 95.3%
Taylor expanded in z around inf
Applied rewrites75.4%
if -1.94999999999999998e-19 < z < 0.225000000000000006Initial program 99.2%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6474.5
Applied rewrites74.5%
Taylor expanded in z around 0
lower-*.f6471.9
Applied rewrites71.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.65e-14) (- x a) (if (<= z 8e-11) x (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.65e-14) {
tmp = x - a;
} else if (z <= 8e-11) {
tmp = x;
} else {
tmp = x - a;
}
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(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-2.65d-14)) then
tmp = x - a
else if (z <= 8d-11) then
tmp = x
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.65e-14) {
tmp = x - a;
} else if (z <= 8e-11) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.65e-14: tmp = x - a elif z <= 8e-11: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.65e-14) tmp = Float64(x - a); elseif (z <= 8e-11) tmp = x; else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.65e-14) tmp = x - a; elseif (z <= 8e-11) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.65e-14], N[(x - a), $MachinePrecision], If[LessEqual[z, 8e-11], x, N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{-14}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-11}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.6500000000000001e-14 or 7.99999999999999952e-11 < z Initial program 95.3%
Taylor expanded in z around inf
Applied rewrites75.2%
if -2.6500000000000001e-14 < z < 7.99999999999999952e-11Initial program 99.2%
Taylor expanded in x around inf
Applied rewrites57.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- y z) (/ (+ (- t z) 1.0) a)))) (if (<= t_1 -6.2e+95) (* -1.0 a) (if (<= t_1 1e+95) x (* -1.0 a)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - z) / (((t - z) + 1.0) / a);
double tmp;
if (t_1 <= -6.2e+95) {
tmp = -1.0 * a;
} else if (t_1 <= 1e+95) {
tmp = x;
} else {
tmp = -1.0 * a;
}
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(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (y - z) / (((t - z) + 1.0d0) / a)
if (t_1 <= (-6.2d+95)) then
tmp = (-1.0d0) * a
else if (t_1 <= 1d+95) then
tmp = x
else
tmp = (-1.0d0) * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y - z) / (((t - z) + 1.0) / a);
double tmp;
if (t_1 <= -6.2e+95) {
tmp = -1.0 * a;
} else if (t_1 <= 1e+95) {
tmp = x;
} else {
tmp = -1.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - z) / (((t - z) + 1.0) / a) tmp = 0 if t_1 <= -6.2e+95: tmp = -1.0 * a elif t_1 <= 1e+95: tmp = x else: tmp = -1.0 * a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a)) tmp = 0.0 if (t_1 <= -6.2e+95) tmp = Float64(-1.0 * a); elseif (t_1 <= 1e+95) tmp = x; else tmp = Float64(-1.0 * a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - z) / (((t - z) + 1.0) / a); tmp = 0.0; if (t_1 <= -6.2e+95) tmp = -1.0 * a; elseif (t_1 <= 1e+95) tmp = x; else tmp = -1.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -6.2e+95], N[(-1.0 * a), $MachinePrecision], If[LessEqual[t$95$1, 1e+95], x, N[(-1.0 * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}\\
\mathbf{if}\;t\_1 \leq -6.2 \cdot 10^{+95}:\\
\;\;\;\;-1 \cdot a\\
\mathbf{elif}\;t\_1 \leq 10^{+95}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot a\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -6.2000000000000006e95 or 1.00000000000000002e95 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 99.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
lower-+.f6483.6
Applied rewrites83.6%
Taylor expanded in z around inf
Applied rewrites27.2%
if -6.2000000000000006e95 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < 1.00000000000000002e95Initial program 96.0%
Taylor expanded in x around inf
Applied rewrites71.3%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
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(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 97.2%
Taylor expanded in x around inf
Applied rewrites54.0%
herbie shell --seed 2025101
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))