
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
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, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i)); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
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, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i)); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\end{array}
(FPCore (x y z t a b c i) :precision binary64 (if (<= i -6e-104) (* 2.0 (fma y x (- (* t z) (* i (* (fma c b a) c))))) (* (fma (* i (fma c b a)) (- c) (fma t z (* y x))) 2.0)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (i <= -6e-104) {
tmp = 2.0 * fma(y, x, ((t * z) - (i * (fma(c, b, a) * c))));
} else {
tmp = fma((i * fma(c, b, a)), -c, fma(t, z, (y * x))) * 2.0;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (i <= -6e-104) tmp = Float64(2.0 * fma(y, x, Float64(Float64(t * z) - Float64(i * Float64(fma(c, b, a) * c))))); else tmp = Float64(fma(Float64(i * fma(c, b, a)), Float64(-c), fma(t, z, Float64(y * x))) * 2.0); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[i, -6e-104], N[(2.0 * N[(y * x + N[(N[(t * z), $MachinePrecision] - N[(i * N[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(i * N[(c * b + a), $MachinePrecision]), $MachinePrecision] * (-c) + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -6 \cdot 10^{-104}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(y, x, t \cdot z - i \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot \mathsf{fma}\left(c, b, a\right), -c, \mathsf{fma}\left(t, z, y \cdot x\right)\right) \cdot 2\\
\end{array}
\end{array}
if i < -6.0000000000000005e-104Initial program 94.7%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6499.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.3
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.4
Applied rewrites99.4%
if -6.0000000000000005e-104 < i Initial program 90.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.8
Applied rewrites96.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 (- INFINITY))
(* (* (* (fma b c a) c) -2.0) i)
(if (<= t_1 -2e+57)
(* 2.0 (fma (- i) (* c a) (* x y)))
(if (<= t_1 2e+91)
(* 2.0 (fma x y (* z t)))
(* (* -2.0 (* (fma c b a) i)) c))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = ((fma(b, c, a) * c) * -2.0) * i;
} else if (t_1 <= -2e+57) {
tmp = 2.0 * fma(-i, (c * a), (x * y));
} else if (t_1 <= 2e+91) {
tmp = 2.0 * fma(x, y, (z * t));
} else {
tmp = (-2.0 * (fma(c, b, a) * i)) * c;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(Float64(fma(b, c, a) * c) * -2.0) * i); elseif (t_1 <= -2e+57) tmp = Float64(2.0 * fma(Float64(-i), Float64(c * a), Float64(x * y))); elseif (t_1 <= 2e+91) tmp = Float64(2.0 * fma(x, y, Float64(z * t))); else tmp = Float64(Float64(-2.0 * Float64(fma(c, b, a) * i)) * c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(b * c + a), $MachinePrecision] * c), $MachinePrecision] * -2.0), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[t$95$1, -2e+57], N[(2.0 * N[((-i) * N[(c * a), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+91], N[(2.0 * N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(b, c, a\right) \cdot c\right) \cdot -2\right) \cdot i\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{+57}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-i, c \cdot a, x \cdot y\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+91}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(x, y, z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right)\right) \cdot c\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0Initial program 77.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6492.3
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6492.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6492.3
Applied rewrites92.3%
Taylor expanded in i around inf
Applied rewrites85.1%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2.0000000000000001e57Initial program 99.7%
Taylor expanded in b around 0
Applied rewrites95.9%
Taylor expanded in x around inf
Applied rewrites83.7%
if -2.0000000000000001e57 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000016e91Initial program 99.6%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6498.5
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6498.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.5
Applied rewrites98.5%
Taylor expanded in c around 0
Applied rewrites91.9%
if 2.00000000000000016e91 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 86.7%
Taylor expanded in i around inf
Applied rewrites86.6%
Final simplification88.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 (- INFINITY))
(* (* (* (* c c) i) b) -2.0)
(if (<= t_1 2e+91)
(* 2.0 (fma x y (* z t)))
(if (<= t_1 1e+210)
(* (* -2.0 c) (* a i))
(* (* (* b c) (* c i)) -2.0))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (((c * c) * i) * b) * -2.0;
} else if (t_1 <= 2e+91) {
tmp = 2.0 * fma(x, y, (z * t));
} else if (t_1 <= 1e+210) {
tmp = (-2.0 * c) * (a * i);
} else {
tmp = ((b * c) * (c * i)) * -2.0;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(c * c) * i) * b) * -2.0); elseif (t_1 <= 2e+91) tmp = Float64(2.0 * fma(x, y, Float64(z * t))); elseif (t_1 <= 1e+210) tmp = Float64(Float64(-2.0 * c) * Float64(a * i)); else tmp = Float64(Float64(Float64(b * c) * Float64(c * i)) * -2.0); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(c * c), $MachinePrecision] * i), $MachinePrecision] * b), $MachinePrecision] * -2.0), $MachinePrecision], If[LessEqual[t$95$1, 2e+91], N[(2.0 * N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+210], N[(N[(-2.0 * c), $MachinePrecision] * N[(a * i), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b * c), $MachinePrecision] * N[(c * i), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(\left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot -2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+91}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(x, y, z \cdot t\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+210}:\\
\;\;\;\;\left(-2 \cdot c\right) \cdot \left(a \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(b \cdot c\right) \cdot \left(c \cdot i\right)\right) \cdot -2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0Initial program 77.4%
Taylor expanded in b around inf
Applied rewrites74.9%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000016e91Initial program 99.6%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6498.7
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6498.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.7
Applied rewrites98.7%
Taylor expanded in c around 0
Applied rewrites83.4%
if 2.00000000000000016e91 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.99999999999999927e209Initial program 99.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites94.4%
Taylor expanded in a around inf
Applied rewrites78.4%
Taylor expanded in a around inf
Applied rewrites57.3%
Applied rewrites67.9%
if 9.99999999999999927e209 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 83.0%
Taylor expanded in b around inf
Applied rewrites69.9%
Applied rewrites74.2%
Final simplification78.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (* b c) (* c i)) -2.0)) (t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 2e+91)
(* 2.0 (fma x y (* z t)))
(if (<= t_2 1e+210) (* (* -2.0 c) (* a i)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((b * c) * (c * i)) * -2.0;
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 2e+91) {
tmp = 2.0 * fma(x, y, (z * t));
} else if (t_2 <= 1e+210) {
tmp = (-2.0 * c) * (a * i);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(b * c) * Float64(c * i)) * -2.0) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 2e+91) tmp = Float64(2.0 * fma(x, y, Float64(z * t))); elseif (t_2 <= 1e+210) tmp = Float64(Float64(-2.0 * c) * Float64(a * i)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(b * c), $MachinePrecision] * N[(c * i), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 2e+91], N[(2.0 * N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+210], N[(N[(-2.0 * c), $MachinePrecision] * N[(a * i), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(b \cdot c\right) \cdot \left(c \cdot i\right)\right) \cdot -2\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+91}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(x, y, z \cdot t\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+210}:\\
\;\;\;\;\left(-2 \cdot c\right) \cdot \left(a \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0 or 9.99999999999999927e209 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 80.8%
Taylor expanded in b around inf
Applied rewrites71.8%
Applied rewrites71.7%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000016e91Initial program 99.6%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6498.7
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6498.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.7
Applied rewrites98.7%
Taylor expanded in c around 0
Applied rewrites83.4%
if 2.00000000000000016e91 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.99999999999999927e209Initial program 99.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites94.4%
Taylor expanded in a around inf
Applied rewrites78.4%
Taylor expanded in a around inf
Applied rewrites57.3%
Applied rewrites67.9%
Final simplification77.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* c (* (* c i) (* -2.0 b)))) (t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 2e+91)
(* 2.0 (fma x y (* z t)))
(if (<= t_2 1e+210) (* (* -2.0 c) (* a i)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = c * ((c * i) * (-2.0 * b));
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 2e+91) {
tmp = 2.0 * fma(x, y, (z * t));
} else if (t_2 <= 1e+210) {
tmp = (-2.0 * c) * (a * i);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(c * Float64(Float64(c * i) * Float64(-2.0 * b))) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 2e+91) tmp = Float64(2.0 * fma(x, y, Float64(z * t))); elseif (t_2 <= 1e+210) tmp = Float64(Float64(-2.0 * c) * Float64(a * i)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(c * N[(N[(c * i), $MachinePrecision] * N[(-2.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 2e+91], N[(2.0 * N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+210], N[(N[(-2.0 * c), $MachinePrecision] * N[(a * i), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c \cdot \left(\left(c \cdot i\right) \cdot \left(-2 \cdot b\right)\right)\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+91}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(x, y, z \cdot t\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+210}:\\
\;\;\;\;\left(-2 \cdot c\right) \cdot \left(a \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0 or 9.99999999999999927e209 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 80.8%
Taylor expanded in b around inf
Applied rewrites71.8%
Applied rewrites71.3%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000016e91Initial program 99.6%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6498.7
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6498.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.7
Applied rewrites98.7%
Taylor expanded in c around 0
Applied rewrites83.4%
if 2.00000000000000016e91 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.99999999999999927e209Initial program 99.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites94.4%
Taylor expanded in a around inf
Applied rewrites78.4%
Taylor expanded in a around inf
Applied rewrites57.3%
Applied rewrites67.9%
Final simplification77.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -5e+49)
(* (* (* i c) a) -2.0)
(if (<= t_1 -5e-132)
(* 2.0 (* t z))
(if (<= t_1 2e+91) (* 2.0 (* y x)) (* (* -2.0 c) (* a i)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -5e+49) {
tmp = ((i * c) * a) * -2.0;
} else if (t_1 <= -5e-132) {
tmp = 2.0 * (t * z);
} else if (t_1 <= 2e+91) {
tmp = 2.0 * (y * x);
} else {
tmp = (-2.0 * c) * (a * i);
}
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, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = ((a + (b * c)) * c) * i
if (t_1 <= (-5d+49)) then
tmp = ((i * c) * a) * (-2.0d0)
else if (t_1 <= (-5d-132)) then
tmp = 2.0d0 * (t * z)
else if (t_1 <= 2d+91) then
tmp = 2.0d0 * (y * x)
else
tmp = ((-2.0d0) * c) * (a * i)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -5e+49) {
tmp = ((i * c) * a) * -2.0;
} else if (t_1 <= -5e-132) {
tmp = 2.0 * (t * z);
} else if (t_1 <= 2e+91) {
tmp = 2.0 * (y * x);
} else {
tmp = (-2.0 * c) * (a * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = ((a + (b * c)) * c) * i tmp = 0 if t_1 <= -5e+49: tmp = ((i * c) * a) * -2.0 elif t_1 <= -5e-132: tmp = 2.0 * (t * z) elif t_1 <= 2e+91: tmp = 2.0 * (y * x) else: tmp = (-2.0 * c) * (a * i) return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= -5e+49) tmp = Float64(Float64(Float64(i * c) * a) * -2.0); elseif (t_1 <= -5e-132) tmp = Float64(2.0 * Float64(t * z)); elseif (t_1 <= 2e+91) tmp = Float64(2.0 * Float64(y * x)); else tmp = Float64(Float64(-2.0 * c) * Float64(a * i)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = ((a + (b * c)) * c) * i; tmp = 0.0; if (t_1 <= -5e+49) tmp = ((i * c) * a) * -2.0; elseif (t_1 <= -5e-132) tmp = 2.0 * (t * z); elseif (t_1 <= 2e+91) tmp = 2.0 * (y * x); else tmp = (-2.0 * c) * (a * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+49], N[(N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision] * -2.0), $MachinePrecision], If[LessEqual[t$95$1, -5e-132], N[(2.0 * N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+91], N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * c), $MachinePrecision] * N[(a * i), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+49}:\\
\;\;\;\;\left(\left(i \cdot c\right) \cdot a\right) \cdot -2\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-132}:\\
\;\;\;\;2 \cdot \left(t \cdot z\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+91}:\\
\;\;\;\;2 \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot c\right) \cdot \left(a \cdot i\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.0000000000000004e49Initial program 85.9%
Taylor expanded in a around inf
Applied rewrites56.1%
if -5.0000000000000004e49 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.9999999999999999e-132Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites65.8%
if -4.9999999999999999e-132 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000016e91Initial program 99.5%
Taylor expanded in x around inf
Applied rewrites57.5%
if 2.00000000000000016e91 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 86.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6486.7
Applied rewrites89.2%
Taylor expanded in a around inf
Applied rewrites77.2%
Taylor expanded in a around inf
Applied rewrites40.8%
Applied rewrites42.0%
Final simplification52.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (* i c) a) -2.0)) (t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 -5e+49)
t_1
(if (<= t_2 -5e-132)
(* 2.0 (* t z))
(if (<= t_2 2e+91) (* 2.0 (* y x)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((i * c) * a) * -2.0;
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -5e+49) {
tmp = t_1;
} else if (t_2 <= -5e-132) {
tmp = 2.0 * (t * z);
} else if (t_2 <= 2e+91) {
tmp = 2.0 * (y * x);
} 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, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ((i * c) * a) * (-2.0d0)
t_2 = ((a + (b * c)) * c) * i
if (t_2 <= (-5d+49)) then
tmp = t_1
else if (t_2 <= (-5d-132)) then
tmp = 2.0d0 * (t * z)
else if (t_2 <= 2d+91) then
tmp = 2.0d0 * (y * x)
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 c, double i) {
double t_1 = ((i * c) * a) * -2.0;
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -5e+49) {
tmp = t_1;
} else if (t_2 <= -5e-132) {
tmp = 2.0 * (t * z);
} else if (t_2 <= 2e+91) {
tmp = 2.0 * (y * x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = ((i * c) * a) * -2.0 t_2 = ((a + (b * c)) * c) * i tmp = 0 if t_2 <= -5e+49: tmp = t_1 elif t_2 <= -5e-132: tmp = 2.0 * (t * z) elif t_2 <= 2e+91: tmp = 2.0 * (y * x) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(i * c) * a) * -2.0) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -5e+49) tmp = t_1; elseif (t_2 <= -5e-132) tmp = Float64(2.0 * Float64(t * z)); elseif (t_2 <= 2e+91) tmp = Float64(2.0 * Float64(y * x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = ((i * c) * a) * -2.0; t_2 = ((a + (b * c)) * c) * i; tmp = 0.0; if (t_2 <= -5e+49) tmp = t_1; elseif (t_2 <= -5e-132) tmp = 2.0 * (t * z); elseif (t_2 <= 2e+91) tmp = 2.0 * (y * x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision] * -2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+49], t$95$1, If[LessEqual[t$95$2, -5e-132], N[(2.0 * N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+91], N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(i \cdot c\right) \cdot a\right) \cdot -2\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-132}:\\
\;\;\;\;2 \cdot \left(t \cdot z\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+91}:\\
\;\;\;\;2 \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.0000000000000004e49 or 2.00000000000000016e91 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 86.3%
Taylor expanded in a around inf
Applied rewrites47.5%
if -5.0000000000000004e49 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.9999999999999999e-132Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites65.8%
if -4.9999999999999999e-132 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000016e91Initial program 99.5%
Taylor expanded in x around inf
Applied rewrites57.5%
Final simplification52.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 (- INFINITY))
(* (* (* (fma b c a) c) -2.0) i)
(if (<= t_1 2e+183)
(* 2.0 (fma (- i) (* c a) (fma t z (* y x))))
(* 2.0 (fma (fma c b a) (* i (- c)) (* x y)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = ((fma(b, c, a) * c) * -2.0) * i;
} else if (t_1 <= 2e+183) {
tmp = 2.0 * fma(-i, (c * a), fma(t, z, (y * x)));
} else {
tmp = 2.0 * fma(fma(c, b, a), (i * -c), (x * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(Float64(fma(b, c, a) * c) * -2.0) * i); elseif (t_1 <= 2e+183) tmp = Float64(2.0 * fma(Float64(-i), Float64(c * a), fma(t, z, Float64(y * x)))); else tmp = Float64(2.0 * fma(fma(c, b, a), Float64(i * Float64(-c)), Float64(x * y))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(b * c + a), $MachinePrecision] * c), $MachinePrecision] * -2.0), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[t$95$1, 2e+183], N[(2.0 * N[((-i) * N[(c * a), $MachinePrecision] + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(c * b + a), $MachinePrecision] * N[(i * (-c)), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(b, c, a\right) \cdot c\right) \cdot -2\right) \cdot i\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+183}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-i, c \cdot a, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(c, b, a\right), i \cdot \left(-c\right), x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0Initial program 77.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6492.3
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6492.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6492.3
Applied rewrites92.3%
Taylor expanded in i around inf
Applied rewrites85.1%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.99999999999999989e183Initial program 99.6%
Taylor expanded in b around 0
Applied rewrites96.5%
if 1.99999999999999989e183 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 83.2%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6489.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6489.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6489.2
Applied rewrites89.2%
Taylor expanded in x around inf
Applied rewrites90.7%
Final simplification93.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 (- INFINITY))
(* (* (* (fma b c a) c) -2.0) i)
(if (<= t_1 1e+226)
(* 2.0 (fma (- i) (* c a) (fma t z (* y x))))
(* (* -2.0 (* (fma c b a) i)) c)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = ((fma(b, c, a) * c) * -2.0) * i;
} else if (t_1 <= 1e+226) {
tmp = 2.0 * fma(-i, (c * a), fma(t, z, (y * x)));
} else {
tmp = (-2.0 * (fma(c, b, a) * i)) * c;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(Float64(fma(b, c, a) * c) * -2.0) * i); elseif (t_1 <= 1e+226) tmp = Float64(2.0 * fma(Float64(-i), Float64(c * a), fma(t, z, Float64(y * x)))); else tmp = Float64(Float64(-2.0 * Float64(fma(c, b, a) * i)) * c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(b * c + a), $MachinePrecision] * c), $MachinePrecision] * -2.0), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[t$95$1, 1e+226], N[(2.0 * N[((-i) * N[(c * a), $MachinePrecision] + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(b, c, a\right) \cdot c\right) \cdot -2\right) \cdot i\\
\mathbf{elif}\;t\_1 \leq 10^{+226}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-i, c \cdot a, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right)\right) \cdot c\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0Initial program 77.4%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6492.3
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6492.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6492.3
Applied rewrites92.3%
Taylor expanded in i around inf
Applied rewrites85.1%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.99999999999999961e225Initial program 99.6%
Taylor expanded in b around 0
Applied rewrites95.9%
if 9.99999999999999961e225 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 82.4%
Taylor expanded in i around inf
Applied rewrites89.0%
Final simplification92.6%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -5e+88) (not (<= t_1 2e+91)))
(* (* (* (fma b c a) c) -2.0) i)
(* 2.0 (fma x y (* z t))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if ((t_1 <= -5e+88) || !(t_1 <= 2e+91)) {
tmp = ((fma(b, c, a) * c) * -2.0) * i;
} else {
tmp = 2.0 * fma(x, y, (z * t));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if ((t_1 <= -5e+88) || !(t_1 <= 2e+91)) tmp = Float64(Float64(Float64(fma(b, c, a) * c) * -2.0) * i); else tmp = Float64(2.0 * fma(x, y, Float64(z * t))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+88], N[Not[LessEqual[t$95$1, 2e+91]], $MachinePrecision]], N[(N[(N[(N[(b * c + a), $MachinePrecision] * c), $MachinePrecision] * -2.0), $MachinePrecision] * i), $MachinePrecision], N[(2.0 * N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+88} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+91}\right):\\
\;\;\;\;\left(\left(\mathsf{fma}\left(b, c, a\right) \cdot c\right) \cdot -2\right) \cdot i\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(x, y, z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.99999999999999997e88 or 2.00000000000000016e91 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 85.8%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6492.7
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6492.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6492.7
Applied rewrites92.7%
Taylor expanded in i around inf
Applied rewrites81.3%
if -4.99999999999999997e88 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000016e91Initial program 99.6%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6498.5
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6498.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.5
Applied rewrites98.5%
Taylor expanded in c around 0
Applied rewrites90.6%
Final simplification85.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -5e+88)
(* (* (* (fma b c a) c) -2.0) i)
(if (<= t_1 2e+91)
(* 2.0 (fma x y (* z t)))
(* (* -2.0 (* (fma c b a) i)) c)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -5e+88) {
tmp = ((fma(b, c, a) * c) * -2.0) * i;
} else if (t_1 <= 2e+91) {
tmp = 2.0 * fma(x, y, (z * t));
} else {
tmp = (-2.0 * (fma(c, b, a) * i)) * c;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= -5e+88) tmp = Float64(Float64(Float64(fma(b, c, a) * c) * -2.0) * i); elseif (t_1 <= 2e+91) tmp = Float64(2.0 * fma(x, y, Float64(z * t))); else tmp = Float64(Float64(-2.0 * Float64(fma(c, b, a) * i)) * c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+88], N[(N[(N[(N[(b * c + a), $MachinePrecision] * c), $MachinePrecision] * -2.0), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[t$95$1, 2e+91], N[(2.0 * N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+88}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(b, c, a\right) \cdot c\right) \cdot -2\right) \cdot i\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+91}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(x, y, z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right)\right) \cdot c\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.99999999999999997e88Initial program 84.6%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6494.7
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6494.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6494.7
Applied rewrites94.7%
Taylor expanded in i around inf
Applied rewrites77.1%
if -4.99999999999999997e88 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000016e91Initial program 99.6%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6498.5
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6498.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.5
Applied rewrites98.5%
Taylor expanded in c around 0
Applied rewrites90.6%
if 2.00000000000000016e91 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 86.7%
Taylor expanded in i around inf
Applied rewrites86.6%
Final simplification86.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -1e+113)
(* (* (* i c) a) -2.0)
(if (<= t_1 2e+91) (* 2.0 (fma x y (* z t))) (* (* -2.0 c) (* a i))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -1e+113) {
tmp = ((i * c) * a) * -2.0;
} else if (t_1 <= 2e+91) {
tmp = 2.0 * fma(x, y, (z * t));
} else {
tmp = (-2.0 * c) * (a * i);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= -1e+113) tmp = Float64(Float64(Float64(i * c) * a) * -2.0); elseif (t_1 <= 2e+91) tmp = Float64(2.0 * fma(x, y, Float64(z * t))); else tmp = Float64(Float64(-2.0 * c) * Float64(a * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+113], N[(N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision] * -2.0), $MachinePrecision], If[LessEqual[t$95$1, 2e+91], N[(2.0 * N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * c), $MachinePrecision] * N[(a * i), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+113}:\\
\;\;\;\;\left(\left(i \cdot c\right) \cdot a\right) \cdot -2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+91}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(x, y, z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot c\right) \cdot \left(a \cdot i\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1e113Initial program 83.9%
Taylor expanded in a around inf
Applied rewrites58.7%
if -1e113 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000016e91Initial program 99.6%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6498.5
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6498.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.5
Applied rewrites98.5%
Taylor expanded in c around 0
Applied rewrites89.2%
if 2.00000000000000016e91 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 86.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6486.7
Applied rewrites89.2%
Taylor expanded in a around inf
Applied rewrites77.2%
Taylor expanded in a around inf
Applied rewrites40.8%
Applied rewrites42.0%
Final simplification67.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -1e+113)
(* (* (* i c) a) -2.0)
(if (<= t_1 2e+91) (* 2.0 (fma t z (* y x))) (* (* -2.0 c) (* a i))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -1e+113) {
tmp = ((i * c) * a) * -2.0;
} else if (t_1 <= 2e+91) {
tmp = 2.0 * fma(t, z, (y * x));
} else {
tmp = (-2.0 * c) * (a * i);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= -1e+113) tmp = Float64(Float64(Float64(i * c) * a) * -2.0); elseif (t_1 <= 2e+91) tmp = Float64(2.0 * fma(t, z, Float64(y * x))); else tmp = Float64(Float64(-2.0 * c) * Float64(a * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+113], N[(N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision] * -2.0), $MachinePrecision], If[LessEqual[t$95$1, 2e+91], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * c), $MachinePrecision] * N[(a * i), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+113}:\\
\;\;\;\;\left(\left(i \cdot c\right) \cdot a\right) \cdot -2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+91}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot c\right) \cdot \left(a \cdot i\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1e113Initial program 83.9%
Taylor expanded in a around inf
Applied rewrites58.7%
if -1e113 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000016e91Initial program 99.6%
Taylor expanded in c around 0
Applied rewrites89.2%
if 2.00000000000000016e91 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 86.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6486.7
Applied rewrites89.2%
Taylor expanded in a around inf
Applied rewrites77.2%
Taylor expanded in a around inf
Applied rewrites40.8%
Applied rewrites42.0%
Final simplification67.7%
(FPCore (x y z t a b c i) :precision binary64 (if (<= i -6e-104) (* 2.0 (fma y x (- (* t z) (* i (* (fma c b a) c))))) (* 2.0 (fma (fma c b a) (* i (- c)) (fma t z (* y x))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (i <= -6e-104) {
tmp = 2.0 * fma(y, x, ((t * z) - (i * (fma(c, b, a) * c))));
} else {
tmp = 2.0 * fma(fma(c, b, a), (i * -c), fma(t, z, (y * x)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (i <= -6e-104) tmp = Float64(2.0 * fma(y, x, Float64(Float64(t * z) - Float64(i * Float64(fma(c, b, a) * c))))); else tmp = Float64(2.0 * fma(fma(c, b, a), Float64(i * Float64(-c)), fma(t, z, Float64(y * x)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[i, -6e-104], N[(2.0 * N[(y * x + N[(N[(t * z), $MachinePrecision] - N[(i * N[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(c * b + a), $MachinePrecision] * N[(i * (-c)), $MachinePrecision] + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -6 \cdot 10^{-104}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(y, x, t \cdot z - i \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(c, b, a\right), i \cdot \left(-c\right), \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\end{array}
\end{array}
if i < -6.0000000000000005e-104Initial program 94.7%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6499.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.3
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.4
Applied rewrites99.4%
if -6.0000000000000005e-104 < i Initial program 90.8%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6496.0
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6496.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.0
Applied rewrites96.0%
Final simplification97.1%
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (fma y x (- (* t z) (* i (* (fma c b a) c))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * fma(y, x, ((t * z) - (i * (fma(c, b, a) * c))));
}
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * fma(y, x, Float64(Float64(t * z) - Float64(i * Float64(fma(c, b, a) * c))))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(y * x + N[(N[(t * z), $MachinePrecision] - N[(i * N[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \mathsf{fma}\left(y, x, t \cdot z - i \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot c\right)\right)
\end{array}
Initial program 92.1%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6494.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6494.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6494.1
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6494.1
Applied rewrites94.1%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* z t) -2e+54) (not (<= (* z t) 2e-59))) (* 2.0 (* t z)) (* 2.0 (* y x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((z * t) <= -2e+54) || !((z * t) <= 2e-59)) {
tmp = 2.0 * (t * z);
} else {
tmp = 2.0 * (y * x);
}
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, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (((z * t) <= (-2d+54)) .or. (.not. ((z * t) <= 2d-59))) then
tmp = 2.0d0 * (t * z)
else
tmp = 2.0d0 * (y * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((z * t) <= -2e+54) || !((z * t) <= 2e-59)) {
tmp = 2.0 * (t * z);
} else {
tmp = 2.0 * (y * x);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((z * t) <= -2e+54) or not ((z * t) <= 2e-59): tmp = 2.0 * (t * z) else: tmp = 2.0 * (y * x) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(z * t) <= -2e+54) || !(Float64(z * t) <= 2e-59)) tmp = Float64(2.0 * Float64(t * z)); else tmp = Float64(2.0 * Float64(y * x)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((z * t) <= -2e+54) || ~(((z * t) <= 2e-59))) tmp = 2.0 * (t * z); else tmp = 2.0 * (y * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -2e+54], N[Not[LessEqual[N[(z * t), $MachinePrecision], 2e-59]], $MachinePrecision]], N[(2.0 * N[(t * z), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+54} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{-59}\right):\\
\;\;\;\;2 \cdot \left(t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -2.0000000000000002e54 or 2.0000000000000001e-59 < (*.f64 z t) Initial program 88.9%
Taylor expanded in z around inf
Applied rewrites50.3%
if -2.0000000000000002e54 < (*.f64 z t) < 2.0000000000000001e-59Initial program 94.8%
Taylor expanded in x around inf
Applied rewrites43.6%
Final simplification46.6%
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (* t z)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (t * z);
}
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, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (t * z)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (t * z);
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (t * z)
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(t * z)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (t * z); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(t * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(t \cdot z\right)
\end{array}
Initial program 92.1%
Taylor expanded in z around inf
Applied rewrites26.7%
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)));
}
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, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(a + Float64(b * c)) * Float64(c * i)))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i))); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)
\end{array}
herbie shell --seed 2025019
(FPCore (x y z t a b c i)
:name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A"
:precision binary64
:alt
(! :herbie-platform default (* 2 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i)))))
(* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))