
(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 12 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 (+ (+ y x) t))
(t_2 (+ t (+ x y)))
(t_3 (/ y t_1))
(t_4
(*
(- (+ (/ (+ t y) t_1) (* (/ z a) (/ (+ y x) t_1))) (* (/ b a) t_3))
a)))
(if (<= a -1.6e+24)
t_4
(if (<= a 6e-17)
(-
(*
-1.0
(* z (fma -1.0 (* (/ a z) (/ (+ t y) t_2)) (* -1.0 (/ (+ x y) t_2)))))
(* b t_3))
t_4))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y + x) + t;
double t_2 = t + (x + y);
double t_3 = y / t_1;
double t_4 = ((((t + y) / t_1) + ((z / a) * ((y + x) / t_1))) - ((b / a) * t_3)) * a;
double tmp;
if (a <= -1.6e+24) {
tmp = t_4;
} else if (a <= 6e-17) {
tmp = (-1.0 * (z * fma(-1.0, ((a / z) * ((t + y) / t_2)), (-1.0 * ((x + y) / t_2))))) - (b * t_3);
} else {
tmp = t_4;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y + x) + t) t_2 = Float64(t + Float64(x + y)) t_3 = Float64(y / t_1) t_4 = Float64(Float64(Float64(Float64(Float64(t + y) / t_1) + Float64(Float64(z / a) * Float64(Float64(y + x) / t_1))) - Float64(Float64(b / a) * t_3)) * a) tmp = 0.0 if (a <= -1.6e+24) tmp = t_4; elseif (a <= 6e-17) tmp = Float64(Float64(-1.0 * Float64(z * fma(-1.0, Float64(Float64(a / z) * Float64(Float64(t + y) / t_2)), Float64(-1.0 * Float64(Float64(x + y) / t_2))))) - Float64(b * t_3)); else tmp = t_4; 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[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(y / t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(N[(N[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[(z / a), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(b / a), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -1.6e+24], t$95$4, If[LessEqual[a, 6e-17], N[(N[(-1.0 * N[(z * N[(-1.0 * N[(N[(a / z), $MachinePrecision] * N[(N[(t + y), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision] + N[(-1.0 * N[(N[(x + y), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * t$95$3), $MachinePrecision]), $MachinePrecision], t$95$4]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + x\right) + t\\
t_2 := t + \left(x + y\right)\\
t_3 := \frac{y}{t\_1}\\
t_4 := \left(\left(\frac{t + y}{t\_1} + \frac{z}{a} \cdot \frac{y + x}{t\_1}\right) - \frac{b}{a} \cdot t\_3\right) \cdot a\\
\mathbf{if}\;a \leq -1.6 \cdot 10^{+24}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;a \leq 6 \cdot 10^{-17}:\\
\;\;\;\;-1 \cdot \left(z \cdot \mathsf{fma}\left(-1, \frac{a}{z} \cdot \frac{t + y}{t\_2}, -1 \cdot \frac{x + y}{t\_2}\right)\right) - b \cdot t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}
\end{array}
if a < -1.5999999999999999e24 or 6.00000000000000012e-17 < a Initial program 48.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.0%
if -1.5999999999999999e24 < a < 6.00000000000000012e-17Initial program 71.9%
Applied rewrites78.3%
Taylor expanded in z around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites97.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ y x) t))
(t_2 (/ (+ y x) t_1))
(t_3
(* (- (+ (/ (+ t y) t_1) (* (/ z a) t_2)) (* (/ b a) (/ y t_1))) a)))
(if (<= a -2.4e-49)
t_3
(if (<= a 3.1e-90) (fma t_2 z (/ (fma (+ t y) a (* (- 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 = (y + x) / t_1;
double t_3 = ((((t + y) / t_1) + ((z / a) * t_2)) - ((b / a) * (y / t_1))) * a;
double tmp;
if (a <= -2.4e-49) {
tmp = t_3;
} else if (a <= 3.1e-90) {
tmp = fma(t_2, z, (fma((t + y), a, (-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(y + x) / t_1) t_3 = Float64(Float64(Float64(Float64(Float64(t + y) / t_1) + Float64(Float64(z / a) * t_2)) - Float64(Float64(b / a) * Float64(y / t_1))) * a) tmp = 0.0 if (a <= -2.4e-49) tmp = t_3; elseif (a <= 3.1e-90) tmp = fma(t_2, z, Float64(fma(Float64(t + y), a, Float64(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[(y + x), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[(z / a), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] - N[(N[(b / a), $MachinePrecision] * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -2.4e-49], t$95$3, If[LessEqual[a, 3.1e-90], N[(t$95$2 * z + N[(N[(N[(t + y), $MachinePrecision] * a + 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{y + x}{t\_1}\\
t_3 := \left(\left(\frac{t + y}{t\_1} + \frac{z}{a} \cdot t\_2\right) - \frac{b}{a} \cdot \frac{y}{t\_1}\right) \cdot a\\
\mathbf{if}\;a \leq -2.4 \cdot 10^{-49}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;a \leq 3.1 \cdot 10^{-90}:\\
\;\;\;\;\mathsf{fma}\left(t\_2, z, \frac{\mathsf{fma}\left(t + y, a, \left(-b\right) \cdot y\right)}{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if a < -2.39999999999999992e-49 or 3.1000000000000001e-90 < a Initial program 53.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.1%
if -2.39999999999999992e-49 < a < 3.1000000000000001e-90Initial program 71.9%
Applied rewrites87.4%
(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 (- INFINITY))
t_3
(if (<= t_2 5e+294)
(fma (/ (+ y x) t_1) z (/ (fma (+ t y) a (* (- 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 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= 5e+294) {
tmp = fma(((y + x) / t_1), z, (fma((t + y), a, (-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 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= 5e+294) tmp = fma(Float64(Float64(y + x) / t_1), z, Float64(fma(Float64(t + y), a, Float64(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, (-Infinity)], t$95$3, If[LessEqual[t$95$2, 5e+294], N[(N[(N[(y + x), $MachinePrecision] / t$95$1), $MachinePrecision] * z + N[(N[(N[(t + y), $MachinePrecision] * a + 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 -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+294}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y + x}{t\_1}, z, \frac{\mathsf{fma}\left(t + y, a, \left(-b\right) \cdot y\right)}{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)) < -inf.0 or 4.9999999999999999e294 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 6.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6473.2
Applied rewrites73.2%
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.9999999999999999e294Initial program 99.5%
Applied rewrites99.3%
(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 (- INFINITY))
t_3
(if (<= t_2 5e+294)
(/ (fma (+ y x) z (fma (+ t y) a (* (- b) y))) 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 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= 5e+294) {
tmp = fma((y + x), z, fma((t + y), a, (-b * y))) / 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 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= 5e+294) tmp = Float64(fma(Float64(y + x), z, fma(Float64(t + y), a, Float64(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[(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, (-Infinity)], t$95$3, If[LessEqual[t$95$2, 5e+294], N[(N[(N[(y + x), $MachinePrecision] * z + N[(N[(t + y), $MachinePrecision] * a + N[((-b) * y), $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 -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+294}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y + x, z, \mathsf{fma}\left(t + y, a, \left(-b\right) \cdot y\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.9999999999999999e294 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 6.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6473.2
Applied rewrites73.2%
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.9999999999999999e294Initial program 99.5%
lift--.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate--l+N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-+.f64N/A
mul-1-negN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.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 (- INFINITY))
t_3
(if (<= t_2 1e+228) (/ (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 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= 1e+228) {
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 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= 1e+228) 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, (-Infinity)], t$95$3, If[LessEqual[t$95$2, 1e+228], 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 -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 10^{+228}:\\
\;\;\;\;\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)) < -inf.0 or 9.9999999999999992e227 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 9.5%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6473.1
Applied rewrites73.1%
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.9999999999999992e227Initial program 99.5%
Taylor expanded in b around 0
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f6477.4
Applied rewrites77.4%
(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 -2e+296)
t_3
(if (<= t_2 -1e+60)
(/ (* t_3 y) t_1)
(if (<= t_2 1e-46)
(/ (fma (+ y x) z (* a t)) t_1)
(if (<= t_2 1e+228) (/ (fma (+ t y) a (* (- b) y)) 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 <= -2e+296) {
tmp = t_3;
} else if (t_2 <= -1e+60) {
tmp = (t_3 * y) / t_1;
} else if (t_2 <= 1e-46) {
tmp = fma((y + x), z, (a * t)) / t_1;
} else if (t_2 <= 1e+228) {
tmp = fma((t + y), a, (-b * y)) / 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 <= -2e+296) tmp = t_3; elseif (t_2 <= -1e+60) tmp = Float64(Float64(t_3 * y) / t_1); elseif (t_2 <= 1e-46) tmp = Float64(fma(Float64(y + x), z, Float64(a * t)) / t_1); elseif (t_2 <= 1e+228) tmp = Float64(fma(Float64(t + y), a, Float64(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[(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, -2e+296], t$95$3, If[LessEqual[t$95$2, -1e+60], N[(N[(t$95$3 * y), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 1e-46], N[(N[(N[(y + x), $MachinePrecision] * z + N[(a * t), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 1e+228], N[(N[(N[(t + y), $MachinePrecision] * a + N[((-b) * y), $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 -2 \cdot 10^{+296}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{+60}:\\
\;\;\;\;\frac{t\_3 \cdot y}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 10^{-46}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y + x, z, a \cdot t\right)}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 10^{+228}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t + y, a, \left(-b\right) \cdot y\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.99999999999999996e296 or 9.9999999999999992e227 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 10.1%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6473.2
Applied rewrites73.2%
if -1.99999999999999996e296 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -9.9999999999999995e59Initial program 99.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6457.2
Applied rewrites57.2%
if -9.9999999999999995e59 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.00000000000000002e-46Initial program 99.3%
lift--.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate--l+N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-+.f64N/A
mul-1-negN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6499.3
Applied rewrites99.3%
Taylor expanded in y around 0
lower-*.f6466.9
Applied rewrites66.9%
if 1.00000000000000002e-46 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999992e227Initial program 99.7%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lift-+.f64N/A
mul-1-negN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6461.4
Applied rewrites61.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* z (/ (+ x y) (+ t (+ x y))))))
(if (<= z -7e+122)
t_1
(if (<= z -1.5e-67)
(* (+ (/ y (+ x y)) (/ z a)) a)
(if (<= z 9.5e+37) (- a (* b (/ y (+ (+ y x) t)))) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * ((x + y) / (t + (x + y)));
double tmp;
if (z <= -7e+122) {
tmp = t_1;
} else if (z <= -1.5e-67) {
tmp = ((y / (x + y)) + (z / a)) * a;
} else if (z <= 9.5e+37) {
tmp = a - (b * (y / ((y + x) + t)));
} 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 * ((x + y) / (t + (x + y)))
if (z <= (-7d+122)) then
tmp = t_1
else if (z <= (-1.5d-67)) then
tmp = ((y / (x + y)) + (z / a)) * a
else if (z <= 9.5d+37) then
tmp = a - (b * (y / ((y + x) + t)))
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 * ((x + y) / (t + (x + y)));
double tmp;
if (z <= -7e+122) {
tmp = t_1;
} else if (z <= -1.5e-67) {
tmp = ((y / (x + y)) + (z / a)) * a;
} else if (z <= 9.5e+37) {
tmp = a - (b * (y / ((y + x) + t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = z * ((x + y) / (t + (x + y))) tmp = 0 if z <= -7e+122: tmp = t_1 elif z <= -1.5e-67: tmp = ((y / (x + y)) + (z / a)) * a elif z <= 9.5e+37: tmp = a - (b * (y / ((y + x) + t))) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(z * Float64(Float64(x + y) / Float64(t + Float64(x + y)))) tmp = 0.0 if (z <= -7e+122) tmp = t_1; elseif (z <= -1.5e-67) tmp = Float64(Float64(Float64(y / Float64(x + y)) + Float64(z / a)) * a); elseif (z <= 9.5e+37) tmp = Float64(a - Float64(b * Float64(y / Float64(Float64(y + x) + t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = z * ((x + y) / (t + (x + y))); tmp = 0.0; if (z <= -7e+122) tmp = t_1; elseif (z <= -1.5e-67) tmp = ((y / (x + y)) + (z / a)) * a; elseif (z <= 9.5e+37) tmp = a - (b * (y / ((y + x) + t))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(N[(x + y), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7e+122], t$95$1, If[LessEqual[z, -1.5e-67], N[(N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(z / a), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[z, 9.5e+37], N[(a - N[(b * N[(y / N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{x + y}{t + \left(x + y\right)}\\
\mathbf{if}\;z \leq -7 \cdot 10^{+122}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{-67}:\\
\;\;\;\;\left(\frac{y}{x + y} + \frac{z}{a}\right) \cdot a\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+37}:\\
\;\;\;\;a - b \cdot \frac{y}{\left(y + x\right) + t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.00000000000000028e122 or 9.4999999999999995e37 < z Initial program 42.3%
Applied rewrites44.2%
Taylor expanded in z around inf
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6470.3
Applied rewrites70.3%
if -7.00000000000000028e122 < z < -1.50000000000000016e-67Initial program 64.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.5%
Taylor expanded in t around 0
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-/.f64N/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
lower-+.f6457.8
Applied rewrites57.8%
Taylor expanded in b around 0
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f6451.9
Applied rewrites51.9%
if -1.50000000000000016e-67 < z < 9.4999999999999995e37Initial program 72.6%
Applied rewrites79.1%
Taylor expanded in t around inf
Applied rewrites67.5%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -4.5e+126)
(* (/ (+ t y) (+ t (+ x y))) a)
(if (<= a 3900000.0)
(- z (* b (/ y (+ (+ y x) t))))
(* (+ (/ y (+ x y)) (/ z a)) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -4.5e+126) {
tmp = ((t + y) / (t + (x + y))) * a;
} else if (a <= 3900000.0) {
tmp = z - (b * (y / ((y + x) + t)));
} else {
tmp = ((y / (x + y)) + (z / a)) * 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 <= (-4.5d+126)) then
tmp = ((t + y) / (t + (x + y))) * a
else if (a <= 3900000.0d0) then
tmp = z - (b * (y / ((y + x) + t)))
else
tmp = ((y / (x + y)) + (z / a)) * 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 <= -4.5e+126) {
tmp = ((t + y) / (t + (x + y))) * a;
} else if (a <= 3900000.0) {
tmp = z - (b * (y / ((y + x) + t)));
} else {
tmp = ((y / (x + y)) + (z / a)) * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -4.5e+126: tmp = ((t + y) / (t + (x + y))) * a elif a <= 3900000.0: tmp = z - (b * (y / ((y + x) + t))) else: tmp = ((y / (x + y)) + (z / a)) * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -4.5e+126) tmp = Float64(Float64(Float64(t + y) / Float64(t + Float64(x + y))) * a); elseif (a <= 3900000.0) tmp = Float64(z - Float64(b * Float64(y / Float64(Float64(y + x) + t)))); else tmp = Float64(Float64(Float64(y / Float64(x + y)) + Float64(z / a)) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -4.5e+126) tmp = ((t + y) / (t + (x + y))) * a; elseif (a <= 3900000.0) tmp = z - (b * (y / ((y + x) + t))); else tmp = ((y / (x + y)) + (z / a)) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -4.5e+126], N[(N[(N[(t + y), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[a, 3900000.0], N[(z - N[(b * N[(y / N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(z / a), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.5 \cdot 10^{+126}:\\
\;\;\;\;\frac{t + y}{t + \left(x + y\right)} \cdot a\\
\mathbf{elif}\;a \leq 3900000:\\
\;\;\;\;z - b \cdot \frac{y}{\left(y + x\right) + t}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{y}{x + y} + \frac{z}{a}\right) \cdot a\\
\end{array}
\end{array}
if a < -4.49999999999999974e126Initial program 38.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.9%
Taylor expanded in a around inf
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lower-+.f6471.3
Applied rewrites71.3%
if -4.49999999999999974e126 < a < 3.9e6Initial program 70.7%
Applied rewrites76.9%
Taylor expanded in x around inf
Applied rewrites65.4%
if 3.9e6 < a Initial program 47.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.0%
Taylor expanded in t around 0
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-/.f64N/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
lower-+.f6467.3
Applied rewrites67.3%
Taylor expanded in b around 0
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f6459.7
Applied rewrites59.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 -2e+58)
t_2
(if (<= t_1 2e+185) (/ (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 <= -2e+58) {
tmp = t_2;
} else if (t_1 <= 2e+185) {
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 <= -2e+58) tmp = t_2; elseif (t_1 <= 2e+185) 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, -2e+58], t$95$2, If[LessEqual[t$95$1, 2e+185], 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 -2 \cdot 10^{+58}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+185}:\\
\;\;\;\;\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)) < -1.99999999999999989e58 or 2e185 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 31.8%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6469.7
Applied rewrites69.7%
if -1.99999999999999989e58 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2e185Initial program 99.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6460.8
Applied rewrites60.8%
(FPCore (x y z t a b) :precision binary64 (if (<= t 2.55e+110) (- (+ a z) b) a))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 2.55e+110) {
tmp = (a + z) - b;
} 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 <= 2.55d+110) then
tmp = (a + z) - b
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 <= 2.55e+110) {
tmp = (a + z) - b;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= 2.55e+110: tmp = (a + z) - b else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= 2.55e+110) tmp = Float64(Float64(a + z) - b); else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= 2.55e+110) tmp = (a + z) - b; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 2.55e+110], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.55 \cdot 10^{+110}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < 2.5500000000000001e110Initial program 62.8%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6458.3
Applied rewrites58.3%
if 2.5500000000000001e110 < t Initial program 46.9%
Taylor expanded in t around inf
Applied rewrites48.6%
(FPCore (x y z t a b) :precision binary64 (if (<= t -3.6e+73) a (if (<= t 1.18e+58) z a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -3.6e+73) {
tmp = a;
} else if (t <= 1.18e+58) {
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 <= (-3.6d+73)) then
tmp = a
else if (t <= 1.18d+58) 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 <= -3.6e+73) {
tmp = a;
} else if (t <= 1.18e+58) {
tmp = z;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -3.6e+73: tmp = a elif t <= 1.18e+58: tmp = z else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -3.6e+73) tmp = a; elseif (t <= 1.18e+58) tmp = z; else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -3.6e+73) tmp = a; elseif (t <= 1.18e+58) tmp = z; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -3.6e+73], a, If[LessEqual[t, 1.18e+58], z, a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{+73}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 1.18 \cdot 10^{+58}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < -3.5999999999999999e73 or 1.18000000000000003e58 < t Initial program 50.2%
Taylor expanded in t around inf
Applied rewrites46.3%
if -3.5999999999999999e73 < t < 1.18000000000000003e58Initial program 66.6%
Taylor expanded in x around inf
Applied rewrites42.8%
(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 rewrites31.5%
herbie shell --seed 2025101
(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)))