
(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 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b): return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ t (+ x y)))
(t_2 (+ (+ y x) t))
(t_3
(fma
(/ (+ y x) t_2)
z
(* a (fma -1.0 (* (/ b a) (/ y t_1)) (/ (+ t y) t_1))))))
(if (<= a -5.5e-18)
t_3
(if (<= a 5e-46)
(- (fma z (/ (+ x y) t_1) (/ (* a (+ t y)) t_1)) (* b (/ y t_2)))
t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t + (x + y);
double t_2 = (y + x) + t;
double t_3 = fma(((y + x) / t_2), z, (a * fma(-1.0, ((b / a) * (y / t_1)), ((t + y) / t_1))));
double tmp;
if (a <= -5.5e-18) {
tmp = t_3;
} else if (a <= 5e-46) {
tmp = fma(z, ((x + y) / t_1), ((a * (t + y)) / t_1)) - (b * (y / t_2));
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(t + Float64(x + y)) t_2 = Float64(Float64(y + x) + t) t_3 = fma(Float64(Float64(y + x) / t_2), z, Float64(a * fma(-1.0, Float64(Float64(b / a) * Float64(y / t_1)), Float64(Float64(t + y) / t_1)))) tmp = 0.0 if (a <= -5.5e-18) tmp = t_3; elseif (a <= 5e-46) tmp = Float64(fma(z, Float64(Float64(x + y) / t_1), Float64(Float64(a * Float64(t + y)) / t_1)) - Float64(b * Float64(y / t_2))); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(y + x), $MachinePrecision] / t$95$2), $MachinePrecision] * z + N[(a * N[(-1.0 * N[(N[(b / a), $MachinePrecision] * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -5.5e-18], t$95$3, If[LessEqual[a, 5e-46], N[(N[(z * N[(N[(x + y), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[(a * N[(t + y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] - N[(b * N[(y / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \left(x + y\right)\\
t_2 := \left(y + x\right) + t\\
t_3 := \mathsf{fma}\left(\frac{y + x}{t\_2}, z, a \cdot \mathsf{fma}\left(-1, \frac{b}{a} \cdot \frac{y}{t\_1}, \frac{t + y}{t\_1}\right)\right)\\
\mathbf{if}\;a \leq -5.5 \cdot 10^{-18}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;a \leq 5 \cdot 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{x + y}{t\_1}, \frac{a \cdot \left(t + y\right)}{t\_1}\right) - b \cdot \frac{y}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if a < -5.5e-18 or 4.99999999999999992e-46 < a Initial program 56.3%
Applied rewrites66.4%
Taylor expanded in a around inf
lower-*.f64N/A
lower-fma.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-+.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6498.5
Applied rewrites98.5%
if -5.5e-18 < a < 4.99999999999999992e-46Initial program 77.8%
Applied rewrites80.0%
Taylor expanded in z around 0
lower-fma.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f6496.4
Applied rewrites96.4%
Final simplification97.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 (+ (+ y x) t)))
(if (<= t_2 -2e+170)
(fma (/ (+ y x) t_3) z a)
(if (<= t_2 2e+35)
(/ (fma (+ t y) a (* (+ y x) z)) t_1)
(if (<= t_2 1.3e+258)
(fma 1.0 z (/ (fma (+ t y) a (* (- b) y)) t_3))
(- (+ a z) b))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = (y + x) + t;
double tmp;
if (t_2 <= -2e+170) {
tmp = fma(((y + x) / t_3), z, a);
} else if (t_2 <= 2e+35) {
tmp = fma((t + y), a, ((y + x) * z)) / t_1;
} else if (t_2 <= 1.3e+258) {
tmp = fma(1.0, z, (fma((t + y), a, (-b * y)) / t_3));
} else {
tmp = (a + z) - b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(Float64(y + x) + t) tmp = 0.0 if (t_2 <= -2e+170) tmp = fma(Float64(Float64(y + x) / t_3), z, a); elseif (t_2 <= 2e+35) tmp = Float64(fma(Float64(t + y), a, Float64(Float64(y + x) * z)) / t_1); elseif (t_2 <= 1.3e+258) tmp = fma(1.0, z, Float64(fma(Float64(t + y), a, Float64(Float64(-b) * y)) / t_3)); else tmp = Float64(Float64(a + z) - b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+170], N[(N[(N[(y + x), $MachinePrecision] / t$95$3), $MachinePrecision] * z + a), $MachinePrecision], If[LessEqual[t$95$2, 2e+35], N[(N[(N[(t + y), $MachinePrecision] * a + N[(N[(y + x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 1.3e+258], N[(1.0 * z + N[(N[(N[(t + y), $MachinePrecision] * a + N[((-b) * y), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - b), $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(y + x\right) + t\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+170}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y + x}{t\_3}, z, a\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+35}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t + y, a, \left(y + x\right) \cdot z\right)}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 1.3 \cdot 10^{+258}:\\
\;\;\;\;\mathsf{fma}\left(1, z, \frac{\mathsf{fma}\left(t + y, a, \left(-b\right) \cdot y\right)}{t\_3}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\
\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)) < -2.00000000000000007e170Initial program 27.4%
Applied rewrites63.6%
Taylor expanded in t around inf
Applied rewrites78.4%
if -2.00000000000000007e170 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.9999999999999999e35Initial program 99.6%
Taylor expanded in b around 0
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f6480.8
Applied rewrites80.8%
if 1.9999999999999999e35 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.30000000000000005e258Initial program 99.7%
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites93.7%
if 1.30000000000000005e258 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 17.8%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6472.6
Applied rewrites72.6%
Final simplification80.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ t (+ x y)))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(t_3 (+ (+ y x) t))
(t_4 (/ (+ y x) t_3)))
(if (<= t_2 (- INFINITY))
(fma t_4 z (* a (/ (+ t y) t_1)))
(if (<= t_2 5e+292)
(fma t_4 z (/ (fma (+ t y) a (* (- b) y)) t_3))
(fma t_4 z (* a (fma -1.0 (* (/ b a) (/ y t_1)) 1.0)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t + (x + y);
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double t_3 = (y + x) + t;
double t_4 = (y + x) / t_3;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(t_4, z, (a * ((t + y) / t_1)));
} else if (t_2 <= 5e+292) {
tmp = fma(t_4, z, (fma((t + y), a, (-b * y)) / t_3));
} else {
tmp = fma(t_4, z, (a * fma(-1.0, ((b / a) * (y / t_1)), 1.0)));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(t + Float64(x + y)) 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(y + x) + t) t_4 = Float64(Float64(y + x) / t_3) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(t_4, z, Float64(a * Float64(Float64(t + y) / t_1))); elseif (t_2 <= 5e+292) tmp = fma(t_4, z, Float64(fma(Float64(t + y), a, Float64(Float64(-b) * y)) / t_3)); else tmp = fma(t_4, z, Float64(a * fma(-1.0, Float64(Float64(b / a) * Float64(y / t_1)), 1.0))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(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[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$4 = N[(N[(y + x), $MachinePrecision] / t$95$3), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(t$95$4 * z + N[(a * N[(N[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+292], N[(t$95$4 * z + N[(N[(N[(t + y), $MachinePrecision] * a + N[((-b) * y), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision], N[(t$95$4 * z + N[(a * N[(-1.0 * N[(N[(b / a), $MachinePrecision] * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \left(x + y\right)\\
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(y + x\right) + t\\
t_4 := \frac{y + x}{t\_3}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(t\_4, z, a \cdot \frac{t + y}{t\_1}\right)\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+292}:\\
\;\;\;\;\mathsf{fma}\left(t\_4, z, \frac{\mathsf{fma}\left(t + y, a, \left(-b\right) \cdot y\right)}{t\_3}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_4, z, a \cdot \mathsf{fma}\left(-1, \frac{b}{a} \cdot \frac{y}{t\_1}, 1\right)\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0Initial program 6.2%
Applied rewrites52.9%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lift-+.f64N/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6488.8
Applied rewrites88.8%
Taylor expanded in a around inf
div-add-revN/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f6488.9
Applied rewrites88.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)) < 4.9999999999999996e292Initial program 99.7%
Applied rewrites99.7%
if 4.9999999999999996e292 < (/.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%
Applied rewrites29.9%
Taylor expanded in a around inf
lower-*.f64N/A
lower-fma.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-+.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6486.8
Applied rewrites86.8%
Taylor expanded in x around 0
Applied rewrites78.2%
Final simplification93.4%
(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 (+ (+ y x) t))
(t_3 (/ (+ y x) t_2))
(t_4 (fma t_3 z (* a (/ (+ t y) (+ t (+ x y)))))))
(if (<= t_1 (- INFINITY))
t_4
(if (<= t_1 5e+292)
(fma t_3 z (/ (fma (+ t y) a (* (- b) y)) t_2))
t_4))))
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 = (y + x) + t;
double t_3 = (y + x) / t_2;
double t_4 = fma(t_3, z, (a * ((t + y) / (t + (x + y)))));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_4;
} else if (t_1 <= 5e+292) {
tmp = fma(t_3, z, (fma((t + y), a, (-b * y)) / t_2));
} else {
tmp = t_4;
}
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(y + x) + t) t_3 = Float64(Float64(y + x) / t_2) t_4 = fma(t_3, z, Float64(a * Float64(Float64(t + y) / Float64(t + Float64(x + y))))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_4; elseif (t_1 <= 5e+292) tmp = fma(t_3, z, Float64(fma(Float64(t + y), a, Float64(Float64(-b) * y)) / t_2)); else tmp = t_4; 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[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y + x), $MachinePrecision] / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * z + N[(a * N[(N[(t + y), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$4, If[LessEqual[t$95$1, 5e+292], N[(t$95$3 * z + N[(N[(N[(t + y), $MachinePrecision] * a + N[((-b) * y), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], t$95$4]]]]]]
\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(y + x\right) + t\\
t_3 := \frac{y + x}{t\_2}\\
t_4 := \mathsf{fma}\left(t\_3, z, a \cdot \frac{t + y}{t + \left(x + y\right)}\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+292}:\\
\;\;\;\;\mathsf{fma}\left(t\_3, z, \frac{\mathsf{fma}\left(t + y, a, \left(-b\right) \cdot y\right)}{t\_2}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\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.9999999999999996e292 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 7.3%
Applied rewrites38.4%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lift-+.f64N/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6477.3
Applied rewrites77.3%
Taylor expanded in a around inf
div-add-revN/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f6480.9
Applied rewrites80.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)) < 4.9999999999999996e292Initial program 99.7%
Applied rewrites99.7%
Final simplification93.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
(fma (/ (+ y x) (+ (+ y x) t)) z (* a (/ (+ t y) (+ t (+ x y)))))))
(if (<= t_2 (- INFINITY))
t_3
(if (<= t_2 5e+292)
(/ (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 = fma(((y + x) / ((y + x) + t)), z, (a * ((t + y) / (t + (x + y)))));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= 5e+292) {
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 = fma(Float64(Float64(y + x) / Float64(Float64(y + x) + t)), z, Float64(a * Float64(Float64(t + y) / Float64(t + Float64(x + y))))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= 5e+292) 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[(N[(y + x), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] * z + N[(a * N[(N[(t + y), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, 5e+292], 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 := \mathsf{fma}\left(\frac{y + x}{\left(y + x\right) + t}, z, a \cdot \frac{t + y}{t + \left(x + y\right)}\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+292}:\\
\;\;\;\;\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.9999999999999996e292 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 7.3%
Applied rewrites38.4%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lift-+.f64N/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6477.3
Applied rewrites77.3%
Taylor expanded in a around inf
div-add-revN/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f6480.9
Applied rewrites80.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)) < 4.9999999999999996e292Initial program 99.7%
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.7
Applied rewrites99.7%
Final simplification92.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1)))
(if (<= t_2 (- INFINITY))
(fma (/ (+ y x) (+ (+ y x) t)) z (* a (/ t (+ t x))))
(if (<= t_2 1e+263)
(/ (fma (+ y x) z (fma (+ t y) a (* (- b) y))) t_1)
(- (+ a z) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(((y + x) / ((y + x) + t)), z, (a * (t / (t + x))));
} else if (t_2 <= 1e+263) {
tmp = fma((y + x), z, fma((t + y), a, (-b * y))) / t_1;
} else {
tmp = (a + z) - b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(Float64(Float64(y + x) / Float64(Float64(y + x) + t)), z, Float64(a * Float64(t / Float64(t + x)))); elseif (t_2 <= 1e+263) tmp = Float64(fma(Float64(y + x), z, fma(Float64(t + y), a, Float64(Float64(-b) * y))) / t_1); else tmp = Float64(Float64(a + z) - b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(N[(y + x), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] * z + N[(a * N[(t / N[(t + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+263], N[(N[(N[(y + x), $MachinePrecision] * z + N[(N[(t + y), $MachinePrecision] * a + N[((-b) * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{y + x}{\left(y + x\right) + t}, z, a \cdot \frac{t}{t + x}\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+263}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y + x, z, \mathsf{fma}\left(t + y, a, \left(-b\right) \cdot y\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0Initial program 6.2%
Applied rewrites52.9%
Taylor expanded in a around inf
lower-*.f64N/A
lower-fma.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-+.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6491.3
Applied rewrites91.3%
Taylor expanded in y around 0
lower-/.f64N/A
lift-+.f6483.1
Applied rewrites83.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)) < 1.00000000000000002e263Initial program 99.7%
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.7
Applied rewrites99.7%
if 1.00000000000000002e263 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 13.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6474.1
Applied rewrites74.1%
Final simplification91.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)))
(if (<= t_2 (- INFINITY))
(fma (/ (+ y x) (+ (+ y x) t)) z a)
(if (<= t_2 1e+263)
(/ (fma (+ y x) z (fma (+ t y) a (* (- b) y))) t_1)
(- (+ a z) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(((y + x) / ((y + x) + t)), z, a);
} else if (t_2 <= 1e+263) {
tmp = fma((y + x), z, fma((t + y), a, (-b * y))) / t_1;
} else {
tmp = (a + z) - b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(Float64(Float64(y + x) / Float64(Float64(y + x) + t)), z, a); elseif (t_2 <= 1e+263) tmp = Float64(fma(Float64(y + x), z, fma(Float64(t + y), a, Float64(Float64(-b) * y))) / t_1); else tmp = Float64(Float64(a + z) - b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(N[(y + x), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] * z + a), $MachinePrecision], If[LessEqual[t$95$2, 1e+263], N[(N[(N[(y + x), $MachinePrecision] * z + N[(N[(t + y), $MachinePrecision] * a + N[((-b) * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{y + x}{\left(y + x\right) + t}, z, a\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+263}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y + x, z, \mathsf{fma}\left(t + y, a, \left(-b\right) \cdot y\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0Initial program 6.2%
Applied rewrites52.9%
Taylor expanded in t around inf
Applied rewrites80.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)) < 1.00000000000000002e263Initial program 99.7%
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.7
Applied rewrites99.7%
if 1.00000000000000002e263 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 13.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6474.1
Applied rewrites74.1%
Final simplification90.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ t (+ x y))) (t_2 (/ (+ y x) (+ (+ y x) t))))
(if (<=
(/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y))
4e+299)
(fma t_2 z (fma -1.0 (/ (* b y) t_1) (* a (/ (+ t y) t_1))))
(fma
t_2
z
(* a (* b (fma -1.0 (/ y (* a t_1)) (/ (+ t y) (* b t_1)))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t + (x + y);
double t_2 = (y + x) / ((y + x) + t);
double tmp;
if ((((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)) <= 4e+299) {
tmp = fma(t_2, z, fma(-1.0, ((b * y) / t_1), (a * ((t + y) / t_1))));
} else {
tmp = fma(t_2, z, (a * (b * fma(-1.0, (y / (a * t_1)), ((t + y) / (b * t_1))))));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(t + Float64(x + y)) t_2 = Float64(Float64(y + x) / Float64(Float64(y + x) + t)) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) <= 4e+299) tmp = fma(t_2, z, fma(-1.0, Float64(Float64(b * y) / t_1), Float64(a * Float64(Float64(t + y) / t_1)))); else tmp = fma(t_2, z, Float64(a * Float64(b * fma(-1.0, Float64(y / Float64(a * t_1)), Float64(Float64(t + y) / Float64(b * t_1)))))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + x), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[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], 4e+299], N[(t$95$2 * z + N[(-1.0 * N[(N[(b * y), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(a * N[(N[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * z + N[(a * N[(b * N[(-1.0 * N[(y / N[(a * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] / N[(b * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \left(x + y\right)\\
t_2 := \frac{y + x}{\left(y + x\right) + t}\\
\mathbf{if}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \leq 4 \cdot 10^{+299}:\\
\;\;\;\;\mathsf{fma}\left(t\_2, z, \mathsf{fma}\left(-1, \frac{b \cdot y}{t\_1}, a \cdot \frac{t + y}{t\_1}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_2, z, a \cdot \left(b \cdot \mathsf{fma}\left(-1, \frac{y}{a \cdot t\_1}, \frac{t + y}{b \cdot t\_1}\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.0000000000000002e299Initial program 83.8%
Applied rewrites91.8%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lift-+.f64N/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6497.0
Applied rewrites97.0%
if 4.0000000000000002e299 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 4.6%
Applied rewrites27.4%
Taylor expanded in a around inf
lower-*.f64N/A
lower-fma.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-+.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6486.4
Applied rewrites86.4%
Taylor expanded in b around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lift-+.f6484.1
Applied rewrites84.1%
Final simplification94.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(t_2 (- (+ a z) b)))
(if (<= t_1 -8e-36) t_2 (if (<= t_1 4e-58) (/ (* (+ y x) z) (+ t x)) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double t_2 = (a + z) - b;
double tmp;
if (t_1 <= -8e-36) {
tmp = t_2;
} else if (t_1 <= 4e-58) {
tmp = ((y + x) * z) / (t + x);
} else {
tmp = t_2;
}
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) :: tmp
t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
t_2 = (a + z) - b
if (t_1 <= (-8d-36)) then
tmp = t_2
else if (t_1 <= 4d-58) then
tmp = ((y + x) * z) / (t + x)
else
tmp = t_2
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 + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double t_2 = (a + z) - b;
double tmp;
if (t_1 <= -8e-36) {
tmp = t_2;
} else if (t_1 <= 4e-58) {
tmp = ((y + x) * z) / (t + x);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y) t_2 = (a + z) - b tmp = 0 if t_1 <= -8e-36: tmp = t_2 elif t_1 <= 4e-58: tmp = ((y + x) * z) / (t + x) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) t_2 = Float64(Float64(a + z) - b) tmp = 0.0 if (t_1 <= -8e-36) tmp = t_2; elseif (t_1 <= 4e-58) tmp = Float64(Float64(Float64(y + x) * z) / Float64(t + x)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); t_2 = (a + z) - b; tmp = 0.0; if (t_1 <= -8e-36) tmp = t_2; elseif (t_1 <= 4e-58) tmp = ((y + x) * z) / (t + x); else tmp = t_2; end tmp_2 = 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, -8e-36], t$95$2, If[LessEqual[t$95$1, 4e-58], N[(N[(N[(y + x), $MachinePrecision] * z), $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 -8 \cdot 10^{-36}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-58}:\\
\;\;\;\;\frac{\left(y + x\right) \cdot z}{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)) < -7.9999999999999995e-36 or 4.0000000000000001e-58 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6464.1
Applied rewrites64.1%
if -7.9999999999999995e-36 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.0000000000000001e-58Initial program 99.6%
Taylor expanded in z around inf
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f6454.3
Applied rewrites54.3%
Taylor expanded in y around inf
Applied rewrites7.6%
Taylor expanded in y around 0
lift-+.f6450.0
Applied rewrites50.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ t (+ x y)))
(t_2 (+ (+ y x) t))
(t_3
(fma
(/ (+ y x) t_2)
z
(fma -1.0 (/ (* b y) t_1) (* a (/ (+ t y) t_1))))))
(if (<= a -2.4e+55)
t_3
(if (<= a 180000000.0)
(- (fma z (/ (+ x y) t_1) (/ (* a (+ t y)) t_1)) (* b (/ y t_2)))
t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t + (x + y);
double t_2 = (y + x) + t;
double t_3 = fma(((y + x) / t_2), z, fma(-1.0, ((b * y) / t_1), (a * ((t + y) / t_1))));
double tmp;
if (a <= -2.4e+55) {
tmp = t_3;
} else if (a <= 180000000.0) {
tmp = fma(z, ((x + y) / t_1), ((a * (t + y)) / t_1)) - (b * (y / t_2));
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(t + Float64(x + y)) t_2 = Float64(Float64(y + x) + t) t_3 = fma(Float64(Float64(y + x) / t_2), z, fma(-1.0, Float64(Float64(b * y) / t_1), Float64(a * Float64(Float64(t + y) / t_1)))) tmp = 0.0 if (a <= -2.4e+55) tmp = t_3; elseif (a <= 180000000.0) tmp = Float64(fma(z, Float64(Float64(x + y) / t_1), Float64(Float64(a * Float64(t + y)) / t_1)) - Float64(b * Float64(y / t_2))); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(y + x), $MachinePrecision] / t$95$2), $MachinePrecision] * z + N[(-1.0 * N[(N[(b * y), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(a * N[(N[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2.4e+55], t$95$3, If[LessEqual[a, 180000000.0], N[(N[(z * N[(N[(x + y), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[(a * N[(t + y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] - N[(b * N[(y / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \left(x + y\right)\\
t_2 := \left(y + x\right) + t\\
t_3 := \mathsf{fma}\left(\frac{y + x}{t\_2}, z, \mathsf{fma}\left(-1, \frac{b \cdot y}{t\_1}, a \cdot \frac{t + y}{t\_1}\right)\right)\\
\mathbf{if}\;a \leq -2.4 \cdot 10^{+55}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;a \leq 180000000:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{x + y}{t\_1}, \frac{a \cdot \left(t + y\right)}{t\_1}\right) - b \cdot \frac{y}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if a < -2.3999999999999999e55 or 1.8e8 < a Initial program 53.3%
Applied rewrites62.4%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lift-+.f64N/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6493.7
Applied rewrites93.7%
if -2.3999999999999999e55 < a < 1.8e8Initial program 76.0%
Applied rewrites80.4%
Taylor expanded in z around 0
lower-fma.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f6496.4
Applied rewrites96.4%
Final simplification95.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ t (+ x y)))
(t_2 (+ (+ y x) t))
(t_3 (fma (/ (+ y x) t_2) z (* a (/ (+ t y) t_1)))))
(if (<= a -2.4e+55)
t_3
(if (<= a 1.35e+41)
(- (fma z (/ (+ x y) t_1) (/ (* a (+ t y)) t_1)) (* b (/ y t_2)))
t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t + (x + y);
double t_2 = (y + x) + t;
double t_3 = fma(((y + x) / t_2), z, (a * ((t + y) / t_1)));
double tmp;
if (a <= -2.4e+55) {
tmp = t_3;
} else if (a <= 1.35e+41) {
tmp = fma(z, ((x + y) / t_1), ((a * (t + y)) / t_1)) - (b * (y / t_2));
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(t + Float64(x + y)) t_2 = Float64(Float64(y + x) + t) t_3 = fma(Float64(Float64(y + x) / t_2), z, Float64(a * Float64(Float64(t + y) / t_1))) tmp = 0.0 if (a <= -2.4e+55) tmp = t_3; elseif (a <= 1.35e+41) tmp = Float64(fma(z, Float64(Float64(x + y) / t_1), Float64(Float64(a * Float64(t + y)) / t_1)) - Float64(b * Float64(y / t_2))); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(y + x), $MachinePrecision] / t$95$2), $MachinePrecision] * z + N[(a * N[(N[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2.4e+55], t$95$3, If[LessEqual[a, 1.35e+41], N[(N[(z * N[(N[(x + y), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[(a * N[(t + y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] - N[(b * N[(y / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \left(x + y\right)\\
t_2 := \left(y + x\right) + t\\
t_3 := \mathsf{fma}\left(\frac{y + x}{t\_2}, z, a \cdot \frac{t + y}{t\_1}\right)\\
\mathbf{if}\;a \leq -2.4 \cdot 10^{+55}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;a \leq 1.35 \cdot 10^{+41}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{x + y}{t\_1}, \frac{a \cdot \left(t + y\right)}{t\_1}\right) - b \cdot \frac{y}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if a < -2.3999999999999999e55 or 1.35e41 < a Initial program 53.4%
Applied rewrites61.3%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lift-+.f64N/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6494.2
Applied rewrites94.2%
Taylor expanded in a around inf
div-add-revN/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f6490.4
Applied rewrites90.4%
if -2.3999999999999999e55 < a < 1.35e41Initial program 74.8%
Applied rewrites78.9%
Taylor expanded in z around 0
lower-fma.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f6495.9
Applied rewrites95.9%
Final simplification93.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ t (+ x y))) (t_2 (- (+ a z) b)))
(if (<= a -3e-60)
t_2
(if (<= a 2e-203)
(* z (/ (+ x y) t_1))
(if (<= a 9.5e+125) t_2 (* a (/ (+ t y) t_1)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t + (x + y);
double t_2 = (a + z) - b;
double tmp;
if (a <= -3e-60) {
tmp = t_2;
} else if (a <= 2e-203) {
tmp = z * ((x + y) / t_1);
} else if (a <= 9.5e+125) {
tmp = t_2;
} else {
tmp = a * ((t + y) / 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) :: t_2
real(8) :: tmp
t_1 = t + (x + y)
t_2 = (a + z) - b
if (a <= (-3d-60)) then
tmp = t_2
else if (a <= 2d-203) then
tmp = z * ((x + y) / t_1)
else if (a <= 9.5d+125) then
tmp = t_2
else
tmp = a * ((t + y) / 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 = t + (x + y);
double t_2 = (a + z) - b;
double tmp;
if (a <= -3e-60) {
tmp = t_2;
} else if (a <= 2e-203) {
tmp = z * ((x + y) / t_1);
} else if (a <= 9.5e+125) {
tmp = t_2;
} else {
tmp = a * ((t + y) / t_1);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = t + (x + y) t_2 = (a + z) - b tmp = 0 if a <= -3e-60: tmp = t_2 elif a <= 2e-203: tmp = z * ((x + y) / t_1) elif a <= 9.5e+125: tmp = t_2 else: tmp = a * ((t + y) / t_1) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(t + Float64(x + y)) t_2 = Float64(Float64(a + z) - b) tmp = 0.0 if (a <= -3e-60) tmp = t_2; elseif (a <= 2e-203) tmp = Float64(z * Float64(Float64(x + y) / t_1)); elseif (a <= 9.5e+125) tmp = t_2; else tmp = Float64(a * Float64(Float64(t + y) / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = t + (x + y); t_2 = (a + z) - b; tmp = 0.0; if (a <= -3e-60) tmp = t_2; elseif (a <= 2e-203) tmp = z * ((x + y) / t_1); elseif (a <= 9.5e+125) tmp = t_2; else tmp = a * ((t + y) / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[a, -3e-60], t$95$2, If[LessEqual[a, 2e-203], N[(z * N[(N[(x + y), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 9.5e+125], t$95$2, N[(a * N[(N[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \left(x + y\right)\\
t_2 := \left(a + z\right) - b\\
\mathbf{if}\;a \leq -3 \cdot 10^{-60}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \leq 2 \cdot 10^{-203}:\\
\;\;\;\;z \cdot \frac{x + y}{t\_1}\\
\mathbf{elif}\;a \leq 9.5 \cdot 10^{+125}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{t + y}{t\_1}\\
\end{array}
\end{array}
if a < -3.00000000000000019e-60 or 2.0000000000000001e-203 < a < 9.50000000000000041e125Initial program 66.3%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6460.0
Applied rewrites60.0%
if -3.00000000000000019e-60 < a < 2.0000000000000001e-203Initial program 77.0%
Applied rewrites93.4%
Taylor expanded in z around inf
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6469.7
Applied rewrites69.7%
if 9.50000000000000041e125 < a Initial program 48.3%
Applied rewrites53.1%
Taylor expanded in a around inf
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6480.1
Applied rewrites80.1%
Final simplification66.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ y x) t)) (t_2 (* b (/ y t_1))))
(if (<= b -1.75e+53)
(- a t_2)
(if (<= b 7e-31) (fma (/ (+ y x) t_1) z a) (- z t_2)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y + x) + t;
double t_2 = b * (y / t_1);
double tmp;
if (b <= -1.75e+53) {
tmp = a - t_2;
} else if (b <= 7e-31) {
tmp = fma(((y + x) / t_1), z, a);
} else {
tmp = z - t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y + x) + t) t_2 = Float64(b * Float64(y / t_1)) tmp = 0.0 if (b <= -1.75e+53) tmp = Float64(a - t_2); elseif (b <= 7e-31) tmp = fma(Float64(Float64(y + x) / t_1), z, a); else tmp = Float64(z - t_2); 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[(b * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.75e+53], N[(a - t$95$2), $MachinePrecision], If[LessEqual[b, 7e-31], N[(N[(N[(y + x), $MachinePrecision] / t$95$1), $MachinePrecision] * z + a), $MachinePrecision], N[(z - t$95$2), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + x\right) + t\\
t_2 := b \cdot \frac{y}{t\_1}\\
\mathbf{if}\;b \leq -1.75 \cdot 10^{+53}:\\
\;\;\;\;a - t\_2\\
\mathbf{elif}\;b \leq 7 \cdot 10^{-31}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y + x}{t\_1}, z, a\right)\\
\mathbf{else}:\\
\;\;\;\;z - t\_2\\
\end{array}
\end{array}
if b < -1.75000000000000009e53Initial program 65.3%
Applied rewrites75.5%
Taylor expanded in t around inf
Applied rewrites67.3%
if -1.75000000000000009e53 < b < 6.99999999999999971e-31Initial program 65.0%
Applied rewrites78.5%
Taylor expanded in t around inf
Applied rewrites86.6%
if 6.99999999999999971e-31 < b Initial program 70.3%
Applied rewrites72.7%
Taylor expanded in x around inf
Applied rewrites69.2%
Final simplification78.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* b (/ y (+ (+ y x) t))))) (if (<= b -2.3e+48) (- a t_1) (if (<= b 1.08e-38) (+ a z) (- z t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (y / ((y + x) + t));
double tmp;
if (b <= -2.3e+48) {
tmp = a - t_1;
} else if (b <= 1.08e-38) {
tmp = a + z;
} else {
tmp = z - 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 = b * (y / ((y + x) + t))
if (b <= (-2.3d+48)) then
tmp = a - t_1
else if (b <= 1.08d-38) then
tmp = a + z
else
tmp = z - 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 = b * (y / ((y + x) + t));
double tmp;
if (b <= -2.3e+48) {
tmp = a - t_1;
} else if (b <= 1.08e-38) {
tmp = a + z;
} else {
tmp = z - t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = b * (y / ((y + x) + t)) tmp = 0 if b <= -2.3e+48: tmp = a - t_1 elif b <= 1.08e-38: tmp = a + z else: tmp = z - t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(y / Float64(Float64(y + x) + t))) tmp = 0.0 if (b <= -2.3e+48) tmp = Float64(a - t_1); elseif (b <= 1.08e-38) tmp = Float64(a + z); else tmp = Float64(z - t_1); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = b * (y / ((y + x) + t)); tmp = 0.0; if (b <= -2.3e+48) tmp = a - t_1; elseif (b <= 1.08e-38) tmp = a + z; else tmp = z - t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(y / N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -2.3e+48], N[(a - t$95$1), $MachinePrecision], If[LessEqual[b, 1.08e-38], N[(a + z), $MachinePrecision], N[(z - t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \frac{y}{\left(y + x\right) + t}\\
\mathbf{if}\;b \leq -2.3 \cdot 10^{+48}:\\
\;\;\;\;a - t\_1\\
\mathbf{elif}\;b \leq 1.08 \cdot 10^{-38}:\\
\;\;\;\;a + z\\
\mathbf{else}:\\
\;\;\;\;z - t\_1\\
\end{array}
\end{array}
if b < -2.3e48Initial program 66.7%
Applied rewrites76.5%
Taylor expanded in t around inf
Applied rewrites68.6%
if -2.3e48 < b < 1.08e-38Initial program 64.3%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6469.3
Applied rewrites69.3%
Taylor expanded in b around 0
lift-+.f6471.1
Applied rewrites71.1%
if 1.08e-38 < b Initial program 70.7%
Applied rewrites73.1%
Taylor expanded in x around inf
Applied rewrites68.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* z (/ (+ x y) (+ t (+ x y))))))
(if (<= z -7e+115)
t_1
(if (<= z 2.65e+26) (- 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+115) {
tmp = t_1;
} else if (z <= 2.65e+26) {
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+115)) then
tmp = t_1
else if (z <= 2.65d+26) 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+115) {
tmp = t_1;
} else if (z <= 2.65e+26) {
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+115: tmp = t_1 elif z <= 2.65e+26: 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+115) tmp = t_1; elseif (z <= 2.65e+26) 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+115) tmp = t_1; elseif (z <= 2.65e+26) 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+115], t$95$1, If[LessEqual[z, 2.65e+26], 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^{+115}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.65 \cdot 10^{+26}:\\
\;\;\;\;a - b \cdot \frac{y}{\left(y + x\right) + t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.00000000000000011e115 or 2.64999999999999984e26 < z Initial program 55.5%
Applied rewrites83.7%
Taylor expanded in z around inf
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6470.5
Applied rewrites70.5%
if -7.00000000000000011e115 < z < 2.64999999999999984e26Initial program 72.8%
Applied rewrites76.3%
Taylor expanded in t around inf
Applied rewrites66.1%
Final simplification67.7%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.8e+260) (* a (/ t (+ t x))) (if (<= t 1.02e+108) (- (+ a z) b) (* a (/ (+ t y) (+ t (+ x y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.8e+260) {
tmp = a * (t / (t + x));
} else if (t <= 1.02e+108) {
tmp = (a + z) - b;
} else {
tmp = a * ((t + y) / (t + (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 (t <= (-1.8d+260)) then
tmp = a * (t / (t + x))
else if (t <= 1.02d+108) then
tmp = (a + z) - b
else
tmp = a * ((t + y) / (t + (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 (t <= -1.8e+260) {
tmp = a * (t / (t + x));
} else if (t <= 1.02e+108) {
tmp = (a + z) - b;
} else {
tmp = a * ((t + y) / (t + (x + y)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.8e+260: tmp = a * (t / (t + x)) elif t <= 1.02e+108: tmp = (a + z) - b else: tmp = a * ((t + y) / (t + (x + y))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.8e+260) tmp = Float64(a * Float64(t / Float64(t + x))); elseif (t <= 1.02e+108) tmp = Float64(Float64(a + z) - b); else tmp = Float64(a * Float64(Float64(t + y) / Float64(t + Float64(x + y)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -1.8e+260) tmp = a * (t / (t + x)); elseif (t <= 1.02e+108) tmp = (a + z) - b; else tmp = a * ((t + y) / (t + (x + y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.8e+260], N[(a * N[(t / N[(t + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.02e+108], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], N[(a * N[(N[(t + y), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{+260}:\\
\;\;\;\;a \cdot \frac{t}{t + x}\\
\mathbf{elif}\;t \leq 1.02 \cdot 10^{+108}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{t + y}{t + \left(x + y\right)}\\
\end{array}
\end{array}
if t < -1.7999999999999999e260Initial program 65.3%
Applied rewrites65.3%
Taylor expanded in a around inf
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6473.8
Applied rewrites73.8%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6473.8
Applied rewrites73.8%
if -1.7999999999999999e260 < t < 1.02e108Initial program 69.1%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6462.7
Applied rewrites62.7%
if 1.02e108 < t Initial program 57.3%
Applied rewrites61.0%
Taylor expanded in a around inf
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6455.7
Applied rewrites55.7%
Final simplification61.7%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* a (/ t (+ t x))))) (if (<= t -1.8e+260) t_1 (if (<= t 2.8e+108) (- (+ a z) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (t / (t + x));
double tmp;
if (t <= -1.8e+260) {
tmp = t_1;
} else if (t <= 2.8e+108) {
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 / (t + x))
if (t <= (-1.8d+260)) then
tmp = t_1
else if (t <= 2.8d+108) 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 / (t + x));
double tmp;
if (t <= -1.8e+260) {
tmp = t_1;
} else if (t <= 2.8e+108) {
tmp = (a + z) - b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a * (t / (t + x)) tmp = 0 if t <= -1.8e+260: tmp = t_1 elif t <= 2.8e+108: tmp = (a + z) - b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(t / Float64(t + x))) tmp = 0.0 if (t <= -1.8e+260) tmp = t_1; elseif (t <= 2.8e+108) 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 / (t + x)); tmp = 0.0; if (t <= -1.8e+260) tmp = t_1; elseif (t <= 2.8e+108) 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[(t / N[(t + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.8e+260], t$95$1, If[LessEqual[t, 2.8e+108], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \frac{t}{t + x}\\
\mathbf{if}\;t \leq -1.8 \cdot 10^{+260}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+108}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.7999999999999999e260 or 2.7999999999999998e108 < t Initial program 58.7%
Applied rewrites61.7%
Taylor expanded in a around inf
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lift-+.f6458.8
Applied rewrites58.8%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6456.1
Applied rewrites56.1%
if -1.7999999999999999e260 < t < 2.7999999999999998e108Initial program 69.1%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6462.7
Applied rewrites62.7%
Final simplification61.0%
(FPCore (x y z t a b) :precision binary64 (if (<= x -1.75e+162) z (if (<= x 9.2e-38) (- (+ a z) b) (+ a z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.75e+162) {
tmp = z;
} else if (x <= 9.2e-38) {
tmp = (a + z) - b;
} else {
tmp = a + z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (x <= (-1.75d+162)) then
tmp = z
else if (x <= 9.2d-38) then
tmp = (a + z) - b
else
tmp = a + z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.75e+162) {
tmp = z;
} else if (x <= 9.2e-38) {
tmp = (a + z) - b;
} else {
tmp = a + z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -1.75e+162: tmp = z elif x <= 9.2e-38: tmp = (a + z) - b else: tmp = a + z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1.75e+162) tmp = z; elseif (x <= 9.2e-38) tmp = Float64(Float64(a + z) - b); else tmp = Float64(a + z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -1.75e+162) tmp = z; elseif (x <= 9.2e-38) tmp = (a + z) - b; else tmp = a + z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.75e+162], z, If[LessEqual[x, 9.2e-38], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], N[(a + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+162}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{-38}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;a + z\\
\end{array}
\end{array}
if x < -1.75000000000000009e162Initial program 40.0%
Taylor expanded in x around inf
Applied rewrites66.5%
if -1.75000000000000009e162 < x < 9.20000000000000007e-38Initial program 72.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6460.2
Applied rewrites60.2%
if 9.20000000000000007e-38 < x Initial program 63.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6452.1
Applied rewrites52.1%
Taylor expanded in b around 0
lift-+.f6459.1
Applied rewrites59.1%
(FPCore (x y z t a b) :precision binary64 (if (<= x -8e+20) z (if (<= x 1.75e+81) a z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -8e+20) {
tmp = z;
} else if (x <= 1.75e+81) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (x <= (-8d+20)) then
tmp = z
else if (x <= 1.75d+81) then
tmp = a
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -8e+20) {
tmp = z;
} else if (x <= 1.75e+81) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -8e+20: tmp = z elif x <= 1.75e+81: tmp = a else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -8e+20) tmp = z; elseif (x <= 1.75e+81) tmp = a; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -8e+20) tmp = z; elseif (x <= 1.75e+81) tmp = a; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -8e+20], z, If[LessEqual[x, 1.75e+81], a, z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{+20}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{+81}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -8e20 or 1.75e81 < x Initial program 56.8%
Taylor expanded in x around inf
Applied rewrites53.1%
if -8e20 < x < 1.75e81Initial program 72.6%
Taylor expanded in t around inf
Applied rewrites45.8%
(FPCore (x y z t a b) :precision binary64 (if (<= b -2.5e+48) (- a b) (+ a z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -2.5e+48) {
tmp = a - b;
} else {
tmp = a + z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-2.5d+48)) then
tmp = a - b
else
tmp = a + z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -2.5e+48) {
tmp = a - b;
} else {
tmp = a + z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -2.5e+48: tmp = a - b else: tmp = a + z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -2.5e+48) tmp = Float64(a - b); else tmp = Float64(a + z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -2.5e+48) tmp = a - b; else tmp = a + z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -2.5e+48], N[(a - b), $MachinePrecision], N[(a + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.5 \cdot 10^{+48}:\\
\;\;\;\;a - b\\
\mathbf{else}:\\
\;\;\;\;a + z\\
\end{array}
\end{array}
if b < -2.49999999999999987e48Initial program 66.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6449.1
Applied rewrites49.1%
Taylor expanded in z around 0
Applied rewrites45.9%
if -2.49999999999999987e48 < b Initial program 66.4%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6458.0
Applied rewrites58.0%
Taylor expanded in b around 0
lift-+.f6457.3
Applied rewrites57.3%
(FPCore (x y z t a b) :precision binary64 (if (<= x -2.15e+162) z (+ a z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -2.15e+162) {
tmp = z;
} else {
tmp = a + z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (x <= (-2.15d+162)) then
tmp = z
else
tmp = a + z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -2.15e+162) {
tmp = z;
} else {
tmp = a + z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -2.15e+162: tmp = z else: tmp = a + z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -2.15e+162) tmp = z; else tmp = Float64(a + z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -2.15e+162) tmp = z; else tmp = a + z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -2.15e+162], z, N[(a + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.15 \cdot 10^{+162}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;a + z\\
\end{array}
\end{array}
if x < -2.1500000000000001e162Initial program 40.0%
Taylor expanded in x around inf
Applied rewrites66.5%
if -2.1500000000000001e162 < x Initial program 70.2%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6457.8
Applied rewrites57.8%
Taylor expanded in b around 0
lift-+.f6451.9
Applied rewrites51.9%
(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 66.5%
Taylor expanded in t around inf
Applied rewrites33.7%
(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 2025050
(FPCore (x y z t a b)
:name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
:precision binary64
:pre (TRUE)
: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)))