
(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 14 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 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (fma (/ (+ t y) t_1) a (fma (/ z t_1) x (* (/ (- z b) t_1) y)))))
(if (<= t_2 (- INFINITY))
t_3
(if (<= t_2 5e+224)
(/ (fma (+ t y) a (fma y (- z b) (* 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 = fma(((t + y) / t_1), a, fma((z / t_1), x, (((z - b) / t_1) * y)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= 5e+224) {
tmp = fma((t + y), a, fma(y, (z - b), (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 = fma(Float64(Float64(t + y) / t_1), a, fma(Float64(z / t_1), x, Float64(Float64(Float64(z - b) / t_1) * y))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= 5e+224) tmp = Float64(fma(Float64(t + y), a, fma(y, Float64(z - b), 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[(N[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision] * a + N[(N[(z / t$95$1), $MachinePrecision] * x + N[(N[(N[(z - b), $MachinePrecision] / t$95$1), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, 5e+224], N[(N[(N[(t + y), $MachinePrecision] * a + N[(y * N[(z - b), $MachinePrecision] + 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 := \mathsf{fma}\left(\frac{t + y}{t\_1}, a, \mathsf{fma}\left(\frac{z}{t\_1}, x, \frac{z - b}{t\_1} \cdot y\right)\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+224}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t + y, a, \mathsf{fma}\left(y, z - b, 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)) < -inf.0 or 4.99999999999999964e224 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 60.4%
Applied rewrites72.6%
Applied rewrites93.5%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.99999999999999964e224Initial program 60.4%
Applied rewrites60.6%
(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)))
(if (<= t_2 (- INFINITY))
(fma (/ y t_1) (- z b) a)
(if (<= t_2 2e+268)
(/ (fma (+ t y) a (fma y (- z b) (* z x))) t_1)
(fma (/ z t_1) (+ x y) (- a b))))))
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 tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma((y / t_1), (z - b), a);
} else if (t_2 <= 2e+268) {
tmp = fma((t + y), a, fma(y, (z - b), (z * x))) / t_1;
} else {
tmp = fma((z / t_1), (x + y), (a - b));
}
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) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(Float64(y / t_1), Float64(z - b), a); elseif (t_2 <= 2e+268) tmp = Float64(fma(Float64(t + y), a, fma(y, Float64(z - b), Float64(z * x))) / t_1); else tmp = fma(Float64(z / t_1), Float64(x + y), Float64(a - b)); 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]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(y / t$95$1), $MachinePrecision] * N[(z - b), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[t$95$2, 2e+268], N[(N[(N[(t + y), $MachinePrecision] * a + N[(y * N[(z - b), $MachinePrecision] + N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(z / t$95$1), $MachinePrecision] * N[(x + y), $MachinePrecision] + N[(a - b), $MachinePrecision]), $MachinePrecision]]]]]
\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}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t\_1}, z - b, a\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+268}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t + y, a, \mathsf{fma}\left(y, z - b, z \cdot x\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t\_1}, x + y, a - b\right)\\
\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)) < -inf.0Initial program 60.4%
Applied rewrites72.6%
Applied rewrites69.8%
Taylor expanded in x around 0
Applied rewrites67.4%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.9999999999999999e268Initial program 60.4%
Applied rewrites60.6%
if 1.9999999999999999e268 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 60.4%
Applied rewrites67.1%
Taylor expanded in y around inf
Applied rewrites61.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y)) (t_2 (fma (/ (+ t y) t_1) a (- z b))))
(if (<= x -2e+138)
t_2
(if (<= x 3.4e-52)
(fma (/ y t_1) (- z b) a)
(if (<= x 1e+187) t_2 (+ z (/ (* y (- a b)) (+ x y))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = fma(((t + y) / t_1), a, (z - b));
double tmp;
if (x <= -2e+138) {
tmp = t_2;
} else if (x <= 3.4e-52) {
tmp = fma((y / t_1), (z - b), a);
} else if (x <= 1e+187) {
tmp = t_2;
} else {
tmp = z + ((y * (a - b)) / (x + y));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = fma(Float64(Float64(t + y) / t_1), a, Float64(z - b)) tmp = 0.0 if (x <= -2e+138) tmp = t_2; elseif (x <= 3.4e-52) tmp = fma(Float64(y / t_1), Float64(z - b), a); elseif (x <= 1e+187) tmp = t_2; else tmp = Float64(z + Float64(Float64(y * Float64(a - b)) / Float64(x + y))); 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[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision] * a + N[(z - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2e+138], t$95$2, If[LessEqual[x, 3.4e-52], N[(N[(y / t$95$1), $MachinePrecision] * N[(z - b), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[x, 1e+187], t$95$2, N[(z + N[(N[(y * N[(a - b), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \mathsf{fma}\left(\frac{t + y}{t\_1}, a, z - b\right)\\
\mathbf{if}\;x \leq -2 \cdot 10^{+138}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-52}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t\_1}, z - b, a\right)\\
\mathbf{elif}\;x \leq 10^{+187}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;z + \frac{y \cdot \left(a - b\right)}{x + y}\\
\end{array}
\end{array}
if x < -2.0000000000000001e138 or 3.40000000000000017e-52 < x < 9.99999999999999907e186Initial program 60.4%
Applied rewrites72.6%
Taylor expanded in y around inf
Applied rewrites63.2%
if -2.0000000000000001e138 < x < 3.40000000000000017e-52Initial program 60.4%
Applied rewrites72.6%
Applied rewrites69.8%
Taylor expanded in x around 0
Applied rewrites67.4%
if 9.99999999999999907e186 < x Initial program 60.4%
Applied rewrites67.1%
Taylor expanded in t around 0
Applied rewrites49.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)))
(if (<= t_2 (- INFINITY))
(fma (/ y t_1) (- z b) a)
(if (<= t_2 1e+259)
(fma 1.0 a (/ (fma y (- z b) (* z x)) t_1))
(fma (/ (+ t y) t_1) a (- z b))))))
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 tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma((y / t_1), (z - b), a);
} else if (t_2 <= 1e+259) {
tmp = fma(1.0, a, (fma(y, (z - b), (z * x)) / t_1));
} else {
tmp = fma(((t + y) / t_1), a, (z - b));
}
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) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(Float64(y / t_1), Float64(z - b), a); elseif (t_2 <= 1e+259) tmp = fma(1.0, a, Float64(fma(y, Float64(z - b), Float64(z * x)) / t_1)); else tmp = fma(Float64(Float64(t + y) / t_1), a, Float64(z - b)); 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]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(y / t$95$1), $MachinePrecision] * N[(z - b), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[t$95$2, 1e+259], N[(1.0 * a + N[(N[(y * N[(z - b), $MachinePrecision] + N[(z * x), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision] * a + N[(z - b), $MachinePrecision]), $MachinePrecision]]]]]
\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}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t\_1}, z - b, a\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+259}:\\
\;\;\;\;\mathsf{fma}\left(1, a, \frac{\mathsf{fma}\left(y, z - b, z \cdot x\right)}{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t + y}{t\_1}, a, z - b\right)\\
\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)) < -inf.0Initial program 60.4%
Applied rewrites72.6%
Applied rewrites69.8%
Taylor expanded in x around 0
Applied rewrites67.4%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.999999999999999e258Initial program 60.4%
Applied rewrites72.6%
Taylor expanded in x around 0
Applied rewrites60.2%
if 9.999999999999999e258 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 60.4%
Applied rewrites72.6%
Taylor expanded in y around inf
Applied rewrites63.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)))
(if (<= t_2 -1e+261)
(fma (/ y t_1) (- z b) a)
(if (<= t_2 2e+268)
(/ (fma a (+ t y) (* z (+ x y))) (+ t (+ x y)))
(fma (/ z t_1) (+ x y) (- a b))))))
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 tmp;
if (t_2 <= -1e+261) {
tmp = fma((y / t_1), (z - b), a);
} else if (t_2 <= 2e+268) {
tmp = fma(a, (t + y), (z * (x + y))) / (t + (x + y));
} else {
tmp = fma((z / t_1), (x + y), (a - b));
}
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) tmp = 0.0 if (t_2 <= -1e+261) tmp = fma(Float64(y / t_1), Float64(z - b), a); elseif (t_2 <= 2e+268) tmp = Float64(fma(a, Float64(t + y), Float64(z * Float64(x + y))) / Float64(t + Float64(x + y))); else tmp = fma(Float64(z / t_1), Float64(x + y), Float64(a - b)); 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]}, If[LessEqual[t$95$2, -1e+261], N[(N[(y / t$95$1), $MachinePrecision] * N[(z - b), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[t$95$2, 2e+268], N[(N[(a * N[(t + y), $MachinePrecision] + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / t$95$1), $MachinePrecision] * N[(x + y), $MachinePrecision] + N[(a - b), $MachinePrecision]), $MachinePrecision]]]]]
\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}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+261}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t\_1}, z - b, a\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+268}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t + y, z \cdot \left(x + y\right)\right)}{t + \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t\_1}, x + y, a - b\right)\\
\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)) < -9.9999999999999993e260Initial program 60.4%
Applied rewrites72.6%
Applied rewrites69.8%
Taylor expanded in x around 0
Applied rewrites67.4%
if -9.9999999999999993e260 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.9999999999999999e268Initial program 60.4%
Taylor expanded in b around 0
Applied rewrites47.5%
if 1.9999999999999999e268 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 60.4%
Applied rewrites67.1%
Taylor expanded in y around inf
Applied rewrites61.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ z (/ (* y (- a b)) (+ x y)))))
(if (<= x -7.4e+172)
t_1
(if (<= x 5.2e+186) (fma (/ y (+ (+ x t) y)) (- z b) a) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z + ((y * (a - b)) / (x + y));
double tmp;
if (x <= -7.4e+172) {
tmp = t_1;
} else if (x <= 5.2e+186) {
tmp = fma((y / ((x + t) + y)), (z - b), a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(z + Float64(Float64(y * Float64(a - b)) / Float64(x + y))) tmp = 0.0 if (x <= -7.4e+172) tmp = t_1; elseif (x <= 5.2e+186) tmp = fma(Float64(y / Float64(Float64(x + t) + y)), Float64(z - b), a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z + N[(N[(y * N[(a - b), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.4e+172], t$95$1, If[LessEqual[x, 5.2e+186], N[(N[(y / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] * N[(z - b), $MachinePrecision] + a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z + \frac{y \cdot \left(a - b\right)}{x + y}\\
\mathbf{if}\;x \leq -7.4 \cdot 10^{+172}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+186}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{\left(x + t\right) + y}, z - b, a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -7.39999999999999944e172 or 5.2000000000000001e186 < x Initial program 60.4%
Applied rewrites67.1%
Taylor expanded in t around 0
Applied rewrites49.2%
if -7.39999999999999944e172 < x < 5.2000000000000001e186Initial program 60.4%
Applied rewrites72.6%
Applied rewrites69.8%
Taylor expanded in x around 0
Applied rewrites67.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- z (- b a))))
(if (<= y -1.45e+65)
t_1
(if (<= y -2.6e-124)
(+ z (/ (* y (- a b)) (+ x y)))
(if (<= y 1.75e-78)
(/ (fma a t (* x z)) (+ t x))
(if (<= y 1.3e+103) (+ a (/ (* y (- z b)) (+ t y))) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z - (b - a);
double tmp;
if (y <= -1.45e+65) {
tmp = t_1;
} else if (y <= -2.6e-124) {
tmp = z + ((y * (a - b)) / (x + y));
} else if (y <= 1.75e-78) {
tmp = fma(a, t, (x * z)) / (t + x);
} else if (y <= 1.3e+103) {
tmp = a + ((y * (z - b)) / (t + y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(z - Float64(b - a)) tmp = 0.0 if (y <= -1.45e+65) tmp = t_1; elseif (y <= -2.6e-124) tmp = Float64(z + Float64(Float64(y * Float64(a - b)) / Float64(x + y))); elseif (y <= 1.75e-78) tmp = Float64(fma(a, t, Float64(x * z)) / Float64(t + x)); elseif (y <= 1.3e+103) tmp = Float64(a + Float64(Float64(y * Float64(z - b)) / Float64(t + y))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z - N[(b - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.45e+65], t$95$1, If[LessEqual[y, -2.6e-124], N[(z + N[(N[(y * N[(a - b), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.75e-78], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e+103], N[(a + N[(N[(y * N[(z - b), $MachinePrecision]), $MachinePrecision] / N[(t + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z - \left(b - a\right)\\
\mathbf{if}\;y \leq -1.45 \cdot 10^{+65}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.6 \cdot 10^{-124}:\\
\;\;\;\;z + \frac{y \cdot \left(a - b\right)}{x + y}\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{-78}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+103}:\\
\;\;\;\;a + \frac{y \cdot \left(z - b\right)}{t + y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.45e65 or 1.3000000000000001e103 < y Initial program 60.4%
Taylor expanded in y around inf
Applied rewrites55.1%
Applied rewrites55.1%
if -1.45e65 < y < -2.6e-124Initial program 60.4%
Applied rewrites67.1%
Taylor expanded in t around 0
Applied rewrites49.2%
if -2.6e-124 < y < 1.75e-78Initial program 60.4%
Taylor expanded in y around 0
Applied rewrites40.1%
if 1.75e-78 < y < 1.3000000000000001e103Initial program 60.4%
Applied rewrites72.6%
Taylor expanded in x around 0
Applied rewrites50.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ z (/ (* y (- a b)) (+ x y)))) (t_2 (- z (- b a))))
(if (<= y -1.45e+65)
t_2
(if (<= y -2.6e-124)
t_1
(if (<= y 5.4e-111)
(/ (fma a t (* x z)) (+ t x))
(if (<= y 8e+84) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z + ((y * (a - b)) / (x + y));
double t_2 = z - (b - a);
double tmp;
if (y <= -1.45e+65) {
tmp = t_2;
} else if (y <= -2.6e-124) {
tmp = t_1;
} else if (y <= 5.4e-111) {
tmp = fma(a, t, (x * z)) / (t + x);
} else if (y <= 8e+84) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(z + Float64(Float64(y * Float64(a - b)) / Float64(x + y))) t_2 = Float64(z - Float64(b - a)) tmp = 0.0 if (y <= -1.45e+65) tmp = t_2; elseif (y <= -2.6e-124) tmp = t_1; elseif (y <= 5.4e-111) tmp = Float64(fma(a, t, Float64(x * z)) / Float64(t + x)); elseif (y <= 8e+84) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z + N[(N[(y * N[(a - b), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z - N[(b - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.45e+65], t$95$2, If[LessEqual[y, -2.6e-124], t$95$1, If[LessEqual[y, 5.4e-111], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e+84], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z + \frac{y \cdot \left(a - b\right)}{x + y}\\
t_2 := z - \left(b - a\right)\\
\mathbf{if}\;y \leq -1.45 \cdot 10^{+65}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -2.6 \cdot 10^{-124}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{-111}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+84}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -1.45e65 or 8.00000000000000046e84 < y Initial program 60.4%
Taylor expanded in y around inf
Applied rewrites55.1%
Applied rewrites55.1%
if -1.45e65 < y < -2.6e-124 or 5.39999999999999977e-111 < y < 8.00000000000000046e84Initial program 60.4%
Applied rewrites67.1%
Taylor expanded in t around 0
Applied rewrites49.2%
if -2.6e-124 < y < 5.39999999999999977e-111Initial program 60.4%
Taylor expanded in y around 0
Applied rewrites40.1%
(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 (- z (- b a))))
(if (<= t_1 -5e+218)
t_2
(if (<= t_1 5e+157) (/ (fma a t (* x z)) (+ 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 = z - (b - a);
double tmp;
if (t_1 <= -5e+218) {
tmp = t_2;
} else if (t_1 <= 5e+157) {
tmp = fma(a, t, (x * z)) / (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(z - Float64(b - a)) tmp = 0.0 if (t_1 <= -5e+218) tmp = t_2; elseif (t_1 <= 5e+157) tmp = Float64(fma(a, t, Float64(x * z)) / 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[(z - N[(b - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+218], t$95$2, If[LessEqual[t$95$1, 5e+157], N[(N[(a * t + N[(x * z), $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 := z - \left(b - a\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+218}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+157}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\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)) < -4.99999999999999983e218 or 4.99999999999999976e157 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 60.4%
Taylor expanded in y around inf
Applied rewrites55.1%
Applied rewrites55.1%
if -4.99999999999999983e218 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.99999999999999976e157Initial program 60.4%
Taylor expanded in y around 0
Applied rewrites40.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (- z (- b a)))) (if (<= y -1.5e-71) t_1 (if (<= y 9.6e-119) (* (/ t (+ t x)) a) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z - (b - a);
double tmp;
if (y <= -1.5e-71) {
tmp = t_1;
} else if (y <= 9.6e-119) {
tmp = (t / (t + 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, 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 = z - (b - a)
if (y <= (-1.5d-71)) then
tmp = t_1
else if (y <= 9.6d-119) then
tmp = (t / (t + 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 b) {
double t_1 = z - (b - a);
double tmp;
if (y <= -1.5e-71) {
tmp = t_1;
} else if (y <= 9.6e-119) {
tmp = (t / (t + x)) * a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = z - (b - a) tmp = 0 if y <= -1.5e-71: tmp = t_1 elif y <= 9.6e-119: tmp = (t / (t + x)) * a else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(z - Float64(b - a)) tmp = 0.0 if (y <= -1.5e-71) tmp = t_1; elseif (y <= 9.6e-119) tmp = Float64(Float64(t / Float64(t + x)) * a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = z - (b - a); tmp = 0.0; if (y <= -1.5e-71) tmp = t_1; elseif (y <= 9.6e-119) tmp = (t / (t + x)) * a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z - N[(b - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.5e-71], t$95$1, If[LessEqual[y, 9.6e-119], N[(N[(t / N[(t + x), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z - \left(b - a\right)\\
\mathbf{if}\;y \leq -1.5 \cdot 10^{-71}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 9.6 \cdot 10^{-119}:\\
\;\;\;\;\frac{t}{t + x} \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.5000000000000001e-71 or 9.60000000000000034e-119 < y Initial program 60.4%
Taylor expanded in y around inf
Applied rewrites55.1%
Applied rewrites55.1%
if -1.5000000000000001e-71 < y < 9.60000000000000034e-119Initial program 60.4%
Taylor expanded in a around inf
Applied rewrites25.2%
Applied rewrites40.8%
Taylor expanded in y around 0
Applied rewrites31.9%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.35e+29) a (- z (- b a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.35e+29) {
tmp = a;
} else {
tmp = z - (b - 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 <= (-1.35d+29)) then
tmp = a
else
tmp = z - (b - 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 <= -1.35e+29) {
tmp = a;
} else {
tmp = z - (b - a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.35e+29: tmp = a else: tmp = z - (b - a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.35e+29) tmp = a; else tmp = Float64(z - Float64(b - a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -1.35e+29) tmp = a; else tmp = z - (b - a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.35e+29], a, N[(z - N[(b - a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{+29}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;z - \left(b - a\right)\\
\end{array}
\end{array}
if t < -1.35e29Initial program 60.4%
Taylor expanded in t around inf
Applied rewrites33.2%
if -1.35e29 < t Initial program 60.4%
Taylor expanded in y around inf
Applied rewrites55.1%
Applied rewrites55.1%
(FPCore (x y z t a b) :precision binary64 (if (<= a -3.1e-6) a (if (<= a 1.05e+103) z (- a b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -3.1e-6) {
tmp = a;
} else if (a <= 1.05e+103) {
tmp = z;
} 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 <= (-3.1d-6)) then
tmp = a
else if (a <= 1.05d+103) then
tmp = z
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 <= -3.1e-6) {
tmp = a;
} else if (a <= 1.05e+103) {
tmp = z;
} else {
tmp = a - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -3.1e-6: tmp = a elif a <= 1.05e+103: tmp = z else: tmp = a - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -3.1e-6) tmp = a; elseif (a <= 1.05e+103) tmp = z; else tmp = Float64(a - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -3.1e-6) tmp = a; elseif (a <= 1.05e+103) tmp = z; else tmp = a - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -3.1e-6], a, If[LessEqual[a, 1.05e+103], z, N[(a - b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.1 \cdot 10^{-6}:\\
\;\;\;\;a\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{+103}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;a - b\\
\end{array}
\end{array}
if a < -3.1e-6Initial program 60.4%
Taylor expanded in t around inf
Applied rewrites33.2%
if -3.1e-6 < a < 1.0500000000000001e103Initial program 60.4%
Taylor expanded in x around inf
Applied rewrites31.6%
if 1.0500000000000001e103 < a Initial program 60.4%
Taylor expanded in y around inf
Applied rewrites55.1%
Taylor expanded in z around 0
Applied rewrites37.2%
(FPCore (x y z t a b) :precision binary64 (if (<= a -3.1e-6) a (if (<= a 1.06e+103) z a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -3.1e-6) {
tmp = a;
} else if (a <= 1.06e+103) {
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 (a <= (-3.1d-6)) then
tmp = a
else if (a <= 1.06d+103) 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 (a <= -3.1e-6) {
tmp = a;
} else if (a <= 1.06e+103) {
tmp = z;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -3.1e-6: tmp = a elif a <= 1.06e+103: tmp = z else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -3.1e-6) tmp = a; elseif (a <= 1.06e+103) tmp = z; else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -3.1e-6) tmp = a; elseif (a <= 1.06e+103) tmp = z; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -3.1e-6], a, If[LessEqual[a, 1.06e+103], z, a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.1 \cdot 10^{-6}:\\
\;\;\;\;a\\
\mathbf{elif}\;a \leq 1.06 \cdot 10^{+103}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if a < -3.1e-6 or 1.0599999999999999e103 < a Initial program 60.4%
Taylor expanded in t around inf
Applied rewrites33.2%
if -3.1e-6 < a < 1.0599999999999999e103Initial program 60.4%
Taylor expanded in x around inf
Applied rewrites31.6%
(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.4%
Taylor expanded in t around inf
Applied rewrites33.2%
herbie shell --seed 2025153
(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)))