
(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}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b): return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ t y) x))
(t_2 (+ (+ x t) y))
(t_3 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_2)))
(if (or (<= t_3 (- INFINITY)) (not (<= t_3 2e+304)))
(-
(fma (/ z t_1) (+ y x) (* (+ t y) (/ a t_1)))
(* b (/ y (+ (+ t x) y))))
(/ (fma (- (+ a z) b) y (fma a t (* z x))) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t + y) + x;
double t_2 = (x + t) + y;
double t_3 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_2;
double tmp;
if ((t_3 <= -((double) INFINITY)) || !(t_3 <= 2e+304)) {
tmp = fma((z / t_1), (y + x), ((t + y) * (a / t_1))) - (b * (y / ((t + x) + y)));
} else {
tmp = fma(((a + z) - b), y, fma(a, t, (z * x))) / t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t + y) + x) t_2 = Float64(Float64(x + t) + y) t_3 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_2) tmp = 0.0 if ((t_3 <= Float64(-Inf)) || !(t_3 <= 2e+304)) tmp = Float64(fma(Float64(z / t_1), Float64(y + x), Float64(Float64(t + y) * Float64(a / t_1))) - Float64(b * Float64(y / Float64(Float64(t + x) + y)))); else tmp = Float64(fma(Float64(Float64(a + z) - b), y, fma(a, t, Float64(z * x))) / t_2); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t + y), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$3 = 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$2), $MachinePrecision]}, If[Or[LessEqual[t$95$3, (-Infinity)], N[Not[LessEqual[t$95$3, 2e+304]], $MachinePrecision]], N[(N[(N[(z / t$95$1), $MachinePrecision] * N[(y + x), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * N[(a / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(y / N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision] * y + N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t + y\right) + x\\
t_2 := \left(x + t\right) + y\\
t_3 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_2}\\
\mathbf{if}\;t\_3 \leq -\infty \lor \neg \left(t\_3 \leq 2 \cdot 10^{+304}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t\_1}, y + x, \left(t + y\right) \cdot \frac{a}{t\_1}\right) - b \cdot \frac{y}{\left(t + x\right) + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(a + z\right) - b, y, \mathsf{fma}\left(a, t, z \cdot x\right)\right)}{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)) < -inf.0 or 1.9999999999999999e304 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 5.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
Applied rewrites14.4%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
lift-+.f64N/A
lift-+.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites99.9%
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.9999999999999999e304Initial program 99.6%
Taylor expanded in x around 0
Applied rewrites99.7%
Final simplification99.8%
(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 -5e+250)
t_3
(if (<= t_2 2e-98)
(/ (fma a t (* z x)) (+ t x))
(if (<= t_2 1e-17)
(/ (- (* z x) (* y b)) t_1)
(if (<= t_2 2e+276) (/ (fma a t (* t_3 y)) (+ t y)) 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 <= -5e+250) {
tmp = t_3;
} else if (t_2 <= 2e-98) {
tmp = fma(a, t, (z * x)) / (t + x);
} else if (t_2 <= 1e-17) {
tmp = ((z * x) - (y * b)) / t_1;
} else if (t_2 <= 2e+276) {
tmp = fma(a, t, (t_3 * y)) / (t + y);
} 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 <= -5e+250) tmp = t_3; elseif (t_2 <= 2e-98) tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); elseif (t_2 <= 1e-17) tmp = Float64(Float64(Float64(z * x) - Float64(y * b)) / t_1); elseif (t_2 <= 2e+276) tmp = Float64(fma(a, t, Float64(t_3 * y)) / Float64(t + y)); 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, -5e+250], t$95$3, If[LessEqual[t$95$2, 2e-98], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e-17], N[(N[(N[(z * x), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 2e+276], N[(N[(a * t + N[(t$95$3 * y), $MachinePrecision]), $MachinePrecision] / N[(t + y), $MachinePrecision]), $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 -5 \cdot 10^{+250}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-98}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\mathbf{elif}\;t\_2 \leq 10^{-17}:\\
\;\;\;\;\frac{z \cdot x - y \cdot b}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+276}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, t\_3 \cdot y\right)}{t + y}\\
\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)) < -5.0000000000000002e250 or 2.0000000000000001e276 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 9.8%
Taylor expanded in y around inf
Applied rewrites76.4%
if -5.0000000000000002e250 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.99999999999999988e-98Initial program 99.7%
Taylor expanded in y around 0
Applied rewrites69.3%
if 1.99999999999999988e-98 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.00000000000000007e-17Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites83.2%
if 1.00000000000000007e-17 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e276Initial program 99.6%
Taylor expanded in x around 0
Applied rewrites76.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))
(t_3 (- (+ a z) b)))
(if (<= t_2 -5e+250)
t_3
(if (<= t_2 -5e+68)
(/ (fma (+ t y) a (* (+ y x) z)) t_1)
(if (<= t_2 5e+90) (/ (- (fma a t (* z x)) (* y b)) 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 <= -5e+250) {
tmp = t_3;
} else if (t_2 <= -5e+68) {
tmp = fma((t + y), a, ((y + x) * z)) / t_1;
} else if (t_2 <= 5e+90) {
tmp = (fma(a, t, (z * x)) - (y * b)) / 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 <= -5e+250) tmp = t_3; elseif (t_2 <= -5e+68) tmp = Float64(fma(Float64(t + y), a, Float64(Float64(y + x) * z)) / t_1); elseif (t_2 <= 5e+90) tmp = Float64(Float64(fma(a, t, Float64(z * x)) - Float64(y * b)) / 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, -5e+250], t$95$3, If[LessEqual[t$95$2, -5e+68], N[(N[(N[(t + y), $MachinePrecision] * a + N[(N[(y + x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 5e+90], N[(N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] - N[(y * b), $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 -5 \cdot 10^{+250}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{+68}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t + y, a, \left(y + x\right) \cdot z\right)}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+90}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right) - y \cdot b}{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)) < -5.0000000000000002e250 or 5.0000000000000004e90 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 24.6%
Taylor expanded in y around inf
Applied rewrites74.5%
if -5.0000000000000002e250 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -5.0000000000000004e68Initial program 99.8%
Taylor expanded in b around 0
Applied rewrites88.5%
if -5.0000000000000004e68 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.0000000000000004e90Initial program 99.6%
Taylor expanded in y around 0
Applied rewrites87.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (- (+ a z) b)))
(if (<= t_2 -5e+250)
t_3
(if (<= t_2 1e-96)
(/ (fma a t (* z x)) (+ t x))
(if (<= t_2 5e+90) (/ (- (* a t) (* y b)) 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 <= -5e+250) {
tmp = t_3;
} else if (t_2 <= 1e-96) {
tmp = fma(a, t, (z * x)) / (t + x);
} else if (t_2 <= 5e+90) {
tmp = ((a * t) - (y * b)) / 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 <= -5e+250) tmp = t_3; elseif (t_2 <= 1e-96) tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); elseif (t_2 <= 5e+90) tmp = Float64(Float64(Float64(a * t) - Float64(y * b)) / 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, -5e+250], t$95$3, If[LessEqual[t$95$2, 1e-96], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+90], N[(N[(N[(a * t), $MachinePrecision] - N[(y * b), $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 -5 \cdot 10^{+250}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 10^{-96}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+90}:\\
\;\;\;\;\frac{a \cdot t - y \cdot b}{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)) < -5.0000000000000002e250 or 5.0000000000000004e90 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 24.6%
Taylor expanded in y around inf
Applied rewrites74.5%
if -5.0000000000000002e250 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999991e-97Initial program 99.7%
Taylor expanded in y around 0
Applied rewrites69.7%
if 9.9999999999999991e-97 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.0000000000000004e90Initial program 99.6%
Taylor expanded in t around inf
Applied rewrites68.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 -5e+250)
t_3
(if (<= t_2 5e+67)
(/ (fma a t (* z x)) (+ t x))
(if (<= t_2 1e+199) (/ (* t_3 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 <= -5e+250) {
tmp = t_3;
} else if (t_2 <= 5e+67) {
tmp = fma(a, t, (z * x)) / (t + x);
} else if (t_2 <= 1e+199) {
tmp = (t_3 * 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 <= -5e+250) tmp = t_3; elseif (t_2 <= 5e+67) tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); elseif (t_2 <= 1e+199) tmp = Float64(Float64(t_3 * 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, -5e+250], t$95$3, If[LessEqual[t$95$2, 5e+67], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+199], N[(N[(t$95$3 * y), $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 -5 \cdot 10^{+250}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+67}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\mathbf{elif}\;t\_2 \leq 10^{+199}:\\
\;\;\;\;\frac{t\_3 \cdot y}{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)) < -5.0000000000000002e250 or 1.0000000000000001e199 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 16.8%
Taylor expanded in y around inf
Applied rewrites76.5%
if -5.0000000000000002e250 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.99999999999999976e67Initial program 99.7%
Taylor expanded in y around 0
Applied rewrites66.6%
if 4.99999999999999976e67 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.0000000000000001e199Initial program 99.5%
Taylor expanded in y around inf
Applied rewrites74.0%
(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 (or (<= t_2 -5e+250) (not (<= t_2 2e+276)))
t_3
(/ (fma t_3 y (fma a t (* z x))) t_1))))
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 <= -5e+250) || !(t_2 <= 2e+276)) {
tmp = t_3;
} else {
tmp = fma(t_3, y, fma(a, t, (z * x))) / t_1;
}
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 <= -5e+250) || !(t_2 <= 2e+276)) tmp = t_3; else tmp = Float64(fma(t_3, y, fma(a, t, Float64(z * x))) / t_1); 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[Or[LessEqual[t$95$2, -5e+250], N[Not[LessEqual[t$95$2, 2e+276]], $MachinePrecision]], t$95$3, N[(N[(t$95$3 * y + N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $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}\\
t_3 := \left(a + z\right) - b\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+250} \lor \neg \left(t\_2 \leq 2 \cdot 10^{+276}\right):\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_3, y, \mathsf{fma}\left(a, t, z \cdot x\right)\right)}{t\_1}\\
\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)) < -5.0000000000000002e250 or 2.0000000000000001e276 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 9.8%
Taylor expanded in y around inf
Applied rewrites76.4%
if -5.0000000000000002e250 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e276Initial program 99.6%
Taylor expanded in x around 0
Applied rewrites99.7%
Final simplification89.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ a z) b))
(t_2 (+ (+ x t) y))
(t_3 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_2)))
(if (<= t_3 -5e+250)
(- (fma y (/ z (+ y t)) a) (* b (/ y (+ y t))))
(if (<= t_3 2e+276) (/ (fma t_1 y (fma a t (* z x))) t_2) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + z) - b;
double t_2 = (x + t) + y;
double t_3 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_2;
double tmp;
if (t_3 <= -5e+250) {
tmp = fma(y, (z / (y + t)), a) - (b * (y / (y + t)));
} else if (t_3 <= 2e+276) {
tmp = fma(t_1, y, fma(a, t, (z * x))) / t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a + z) - b) t_2 = Float64(Float64(x + t) + y) t_3 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_2) tmp = 0.0 if (t_3 <= -5e+250) tmp = Float64(fma(y, Float64(z / Float64(y + t)), a) - Float64(b * Float64(y / Float64(y + t)))); elseif (t_3 <= 2e+276) tmp = Float64(fma(t_1, y, fma(a, t, Float64(z * x))) / t_2); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$3 = 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$2), $MachinePrecision]}, If[LessEqual[t$95$3, -5e+250], N[(N[(y * N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision] - N[(b * N[(y / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e+276], N[(N[(t$95$1 * y + N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a + z\right) - b\\
t_2 := \left(x + t\right) + y\\
t_3 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_2}\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{+250}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{y + t}, a\right) - b \cdot \frac{y}{y + t}\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+276}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1, y, \mathsf{fma}\left(a, t, z \cdot x\right)\right)}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\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)) < -5.0000000000000002e250Initial program 12.6%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
Applied rewrites21.3%
Taylor expanded in x around inf
Applied rewrites49.3%
Taylor expanded in x around 0
Applied rewrites74.9%
if -5.0000000000000002e250 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e276Initial program 99.6%
Taylor expanded in x around 0
Applied rewrites99.7%
if 2.0000000000000001e276 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 7.9%
Taylor expanded in y around inf
Applied rewrites79.8%
Final simplification90.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)))
(if (or (<= t_2 -5e+250) (not (<= t_2 2e+276)))
(- (+ a z) b)
(/ (fma (+ t y) a (* (+ y x) z)) t_1))))
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 <= -5e+250) || !(t_2 <= 2e+276)) {
tmp = (a + z) - b;
} else {
tmp = fma((t + y), a, ((y + x) * z)) / t_1;
}
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 <= -5e+250) || !(t_2 <= 2e+276)) tmp = Float64(Float64(a + z) - b); else tmp = Float64(fma(Float64(t + y), a, Float64(Float64(y + x) * z)) / t_1); 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[Or[LessEqual[t$95$2, -5e+250], N[Not[LessEqual[t$95$2, 2e+276]], $MachinePrecision]], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], N[(N[(N[(t + y), $MachinePrecision] * a + N[(N[(y + x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $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 -5 \cdot 10^{+250} \lor \neg \left(t\_2 \leq 2 \cdot 10^{+276}\right):\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t + y, a, \left(y + x\right) \cdot z\right)}{t\_1}\\
\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)) < -5.0000000000000002e250 or 2.0000000000000001e276 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 9.8%
Taylor expanded in y around inf
Applied rewrites76.4%
if -5.0000000000000002e250 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e276Initial program 99.6%
Taylor expanded in b around 0
Applied rewrites78.2%
Final simplification77.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y))))
(if (or (<= t_1 -5e+250) (not (<= t_1 5e+90)))
(- (+ a z) b)
(/ (fma a t (* z x)) (+ t x)))))
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 tmp;
if ((t_1 <= -5e+250) || !(t_1 <= 5e+90)) {
tmp = (a + z) - b;
} else {
tmp = fma(a, t, (z * x)) / (t + x);
}
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)) tmp = 0.0 if ((t_1 <= -5e+250) || !(t_1 <= 5e+90)) tmp = Float64(Float64(a + z) - b); else tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); 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]}, If[Or[LessEqual[t$95$1, -5e+250], N[Not[LessEqual[t$95$1, 5e+90]], $MachinePrecision]], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision]]]
\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}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+250} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+90}\right):\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\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)) < -5.0000000000000002e250 or 5.0000000000000004e90 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 24.6%
Taylor expanded in y around inf
Applied rewrites74.5%
if -5.0000000000000002e250 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.0000000000000004e90Initial program 99.7%
Taylor expanded in y around 0
Applied rewrites65.1%
Final simplification69.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (/ (+ t y) (+ t (+ x y))))))
(if (<= a -5.5e+43)
t_1
(if (<= a 0.00023)
(- z (* b (/ y (+ x y))))
(if (<= a 1.72e+146) (- (+ a z) b) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * ((t + y) / (t + (x + y)));
double tmp;
if (a <= -5.5e+43) {
tmp = t_1;
} else if (a <= 0.00023) {
tmp = z - (b * (y / (x + y)));
} else if (a <= 1.72e+146) {
tmp = (a + z) - b;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = a * ((t + y) / (t + (x + y)))
if (a <= (-5.5d+43)) then
tmp = t_1
else if (a <= 0.00023d0) then
tmp = z - (b * (y / (x + y)))
else if (a <= 1.72d+146) then
tmp = (a + z) - b
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * ((t + y) / (t + (x + y)));
double tmp;
if (a <= -5.5e+43) {
tmp = t_1;
} else if (a <= 0.00023) {
tmp = z - (b * (y / (x + y)));
} else if (a <= 1.72e+146) {
tmp = (a + z) - b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a * ((t + y) / (t + (x + y))) tmp = 0 if a <= -5.5e+43: tmp = t_1 elif a <= 0.00023: tmp = z - (b * (y / (x + y))) elif a <= 1.72e+146: tmp = (a + z) - b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(Float64(t + y) / Float64(t + Float64(x + y)))) tmp = 0.0 if (a <= -5.5e+43) tmp = t_1; elseif (a <= 0.00023) tmp = Float64(z - Float64(b * Float64(y / Float64(x + y)))); elseif (a <= 1.72e+146) tmp = Float64(Float64(a + z) - b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a * ((t + y) / (t + (x + y))); tmp = 0.0; if (a <= -5.5e+43) tmp = t_1; elseif (a <= 0.00023) tmp = z - (b * (y / (x + y))); elseif (a <= 1.72e+146) tmp = (a + z) - b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(N[(t + y), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -5.5e+43], t$95$1, If[LessEqual[a, 0.00023], N[(z - N[(b * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.72e+146], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \frac{t + y}{t + \left(x + y\right)}\\
\mathbf{if}\;a \leq -5.5 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 0.00023:\\
\;\;\;\;z - b \cdot \frac{y}{x + y}\\
\mathbf{elif}\;a \leq 1.72 \cdot 10^{+146}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -5.49999999999999989e43 or 1.71999999999999999e146 < a Initial program 46.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
Applied rewrites47.0%
Taylor expanded in a around inf
Applied rewrites74.8%
if -5.49999999999999989e43 < a < 2.3000000000000001e-4Initial program 72.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
Applied rewrites74.3%
Taylor expanded in x around inf
Applied rewrites66.2%
Taylor expanded in x around inf
Applied rewrites59.6%
if 2.3000000000000001e-4 < a < 1.71999999999999999e146Initial program 60.4%
Taylor expanded in y around inf
Applied rewrites64.4%
Final simplification65.3%
(FPCore (x y z t a b)
:precision binary64
(if (<= x -3.2e+77)
(- z (* y (/ b x)))
(if (<= x -2.3e+40)
(* a (/ t (+ t x)))
(if (<= x 5.5e+31) (- (+ a z) b) (- z (* b (/ y (+ x y))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -3.2e+77) {
tmp = z - (y * (b / x));
} else if (x <= -2.3e+40) {
tmp = a * (t / (t + x));
} else if (x <= 5.5e+31) {
tmp = (a + z) - b;
} else {
tmp = z - (b * (y / (x + y)));
}
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 (x <= (-3.2d+77)) then
tmp = z - (y * (b / x))
else if (x <= (-2.3d+40)) then
tmp = a * (t / (t + x))
else if (x <= 5.5d+31) then
tmp = (a + z) - b
else
tmp = z - (b * (y / (x + y)))
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 (x <= -3.2e+77) {
tmp = z - (y * (b / x));
} else if (x <= -2.3e+40) {
tmp = a * (t / (t + x));
} else if (x <= 5.5e+31) {
tmp = (a + z) - b;
} else {
tmp = z - (b * (y / (x + y)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -3.2e+77: tmp = z - (y * (b / x)) elif x <= -2.3e+40: tmp = a * (t / (t + x)) elif x <= 5.5e+31: tmp = (a + z) - b else: tmp = z - (b * (y / (x + y))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -3.2e+77) tmp = Float64(z - Float64(y * Float64(b / x))); elseif (x <= -2.3e+40) tmp = Float64(a * Float64(t / Float64(t + x))); elseif (x <= 5.5e+31) tmp = Float64(Float64(a + z) - b); else tmp = Float64(z - Float64(b * Float64(y / Float64(x + y)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -3.2e+77) tmp = z - (y * (b / x)); elseif (x <= -2.3e+40) tmp = a * (t / (t + x)); elseif (x <= 5.5e+31) tmp = (a + z) - b; else tmp = z - (b * (y / (x + y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -3.2e+77], N[(z - N[(y * N[(b / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.3e+40], N[(a * N[(t / N[(t + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.5e+31], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], N[(z - N[(b * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{+77}:\\
\;\;\;\;z - y \cdot \frac{b}{x}\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{+40}:\\
\;\;\;\;a \cdot \frac{t}{t + x}\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+31}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;z - b \cdot \frac{y}{x + y}\\
\end{array}
\end{array}
if x < -3.2000000000000002e77Initial program 48.0%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
Applied rewrites44.8%
Taylor expanded in x around inf
Applied rewrites69.8%
Taylor expanded in x around inf
Applied rewrites66.8%
Applied rewrites71.2%
if -3.2000000000000002e77 < x < -2.29999999999999994e40Initial program 57.6%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
Applied rewrites57.6%
Taylor expanded in a around inf
Applied rewrites76.6%
Taylor expanded in y around 0
Applied rewrites76.6%
if -2.29999999999999994e40 < x < 5.50000000000000002e31Initial program 66.4%
Taylor expanded in y around inf
Applied rewrites59.2%
if 5.50000000000000002e31 < x Initial program 61.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
Applied rewrites65.3%
Taylor expanded in x around inf
Applied rewrites68.2%
Taylor expanded in x around inf
Applied rewrites68.0%
Final simplification63.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.9e+155) (not (<= t 2.3e+171))) (* a (/ t (+ t x))) (- (+ a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.9e+155) || !(t <= 2.3e+171)) {
tmp = a * (t / (t + x));
} else {
tmp = (a + z) - 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 ((t <= (-1.9d+155)) .or. (.not. (t <= 2.3d+171))) then
tmp = a * (t / (t + x))
else
tmp = (a + z) - 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 ((t <= -1.9e+155) || !(t <= 2.3e+171)) {
tmp = a * (t / (t + x));
} else {
tmp = (a + z) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.9e+155) or not (t <= 2.3e+171): tmp = a * (t / (t + x)) else: tmp = (a + z) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.9e+155) || !(t <= 2.3e+171)) tmp = Float64(a * Float64(t / Float64(t + x))); else tmp = Float64(Float64(a + z) - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -1.9e+155) || ~((t <= 2.3e+171))) tmp = a * (t / (t + x)); else tmp = (a + z) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.9e+155], N[Not[LessEqual[t, 2.3e+171]], $MachinePrecision]], N[(a * N[(t / N[(t + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{+155} \lor \neg \left(t \leq 2.3 \cdot 10^{+171}\right):\\
\;\;\;\;a \cdot \frac{t}{t + x}\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\
\end{array}
\end{array}
if t < -1.9e155 or 2.30000000000000017e171 < t Initial program 55.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
Applied rewrites57.9%
Taylor expanded in a around inf
Applied rewrites64.5%
Taylor expanded in y around 0
Applied rewrites64.5%
if -1.9e155 < t < 2.30000000000000017e171Initial program 64.0%
Taylor expanded in y around inf
Applied rewrites59.2%
Final simplification60.4%
(FPCore (x y z t a b) :precision binary64 (if (<= t -2.8e+124) a (if (<= t 5.8e-107) (- z b) (if (<= t 2.45e+140) z a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -2.8e+124) {
tmp = a;
} else if (t <= 5.8e-107) {
tmp = z - b;
} else if (t <= 2.45e+140) {
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 <= (-2.8d+124)) then
tmp = a
else if (t <= 5.8d-107) then
tmp = z - b
else if (t <= 2.45d+140) 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 <= -2.8e+124) {
tmp = a;
} else if (t <= 5.8e-107) {
tmp = z - b;
} else if (t <= 2.45e+140) {
tmp = z;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -2.8e+124: tmp = a elif t <= 5.8e-107: tmp = z - b elif t <= 2.45e+140: tmp = z else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -2.8e+124) tmp = a; elseif (t <= 5.8e-107) tmp = Float64(z - b); elseif (t <= 2.45e+140) tmp = z; else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -2.8e+124) tmp = a; elseif (t <= 5.8e-107) tmp = z - b; elseif (t <= 2.45e+140) tmp = z; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -2.8e+124], a, If[LessEqual[t, 5.8e-107], N[(z - b), $MachinePrecision], If[LessEqual[t, 2.45e+140], z, a]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+124}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 5.8 \cdot 10^{-107}:\\
\;\;\;\;z - b\\
\mathbf{elif}\;t \leq 2.45 \cdot 10^{+140}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < -2.8e124 or 2.4499999999999998e140 < t Initial program 53.1%
Taylor expanded in t around inf
Applied rewrites57.7%
if -2.8e124 < t < 5.7999999999999996e-107Initial program 64.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
Applied rewrites66.0%
Taylor expanded in x around inf
Applied rewrites63.0%
Taylor expanded in y around inf
Applied rewrites49.4%
if 5.7999999999999996e-107 < t < 2.4499999999999998e140Initial program 68.0%
Taylor expanded in x around inf
Applied rewrites47.3%
(FPCore (x y z t a b) :precision binary64 (if (<= t -2.9e+155) a (if (<= t 3e+190) (- (+ a z) b) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -2.9e+155) {
tmp = a;
} else if (t <= 3e+190) {
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.9d+155)) then
tmp = a
else if (t <= 3d+190) 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.9e+155) {
tmp = a;
} else if (t <= 3e+190) {
tmp = (a + z) - b;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -2.9e+155: tmp = a elif t <= 3e+190: tmp = (a + z) - b else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -2.9e+155) tmp = a; elseif (t <= 3e+190) 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.9e+155) tmp = a; elseif (t <= 3e+190) tmp = (a + z) - b; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -2.9e+155], a, If[LessEqual[t, 3e+190], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{+155}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 3 \cdot 10^{+190}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < -2.8999999999999999e155 or 2.99999999999999982e190 < t Initial program 55.9%
Taylor expanded in t around inf
Applied rewrites63.9%
if -2.8999999999999999e155 < t < 2.99999999999999982e190Initial program 63.7%
Taylor expanded in y around inf
Applied rewrites58.6%
(FPCore (x y z t a b) :precision binary64 (if (<= t -2.9e-70) a (if (<= t 2.45e+140) z a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -2.9e-70) {
tmp = a;
} else if (t <= 2.45e+140) {
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 <= (-2.9d-70)) then
tmp = a
else if (t <= 2.45d+140) 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 <= -2.9e-70) {
tmp = a;
} else if (t <= 2.45e+140) {
tmp = z;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -2.9e-70: tmp = a elif t <= 2.45e+140: tmp = z else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -2.9e-70) tmp = a; elseif (t <= 2.45e+140) tmp = z; else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -2.9e-70) tmp = a; elseif (t <= 2.45e+140) tmp = z; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -2.9e-70], a, If[LessEqual[t, 2.45e+140], z, a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{-70}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 2.45 \cdot 10^{+140}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < -2.89999999999999971e-70 or 2.4499999999999998e140 < t Initial program 54.6%
Taylor expanded in t around inf
Applied rewrites47.3%
if -2.89999999999999971e-70 < t < 2.4499999999999998e140Initial program 67.3%
Taylor expanded in x around inf
Applied rewrites49.1%
(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 62.1%
Taylor expanded in t around inf
Applied rewrites31.1%
(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_3 (/ t_2 t_1))
(t_4 (- (+ z a) b)))
(if (< t_3 -3.5813117084150564e+153)
t_4
(if (< t_3 1.2285964308315609e+82) (/ 1.0 (/ t_1 t_2)) t_4))))
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);
double t_3 = t_2 / t_1;
double t_4 = (z + a) - b;
double tmp;
if (t_3 < -3.5813117084150564e+153) {
tmp = t_4;
} else if (t_3 < 1.2285964308315609e+82) {
tmp = 1.0 / (t_1 / t_2);
} else {
tmp = t_4;
}
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) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = (x + t) + y
t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b)
t_3 = t_2 / t_1
t_4 = (z + a) - b
if (t_3 < (-3.5813117084150564d+153)) then
tmp = t_4
else if (t_3 < 1.2285964308315609d+82) then
tmp = 1.0d0 / (t_1 / t_2)
else
tmp = t_4
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 = (x + t) + y;
double t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b);
double t_3 = t_2 / t_1;
double t_4 = (z + a) - b;
double tmp;
if (t_3 < -3.5813117084150564e+153) {
tmp = t_4;
} else if (t_3 < 1.2285964308315609e+82) {
tmp = 1.0 / (t_1 / t_2);
} else {
tmp = t_4;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x + t) + y t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b) t_3 = t_2 / t_1 t_4 = (z + a) - b tmp = 0 if t_3 < -3.5813117084150564e+153: tmp = t_4 elif t_3 < 1.2285964308315609e+82: tmp = 1.0 / (t_1 / t_2) else: tmp = t_4 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) t_3 = Float64(t_2 / t_1) t_4 = Float64(Float64(z + a) - b) tmp = 0.0 if (t_3 < -3.5813117084150564e+153) tmp = t_4; elseif (t_3 < 1.2285964308315609e+82) tmp = Float64(1.0 / Float64(t_1 / t_2)); else tmp = t_4; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x + t) + y; t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b); t_3 = t_2 / t_1; t_4 = (z + a) - b; tmp = 0.0; if (t_3 < -3.5813117084150564e+153) tmp = t_4; elseif (t_3 < 1.2285964308315609e+82) tmp = 1.0 / (t_1 / t_2); else tmp = t_4; end tmp_2 = 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[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[Less[t$95$3, -3.5813117084150564e+153], t$95$4, If[Less[t$95$3, 1.2285964308315609e+82], N[(1.0 / N[(t$95$1 / t$95$2), $MachinePrecision]), $MachinePrecision], t$95$4]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\\
t_3 := \frac{t\_2}{t\_1}\\
t_4 := \left(z + a\right) - b\\
\mathbf{if}\;t\_3 < -3.5813117084150564 \cdot 10^{+153}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 < 1.2285964308315609 \cdot 10^{+82}:\\
\;\;\;\;\frac{1}{\frac{t\_1}{t\_2}}\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}
\end{array}
herbie shell --seed 2025022
(FPCore (x y z t a b)
:name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
:precision binary64
:alt
(! :herbie-platform default (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) -3581311708415056400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (+ z a) b) (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) 12285964308315609000000000000000000000000000000000000000000000000000000000000000000) (/ 1 (/ (+ (+ x t) y) (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)))) (- (+ z a) b))))
(/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))