
(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
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, b)
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), intent (in) :: b
code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b): return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\end{array}
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
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, b)
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), intent (in) :: b
code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b): return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ t (+ x y))) (t_2 (+ (+ y x) t)))
(if (<= a -1.08e+33)
(fma (/ (+ t y) t_2) a z)
(if (<= a 6.1e+184)
(- (fma z (/ (+ x y) t_1) (/ (* a (+ t y)) t_1)) (* b (/ y t_2)))
(* a (/ (+ t y) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t + (x + y);
double t_2 = (y + x) + t;
double tmp;
if (a <= -1.08e+33) {
tmp = fma(((t + y) / t_2), a, z);
} else if (a <= 6.1e+184) {
tmp = fma(z, ((x + y) / t_1), ((a * (t + y)) / t_1)) - (b * (y / t_2));
} else {
tmp = a * ((t + y) / t_1);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(t + Float64(x + y)) t_2 = Float64(Float64(y + x) + t) tmp = 0.0 if (a <= -1.08e+33) tmp = fma(Float64(Float64(t + y) / t_2), a, z); elseif (a <= 6.1e+184) tmp = Float64(fma(z, Float64(Float64(x + y) / t_1), Float64(Float64(a * Float64(t + y)) / t_1)) - Float64(b * Float64(y / t_2))); else tmp = Float64(a * Float64(Float64(t + y) / t_1)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[a, -1.08e+33], N[(N[(N[(t + y), $MachinePrecision] / t$95$2), $MachinePrecision] * a + z), $MachinePrecision], If[LessEqual[a, 6.1e+184], N[(N[(z * N[(N[(x + y), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[(a * N[(t + y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] - N[(b * N[(y / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \left(x + y\right)\\
t_2 := \left(y + x\right) + t\\
\mathbf{if}\;a \leq -1.08 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t + y}{t\_2}, a, z\right)\\
\mathbf{elif}\;a \leq 6.1 \cdot 10^{+184}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{x + y}{t\_1}, \frac{a \cdot \left(t + y\right)}{t\_1}\right) - b \cdot \frac{y}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{t + y}{t\_1}\\
\end{array}
\end{array}
if a < -1.08000000000000005e33Initial program 45.6%
Applied rewrites72.3%
Taylor expanded in x around inf
Applied rewrites82.4%
if -1.08000000000000005e33 < a < 6.10000000000000009e184Initial program 69.6%
Applied rewrites75.2%
Taylor expanded in z around 0
lower-fma.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f6492.2
Applied rewrites92.2%
if 6.10000000000000009e184 < a Initial program 36.5%
Applied rewrites72.9%
Taylor expanded in a around inf
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6476.8
Applied rewrites76.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ y x) t))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(t_3 (- (+ a z) b)))
(if (<= t_2 -1e+236)
t_3
(if (<= t_2 4e+280)
(fma (/ (+ t y) t_1) a (/ (- (* (+ y x) z) (* b y)) t_1))
t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y + x) + t;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double t_3 = (a + z) - b;
double tmp;
if (t_2 <= -1e+236) {
tmp = t_3;
} else if (t_2 <= 4e+280) {
tmp = fma(((t + y) / t_1), a, ((((y + x) * z) - (b * y)) / t_1));
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y + x) + t) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) t_3 = Float64(Float64(a + z) - b) tmp = 0.0 if (t_2 <= -1e+236) tmp = t_3; elseif (t_2 <= 4e+280) tmp = fma(Float64(Float64(t + y) / t_1), a, Float64(Float64(Float64(Float64(y + x) * z) - Float64(b * y)) / t_1)); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+236], t$95$3, If[LessEqual[t$95$2, 4e+280], N[(N[(N[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision] * a + N[(N[(N[(N[(y + x), $MachinePrecision] * z), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + x\right) + t\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_3 := \left(a + z\right) - b\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+236}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+280}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t + y}{t\_1}, a, \frac{\left(y + x\right) \cdot z - b \cdot y}{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -1.00000000000000005e236 or 4.0000000000000001e280 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 10.4%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6473.0
Applied rewrites73.0%
if -1.00000000000000005e236 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.0000000000000001e280Initial program 99.5%
Applied rewrites99.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (- (+ a z) b)))
(if (<= t_2 -1e+236)
t_3
(if (<= t_2 4e+280) (/ (fma a t (fma t_3 y (* z x))) t_1) t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = (a + z) - b;
double tmp;
if (t_2 <= -1e+236) {
tmp = t_3;
} else if (t_2 <= 4e+280) {
tmp = fma(a, t, fma(t_3, y, (z * x))) / t_1;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(Float64(a + z) - b) tmp = 0.0 if (t_2 <= -1e+236) tmp = t_3; elseif (t_2 <= 4e+280) tmp = Float64(fma(a, t, fma(t_3, y, Float64(z * x))) / t_1); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+236], t$95$3, If[LessEqual[t$95$2, 4e+280], N[(N[(a * t + N[(t$95$3 * y + N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \left(a + z\right) - b\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+236}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+280}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, \mathsf{fma}\left(t\_3, y, z \cdot x\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -1.00000000000000005e236 or 4.0000000000000001e280 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 10.4%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6473.0
Applied rewrites73.0%
if -1.00000000000000005e236 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.0000000000000001e280Initial program 99.5%
Taylor expanded in y around 0
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6499.5
Applied rewrites99.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (- (+ a z) b)))
(if (<= t_2 -1e+236)
t_3
(if (<= t_2 1e+176) (/ (fma (+ t y) a (* (+ y x) z)) t_1) t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = (a + z) - b;
double tmp;
if (t_2 <= -1e+236) {
tmp = t_3;
} else if (t_2 <= 1e+176) {
tmp = fma((t + y), a, ((y + x) * z)) / t_1;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(Float64(a + z) - b) tmp = 0.0 if (t_2 <= -1e+236) tmp = t_3; elseif (t_2 <= 1e+176) tmp = Float64(fma(Float64(t + y), a, Float64(Float64(y + x) * z)) / t_1); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+236], t$95$3, If[LessEqual[t$95$2, 1e+176], N[(N[(N[(t + y), $MachinePrecision] * a + N[(N[(y + x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \left(a + z\right) - b\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+236}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 10^{+176}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t + y, a, \left(y + x\right) \cdot z\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -1.00000000000000005e236 or 1e176 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 18.3%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6472.5
Applied rewrites72.5%
if -1.00000000000000005e236 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1e176Initial program 99.5%
Taylor expanded in b around 0
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6477.1
Applied rewrites77.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ y x) t)))
(if (<= t -6.2e+124)
(+ a (* x (/ (- z a) t)))
(if (<= t 8.2e+168) (fma (/ (+ t y) t_1) a z) (- a (* b (/ y t_1)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y + x) + t;
double tmp;
if (t <= -6.2e+124) {
tmp = a + (x * ((z - a) / t));
} else if (t <= 8.2e+168) {
tmp = fma(((t + y) / t_1), a, z);
} else {
tmp = a - (b * (y / t_1));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y + x) + t) tmp = 0.0 if (t <= -6.2e+124) tmp = Float64(a + Float64(x * Float64(Float64(z - a) / t))); elseif (t <= 8.2e+168) tmp = fma(Float64(Float64(t + y) / t_1), a, z); else tmp = Float64(a - Float64(b * Float64(y / t_1))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[t, -6.2e+124], N[(a + N[(x * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.2e+168], N[(N[(N[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision] * a + z), $MachinePrecision], N[(a - N[(b * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + x\right) + t\\
\mathbf{if}\;t \leq -6.2 \cdot 10^{+124}:\\
\;\;\;\;a + x \cdot \frac{z - a}{t}\\
\mathbf{elif}\;t \leq 8.2 \cdot 10^{+168}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t + y}{t\_1}, a, z\right)\\
\mathbf{else}:\\
\;\;\;\;a - b \cdot \frac{y}{t\_1}\\
\end{array}
\end{array}
if t < -6.2000000000000004e124Initial program 45.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6434.7
Applied rewrites34.7%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6461.2
Applied rewrites61.2%
if -6.2000000000000004e124 < t < 8.2000000000000006e168Initial program 65.9%
Applied rewrites72.5%
Taylor expanded in x around inf
Applied rewrites68.0%
if 8.2000000000000006e168 < t Initial program 46.6%
Applied rewrites49.1%
Taylor expanded in t around inf
Applied rewrites69.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(t_2 (- (+ a z) b)))
(if (<= t_1 -5e+79)
t_2
(if (<= t_1 1e+176) (/ (fma a t (* z x)) (+ t x)) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double t_2 = (a + z) - b;
double tmp;
if (t_1 <= -5e+79) {
tmp = t_2;
} else if (t_1 <= 1e+176) {
tmp = fma(a, t, (z * x)) / (t + x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) t_2 = Float64(Float64(a + z) - b) tmp = 0.0 if (t_1 <= -5e+79) tmp = t_2; elseif (t_1 <= 1e+176) tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+79], t$95$2, If[LessEqual[t$95$1, 1e+176], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_2 := \left(a + z\right) - b\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+79}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+176}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -5e79 or 1e176 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 30.8%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6470.0
Applied rewrites70.0%
if -5e79 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1e176Initial program 99.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6460.7
Applied rewrites60.7%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ a (* x (/ (- z a) t))))) (if (<= t -4.4e+131) t_1 (if (<= t 5.2e+137) (- (+ a z) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a + (x * ((z - a) / t));
double tmp;
if (t <= -4.4e+131) {
tmp = t_1;
} else if (t <= 5.2e+137) {
tmp = (a + z) - b;
} 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, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = a + (x * ((z - a) / t))
if (t <= (-4.4d+131)) then
tmp = t_1
else if (t <= 5.2d+137) then
tmp = (a + z) - b
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 b) {
double t_1 = a + (x * ((z - a) / t));
double tmp;
if (t <= -4.4e+131) {
tmp = t_1;
} else if (t <= 5.2e+137) {
tmp = (a + z) - b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a + (x * ((z - a) / t)) tmp = 0 if t <= -4.4e+131: tmp = t_1 elif t <= 5.2e+137: tmp = (a + z) - b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a + Float64(x * Float64(Float64(z - a) / t))) tmp = 0.0 if (t <= -4.4e+131) tmp = t_1; elseif (t <= 5.2e+137) tmp = Float64(Float64(a + z) - b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a + (x * ((z - a) / t)); tmp = 0.0; if (t <= -4.4e+131) tmp = t_1; elseif (t <= 5.2e+137) tmp = (a + z) - b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a + N[(x * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4.4e+131], t$95$1, If[LessEqual[t, 5.2e+137], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a + x \cdot \frac{z - a}{t}\\
\mathbf{if}\;t \leq -4.4 \cdot 10^{+131}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{+137}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.3999999999999998e131 or 5.1999999999999998e137 < t Initial program 46.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6435.6
Applied rewrites35.6%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6463.2
Applied rewrites63.2%
if -4.3999999999999998e131 < t < 5.1999999999999998e137Initial program 66.2%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6460.2
Applied rewrites60.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ a z) b)))
(if (<= y -7.5e-128)
t_1
(if (<= y -3.6e-211) (/ (* x z) (+ t x)) (if (<= y 2.4e-134) a t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + z) - b;
double tmp;
if (y <= -7.5e-128) {
tmp = t_1;
} else if (y <= -3.6e-211) {
tmp = (x * z) / (t + x);
} else if (y <= 2.4e-134) {
tmp = 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, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (a + z) - b
if (y <= (-7.5d-128)) then
tmp = t_1
else if (y <= (-3.6d-211)) then
tmp = (x * z) / (t + x)
else if (y <= 2.4d-134) then
tmp = 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 b) {
double t_1 = (a + z) - b;
double tmp;
if (y <= -7.5e-128) {
tmp = t_1;
} else if (y <= -3.6e-211) {
tmp = (x * z) / (t + x);
} else if (y <= 2.4e-134) {
tmp = a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a + z) - b tmp = 0 if y <= -7.5e-128: tmp = t_1 elif y <= -3.6e-211: tmp = (x * z) / (t + x) elif y <= 2.4e-134: tmp = a else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a + z) - b) tmp = 0.0 if (y <= -7.5e-128) tmp = t_1; elseif (y <= -3.6e-211) tmp = Float64(Float64(x * z) / Float64(t + x)); elseif (y <= 2.4e-134) tmp = a; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a + z) - b; tmp = 0.0; if (y <= -7.5e-128) tmp = t_1; elseif (y <= -3.6e-211) tmp = (x * z) / (t + x); elseif (y <= 2.4e-134) tmp = a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[y, -7.5e-128], t$95$1, If[LessEqual[y, -3.6e-211], N[(N[(x * z), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.4e-134], a, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a + z\right) - b\\
\mathbf{if}\;y \leq -7.5 \cdot 10^{-128}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-211}:\\
\;\;\;\;\frac{x \cdot z}{t + x}\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{-134}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.50000000000000021e-128 or 2.4000000000000001e-134 < y Initial program 53.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6464.2
Applied rewrites64.2%
if -7.50000000000000021e-128 < y < -3.5999999999999999e-211Initial program 77.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6458.0
Applied rewrites58.0%
Taylor expanded in x around inf
lower-*.f6428.9
Applied rewrites28.9%
if -3.5999999999999999e-211 < y < 2.4000000000000001e-134Initial program 76.9%
Taylor expanded in t around inf
Applied rewrites37.7%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (- (+ a z) b))) (if (<= y -8e-128) t_1 (if (<= y -3.6e-211) z (if (<= y 2.4e-134) a t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + z) - b;
double tmp;
if (y <= -8e-128) {
tmp = t_1;
} else if (y <= -3.6e-211) {
tmp = z;
} else if (y <= 2.4e-134) {
tmp = 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, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (a + z) - b
if (y <= (-8d-128)) then
tmp = t_1
else if (y <= (-3.6d-211)) then
tmp = z
else if (y <= 2.4d-134) then
tmp = 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 b) {
double t_1 = (a + z) - b;
double tmp;
if (y <= -8e-128) {
tmp = t_1;
} else if (y <= -3.6e-211) {
tmp = z;
} else if (y <= 2.4e-134) {
tmp = a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a + z) - b tmp = 0 if y <= -8e-128: tmp = t_1 elif y <= -3.6e-211: tmp = z elif y <= 2.4e-134: tmp = a else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a + z) - b) tmp = 0.0 if (y <= -8e-128) tmp = t_1; elseif (y <= -3.6e-211) tmp = z; elseif (y <= 2.4e-134) tmp = a; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a + z) - b; tmp = 0.0; if (y <= -8e-128) tmp = t_1; elseif (y <= -3.6e-211) tmp = z; elseif (y <= 2.4e-134) tmp = a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[y, -8e-128], t$95$1, If[LessEqual[y, -3.6e-211], z, If[LessEqual[y, 2.4e-134], a, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a + z\right) - b\\
\mathbf{if}\;y \leq -8 \cdot 10^{-128}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-211}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{-134}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -8.00000000000000043e-128 or 2.4000000000000001e-134 < y Initial program 53.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6464.2
Applied rewrites64.2%
if -8.00000000000000043e-128 < y < -3.5999999999999999e-211Initial program 77.5%
Taylor expanded in x around inf
Applied rewrites32.0%
if -3.5999999999999999e-211 < y < 2.4000000000000001e-134Initial program 76.9%
Taylor expanded in t around inf
Applied rewrites37.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(t_2 (- (+ a z) b)))
(if (<= t_1 -5e+18)
t_2
(if (<= t_1 5000000.0) (/ (fma a t (* z x)) t) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double t_2 = (a + z) - b;
double tmp;
if (t_1 <= -5e+18) {
tmp = t_2;
} else if (t_1 <= 5000000.0) {
tmp = fma(a, t, (z * x)) / t;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) t_2 = Float64(Float64(a + z) - b) tmp = 0.0 if (t_1 <= -5e+18) tmp = t_2; elseif (t_1 <= 5000000.0) tmp = Float64(fma(a, t, Float64(z * x)) / t); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+18], t$95$2, If[LessEqual[t$95$1, 5000000.0], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_2 := \left(a + z\right) - b\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+18}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -5e18 or 5e6 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 46.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6465.3
Applied rewrites65.3%
if -5e18 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5e6Initial program 99.2%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6463.3
Applied rewrites63.3%
Taylor expanded in x around 0
Applied rewrites34.1%
(FPCore (x y z t a b) :precision binary64 (if (<= b -1.75e+93) (- z b) (+ a z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.75e+93) {
tmp = z - b;
} else {
tmp = a + z;
}
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, b)
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), intent (in) :: b
real(8) :: tmp
if (b <= (-1.75d+93)) then
tmp = z - b
else
tmp = a + z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.75e+93) {
tmp = z - b;
} else {
tmp = a + z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -1.75e+93: tmp = z - b else: tmp = a + z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.75e+93) tmp = Float64(z - b); else tmp = Float64(a + z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -1.75e+93) tmp = z - b; else tmp = a + z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.75e+93], N[(z - b), $MachinePrecision], N[(a + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.75 \cdot 10^{+93}:\\
\;\;\;\;z - b\\
\mathbf{else}:\\
\;\;\;\;a + z\\
\end{array}
\end{array}
if b < -1.74999999999999999e93Initial program 52.1%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6443.5
Applied rewrites43.5%
Taylor expanded in z around inf
Applied rewrites34.0%
if -1.74999999999999999e93 < b Initial program 62.5%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6458.5
Applied rewrites58.5%
Taylor expanded in b around 0
lift-+.f6455.7
Applied rewrites55.7%
(FPCore (x y z t a b) :precision binary64 (if (<= a -450.0) a (if (<= a 2.05e+79) (- z b) (- a b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -450.0) {
tmp = a;
} else if (a <= 2.05e+79) {
tmp = z - b;
} else {
tmp = a - b;
}
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, b)
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), intent (in) :: b
real(8) :: tmp
if (a <= (-450.0d0)) then
tmp = a
else if (a <= 2.05d+79) then
tmp = z - b
else
tmp = a - b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -450.0) {
tmp = a;
} else if (a <= 2.05e+79) {
tmp = z - b;
} else {
tmp = a - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -450.0: tmp = a elif a <= 2.05e+79: tmp = z - b else: tmp = a - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -450.0) tmp = a; elseif (a <= 2.05e+79) tmp = Float64(z - b); else tmp = Float64(a - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -450.0) tmp = a; elseif (a <= 2.05e+79) tmp = z - b; else tmp = a - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -450.0], a, If[LessEqual[a, 2.05e+79], N[(z - b), $MachinePrecision], N[(a - b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -450:\\
\;\;\;\;a\\
\mathbf{elif}\;a \leq 2.05 \cdot 10^{+79}:\\
\;\;\;\;z - b\\
\mathbf{else}:\\
\;\;\;\;a - b\\
\end{array}
\end{array}
if a < -450Initial program 48.3%
Taylor expanded in t around inf
Applied rewrites48.7%
if -450 < a < 2.05e79Initial program 72.1%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6451.7
Applied rewrites51.7%
Taylor expanded in z around inf
Applied rewrites45.8%
if 2.05e79 < a Initial program 43.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
Applied rewrites54.8%
(FPCore (x y z t a b) :precision binary64 (if (<= z -2.25e+63) z (if (<= z 5e-6) (- a b) z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.25e+63) {
tmp = z;
} else if (z <= 5e-6) {
tmp = a - b;
} else {
tmp = z;
}
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, b)
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), intent (in) :: b
real(8) :: tmp
if (z <= (-2.25d+63)) then
tmp = z
else if (z <= 5d-6) then
tmp = a - b
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.25e+63) {
tmp = z;
} else if (z <= 5e-6) {
tmp = a - b;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -2.25e+63: tmp = z elif z <= 5e-6: tmp = a - b else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.25e+63) tmp = z; elseif (z <= 5e-6) tmp = Float64(a - b); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -2.25e+63) tmp = z; elseif (z <= 5e-6) tmp = a - b; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.25e+63], z, If[LessEqual[z, 5e-6], N[(a - b), $MachinePrecision], z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.25 \cdot 10^{+63}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-6}:\\
\;\;\;\;a - b\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -2.25000000000000008e63 or 5.00000000000000041e-6 < z Initial program 47.6%
Taylor expanded in x around inf
Applied rewrites49.2%
if -2.25000000000000008e63 < z < 5.00000000000000041e-6Initial program 71.8%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6452.6
Applied rewrites52.6%
Taylor expanded in z around 0
Applied rewrites47.5%
(FPCore (x y z t a b) :precision binary64 (if (<= t -4.5e-9) a (if (<= t 1.1e-13) z a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -4.5e-9) {
tmp = a;
} else if (t <= 1.1e-13) {
tmp = z;
} else {
tmp = 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, b)
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), intent (in) :: b
real(8) :: tmp
if (t <= (-4.5d-9)) then
tmp = a
else if (t <= 1.1d-13) then
tmp = z
else
tmp = a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -4.5e-9) {
tmp = a;
} else if (t <= 1.1e-13) {
tmp = z;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -4.5e-9: tmp = a elif t <= 1.1e-13: tmp = z else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -4.5e-9) tmp = a; elseif (t <= 1.1e-13) tmp = z; else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -4.5e-9) tmp = a; elseif (t <= 1.1e-13) tmp = z; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -4.5e-9], a, If[LessEqual[t, 1.1e-13], z, a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{-9}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 1.1 \cdot 10^{-13}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < -4.49999999999999976e-9 or 1.09999999999999998e-13 < t Initial program 54.1%
Taylor expanded in t around inf
Applied rewrites45.0%
if -4.49999999999999976e-9 < t < 1.09999999999999998e-13Initial program 67.8%
Taylor expanded in x around inf
Applied rewrites44.7%
(FPCore (x y z t a b) :precision binary64 a)
double code(double x, double y, double z, double t, double a, double b) {
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, b)
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), intent (in) :: b
code = a
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a;
}
def code(x, y, z, t, a, b): return a
function code(x, y, z, t, a, b) return a end
function tmp = code(x, y, z, t, a, b) tmp = a; end
code[x_, y_, z_, t_, a_, b_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 60.7%
Taylor expanded in t around inf
Applied rewrites33.1%
herbie shell --seed 2025120
(FPCore (x y z t a b)
:name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
:precision binary64
(/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))