
(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 11 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 (fma (/ (- z y) (- t (- z 1.0))) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((z - y) / (t - (z - 1.0))), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(z - y) / Float64(t - Float64(z - 1.0))), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - y), $MachinePrecision] / N[(t - N[(z - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z - y}{t - \left(z - 1\right)}, a, x\right)
\end{array}
Initial program 97.1%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.6
Applied rewrites99.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (/ (- z) (/ (+ (- t z) 1.0) a)))))
(if (<= z -2e+189)
(- x a)
(if (<= z -3.8e+27)
t_1
(if (<= z 6.4e-18) (fma (/ (- z y) (- t -1.0)) a x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (-z / (((t - z) + 1.0) / a));
double tmp;
if (z <= -2e+189) {
tmp = x - a;
} else if (z <= -3.8e+27) {
tmp = t_1;
} else if (z <= 6.4e-18) {
tmp = fma(((z - y) / (t - -1.0)), a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x - Float64(Float64(-z) / Float64(Float64(Float64(t - z) + 1.0) / a))) tmp = 0.0 if (z <= -2e+189) tmp = Float64(x - a); elseif (z <= -3.8e+27) tmp = t_1; elseif (z <= 6.4e-18) tmp = fma(Float64(Float64(z - y) / Float64(t - -1.0)), a, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[((-z) / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2e+189], N[(x - a), $MachinePrecision], If[LessEqual[z, -3.8e+27], t$95$1, If[LessEqual[z, 6.4e-18], N[(N[(N[(z - y), $MachinePrecision] / N[(t - -1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{-z}{\frac{\left(t - z\right) + 1}{a}}\\
\mathbf{if}\;z \leq -2 \cdot 10^{+189}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -3.8 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{-18}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{t - -1}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2e189Initial program 97.1%
Taylor expanded in z around inf
Applied rewrites59.8%
if -2e189 < z < -3.80000000000000022e27 or 6.3999999999999998e-18 < z Initial program 97.1%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6471.4
Applied rewrites71.4%
if -3.80000000000000022e27 < z < 6.3999999999999998e-18Initial program 97.1%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.6
Applied rewrites99.6%
Taylor expanded in z around 0
Applied rewrites74.0%
(FPCore (x y z t a)
:precision binary64
(if (<= z -9e+92)
(- x a)
(if (<= z 1e+29)
(fma (/ (- z y) (- t -1.0)) a x)
(- x (/ (- y z) (/ (- z) a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9e+92) {
tmp = x - a;
} else if (z <= 1e+29) {
tmp = fma(((z - y) / (t - -1.0)), a, x);
} else {
tmp = x - ((y - z) / (-z / a));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9e+92) tmp = Float64(x - a); elseif (z <= 1e+29) tmp = fma(Float64(Float64(z - y) / Float64(t - -1.0)), a, x); else tmp = Float64(x - Float64(Float64(y - z) / Float64(Float64(-z) / a))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9e+92], N[(x - a), $MachinePrecision], If[LessEqual[z, 1e+29], N[(N[(N[(z - y), $MachinePrecision] / N[(t - -1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - N[(N[(y - z), $MachinePrecision] / N[((-z) / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+92}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{t - -1}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y - z}{\frac{-z}{a}}\\
\end{array}
\end{array}
if z < -8.9999999999999998e92Initial program 97.1%
Taylor expanded in z around inf
Applied rewrites59.8%
if -8.9999999999999998e92 < z < 9.99999999999999914e28Initial program 97.1%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.6
Applied rewrites99.6%
Taylor expanded in z around 0
Applied rewrites74.0%
if 9.99999999999999914e28 < z Initial program 97.1%
Taylor expanded in z around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6457.2
Applied rewrites57.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -8e+27)
(- x a)
(if (<= z 230.0)
(fma (/ (- y) (+ 1.0 t)) a x)
(- x (/ (- y z) (/ (- z) a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8e+27) {
tmp = x - a;
} else if (z <= 230.0) {
tmp = fma((-y / (1.0 + t)), a, x);
} else {
tmp = x - ((y - z) / (-z / a));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8e+27) tmp = Float64(x - a); elseif (z <= 230.0) tmp = fma(Float64(Float64(-y) / Float64(1.0 + t)), a, x); else tmp = Float64(x - Float64(Float64(y - z) / Float64(Float64(-z) / a))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8e+27], N[(x - a), $MachinePrecision], If[LessEqual[z, 230.0], N[(N[((-y) / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - N[(N[(y - z), $MachinePrecision] / N[((-z) / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+27}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 230:\\
\;\;\;\;\mathsf{fma}\left(\frac{-y}{1 + t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y - z}{\frac{-z}{a}}\\
\end{array}
\end{array}
if z < -8.0000000000000001e27Initial program 97.1%
Taylor expanded in z around inf
Applied rewrites59.8%
if -8.0000000000000001e27 < z < 230Initial program 97.1%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.6
Applied rewrites99.6%
Taylor expanded in z around 0
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-+.f6472.6
Applied rewrites72.6%
if 230 < z Initial program 97.1%
Taylor expanded in z around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6457.2
Applied rewrites57.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -8e+27) (- x a) (if (<= z 1.12e+29) (fma (/ (- y) (+ 1.0 t)) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8e+27) {
tmp = x - a;
} else if (z <= 1.12e+29) {
tmp = fma((-y / (1.0 + t)), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8e+27) tmp = Float64(x - a); elseif (z <= 1.12e+29) tmp = fma(Float64(Float64(-y) / Float64(1.0 + t)), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8e+27], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.12e+29], N[(N[((-y) / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+27}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-y}{1 + t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -8.0000000000000001e27 or 1.1200000000000001e29 < z Initial program 97.1%
Taylor expanded in z around inf
Applied rewrites59.8%
if -8.0000000000000001e27 < z < 1.1200000000000001e29Initial program 97.1%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.6
Applied rewrites99.6%
Taylor expanded in z around 0
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-+.f6472.6
Applied rewrites72.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -8e+27) (- x a) (if (<= z 1.12e+29) (- x (* a (/ y (+ 1.0 t)))) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8e+27) {
tmp = x - a;
} else if (z <= 1.12e+29) {
tmp = x - (a * (y / (1.0 + t)));
} 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 <= (-8d+27)) then
tmp = x - a
else if (z <= 1.12d+29) then
tmp = x - (a * (y / (1.0d0 + t)))
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 <= -8e+27) {
tmp = x - a;
} else if (z <= 1.12e+29) {
tmp = x - (a * (y / (1.0 + t)));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -8e+27: tmp = x - a elif z <= 1.12e+29: tmp = x - (a * (y / (1.0 + t))) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8e+27) tmp = Float64(x - a); elseif (z <= 1.12e+29) tmp = Float64(x - Float64(a * Float64(y / Float64(1.0 + t)))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -8e+27) tmp = x - a; elseif (z <= 1.12e+29) tmp = x - (a * (y / (1.0 + t))); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8e+27], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.12e+29], N[(x - N[(a * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+27}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+29}:\\
\;\;\;\;x - a \cdot \frac{y}{1 + t}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -8.0000000000000001e27 or 1.1200000000000001e29 < z Initial program 97.1%
Taylor expanded in z around inf
Applied rewrites59.8%
if -8.0000000000000001e27 < z < 1.1200000000000001e29Initial program 97.1%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6472.6
Applied rewrites72.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) t) a x)))
(if (<= t -2.45)
t_1
(if (<= t -1.1e-266) (- x (* a y)) (if (<= t 4.4e-30) (- x a) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / t), a, x);
double tmp;
if (t <= -2.45) {
tmp = t_1;
} else if (t <= -1.1e-266) {
tmp = x - (a * y);
} else if (t <= 4.4e-30) {
tmp = x - a;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / t), a, x) tmp = 0.0 if (t <= -2.45) tmp = t_1; elseif (t <= -1.1e-266) tmp = Float64(x - Float64(a * y)); elseif (t <= 4.4e-30) tmp = Float64(x - a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[t, -2.45], t$95$1, If[LessEqual[t, -1.1e-266], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.4e-30], N[(x - a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\mathbf{if}\;t \leq -2.45:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.1 \cdot 10^{-266}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{elif}\;t \leq 4.4 \cdot 10^{-30}:\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.4500000000000002 or 4.39999999999999967e-30 < t Initial program 97.1%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.6
Applied rewrites99.6%
Taylor expanded in t around inf
lower-/.f64N/A
lift--.f6453.9
Applied rewrites53.9%
if -2.4500000000000002 < t < -1.1e-266Initial program 97.1%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6472.6
Applied rewrites72.6%
Taylor expanded in t around 0
lower-*.f6457.2
Applied rewrites57.2%
if -1.1e-266 < t < 4.39999999999999967e-30Initial program 97.1%
Taylor expanded in z around inf
Applied rewrites59.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.35e+26) (- x a) (if (<= z 12.5) (- x (* a y)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.35e+26) {
tmp = x - a;
} else if (z <= 12.5) {
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.35d+26)) then
tmp = x - a
else if (z <= 12.5d0) 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.35e+26) {
tmp = x - a;
} else if (z <= 12.5) {
tmp = x - (a * y);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.35e+26: tmp = x - a elif z <= 12.5: tmp = x - (a * y) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.35e+26) tmp = Float64(x - a); elseif (z <= 12.5) 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.35e+26) tmp = x - a; elseif (z <= 12.5) tmp = x - (a * y); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.35e+26], N[(x - a), $MachinePrecision], If[LessEqual[z, 12.5], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+26}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 12.5:\\
\;\;\;\;x - a \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.35e26 or 12.5 < z Initial program 97.1%
Taylor expanded in z around inf
Applied rewrites59.8%
if -1.35e26 < z < 12.5Initial program 97.1%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6472.6
Applied rewrites72.6%
Taylor expanded in t around 0
lower-*.f6457.2
Applied rewrites57.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -7.2e-76) (- x a) (if (<= z 11.6) (* x 1.0) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.2e-76) {
tmp = x - a;
} else if (z <= 11.6) {
tmp = x * 1.0;
} 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 <= (-7.2d-76)) then
tmp = x - a
else if (z <= 11.6d0) then
tmp = x * 1.0d0
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 <= -7.2e-76) {
tmp = x - a;
} else if (z <= 11.6) {
tmp = x * 1.0;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7.2e-76: tmp = x - a elif z <= 11.6: tmp = x * 1.0 else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.2e-76) tmp = Float64(x - a); elseif (z <= 11.6) tmp = Float64(x * 1.0); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -7.2e-76) tmp = x - a; elseif (z <= 11.6) tmp = x * 1.0; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.2e-76], N[(x - a), $MachinePrecision], If[LessEqual[z, 11.6], N[(x * 1.0), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-76}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 11.6:\\
\;\;\;\;x \cdot 1\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -7.2000000000000001e-76 or 11.5999999999999996 < z Initial program 97.1%
Taylor expanded in z around inf
Applied rewrites59.8%
if -7.2000000000000001e-76 < z < 11.5999999999999996Initial program 97.1%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.6
Applied rewrites99.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lift-+.f6480.4
Applied rewrites80.4%
Taylor expanded in x around inf
Applied rewrites53.0%
(FPCore (x y z t a) :precision binary64 (- x a))
double code(double x, double y, double z, double t, double a) {
return x - 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 - a
end function
public static double code(double x, double y, double z, double t, double a) {
return x - a;
}
def code(x, y, z, t, a): return x - a
function code(x, y, z, t, a) return Float64(x - a) end
function tmp = code(x, y, z, t, a) tmp = x - a; end
code[x_, y_, z_, t_, a_] := N[(x - a), $MachinePrecision]
\begin{array}{l}
\\
x - a
\end{array}
Initial program 97.1%
Taylor expanded in z around inf
Applied rewrites59.8%
(FPCore (x y z t a) :precision binary64 (- a))
double code(double x, double y, double z, double t, double a) {
return -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 = -a
end function
public static double code(double x, double y, double z, double t, double a) {
return -a;
}
def code(x, y, z, t, a): return -a
function code(x, y, z, t, a) return Float64(-a) end
function tmp = code(x, y, z, t, a) tmp = -a; end
code[x_, y_, z_, t_, a_] := (-a)
\begin{array}{l}
\\
-a
\end{array}
Initial program 97.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6448.3
Applied rewrites48.3%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6417.0
Applied rewrites17.0%
herbie shell --seed 2025142
(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))))