
(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 15 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 (<= (+ (* x y) (* z t)) (- INFINITY)) (* 2.0 (fma z t (fma y x (* (* (* b c) (- i)) 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 (((x * y) + (z * t)) <= -((double) INFINITY)) {
tmp = 2.0 * fma(z, t, fma(y, x, (((b * c) * -i) * 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 (Float64(Float64(x * y) + Float64(z * t)) <= Float64(-Inf)) tmp = Float64(2.0 * fma(z, t, fma(y, x, Float64(Float64(Float64(b * c) * Float64(-i)) * c)))); else tmp = Float64(2.0 * fma(fma(c, b, a), Float64(Float64(-i) * c), fma(t, z, Float64(y * x)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(2.0 * N[(z * t + N[(y * x + N[(N[(N[(b * c), $MachinePrecision] * (-i)), $MachinePrecision] * c), $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}\;x \cdot y + z \cdot t \leq -\infty:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \left(\left(b \cdot c\right) \cdot \left(-i\right)\right) \cdot c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(c, b, a\right), \left(-i\right) \cdot c, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial 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-*.f6484.6
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6484.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.6
Applied rewrites84.6%
Taylor expanded in a around 0
lower-*.f6482.1
Applied rewrites82.1%
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6494.9
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
lower-*.f6494.9
Applied rewrites94.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
if -inf.0 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 88.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-*.f6496.7
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6498.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.1
Applied rewrites98.1%
Final simplification98.4%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))) INFINITY) (* 2.0 (fma y x (- (* t z) (* i (* (fma c b a) c))))) (* 2.0 (fma z t (fma y x (* (* c (- i)) (* c b)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))) <= ((double) INFINITY)) {
tmp = 2.0 * fma(y, x, ((t * z) - (i * (fma(c, b, a) * c))));
} else {
tmp = 2.0 * fma(z, t, fma(y, x, ((c * -i) * (c * b))));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) <= Inf) 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(z, t, fma(y, x, Float64(Float64(c * Float64(-i)) * Float64(c * b))))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[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], Infinity], 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[(z * t + N[(y * x + N[(N[(c * (-i)), $MachinePrecision] * N[(c * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \leq \infty:\\
\;\;\;\;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(z, t, \mathsf{fma}\left(y, x, \left(c \cdot \left(-i\right)\right) \cdot \left(c \cdot b\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 #s(literal 2 binary64) (-.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i))) < +inf.0Initial program 93.6%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6493.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6493.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6493.6
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6493.6
Applied rewrites93.6%
if +inf.0 < (*.f64 #s(literal 2 binary64) (-.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i))) Initial program 0.0%
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-*.f6437.5
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6456.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.3
Applied rewrites56.3%
Taylor expanded in a around 0
lower-*.f6456.3
Applied rewrites56.3%
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6487.5
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
lower-*.f6487.5
Applied rewrites87.5%
Final simplification93.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -5e+168) (not (<= t_1 1e+261)))
(* (* -2.0 (fma b c a)) (* i c))
(* (fma x y (- (* z t) (* (* i c) a))) 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 <= -5e+168) || !(t_1 <= 1e+261)) {
tmp = (-2.0 * fma(b, c, a)) * (i * c);
} else {
tmp = fma(x, y, ((z * t) - ((i * c) * a))) * 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 <= -5e+168) || !(t_1 <= 1e+261)) tmp = Float64(Float64(-2.0 * fma(b, c, a)) * Float64(i * c)); else tmp = Float64(fma(x, y, Float64(Float64(z * t) - Float64(Float64(i * c) * a))) * 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[Or[LessEqual[t$95$1, -5e+168], N[Not[LessEqual[t$95$1, 1e+261]], $MachinePrecision]], N[(N[(-2.0 * N[(b * c + a), $MachinePrecision]), $MachinePrecision] * N[(i * c), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(N[(z * t), $MachinePrecision] - N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision]), $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 -5 \cdot 10^{+168} \lor \neg \left(t\_1 \leq 10^{+261}\right):\\
\;\;\;\;\left(-2 \cdot \mathsf{fma}\left(b, c, a\right)\right) \cdot \left(i \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, z \cdot t - \left(i \cdot c\right) \cdot a\right) \cdot 2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.99999999999999967e168 or 9.9999999999999993e260 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 75.7%
Taylor expanded in i around inf
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
distribute-lft-outN/A
lower-*.f64N/A
distribute-lft-outN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6483.2
Applied rewrites83.2%
Applied rewrites86.6%
if -4.99999999999999967e168 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.9999999999999993e260Initial program 96.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6491.1
Applied rewrites91.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6491.1
Applied rewrites91.1%
Final simplification89.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -5e+168) (not (<= t_1 2e+244)))
(* (* -2.0 (fma b c a)) (* i c))
(* 2.0 (fma t z (* y x))))))
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+168) || !(t_1 <= 2e+244)) {
tmp = (-2.0 * fma(b, c, a)) * (i * c);
} else {
tmp = 2.0 * fma(t, z, (y * x));
}
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+168) || !(t_1 <= 2e+244)) tmp = Float64(Float64(-2.0 * fma(b, c, a)) * Float64(i * c)); else tmp = Float64(2.0 * fma(t, z, Float64(y * x))); 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+168], N[Not[LessEqual[t$95$1, 2e+244]], $MachinePrecision]], N[(N[(-2.0 * N[(b * c + a), $MachinePrecision]), $MachinePrecision] * N[(i * c), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t * z + N[(y * x), $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^{+168} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+244}\right):\\
\;\;\;\;\left(-2 \cdot \mathsf{fma}\left(b, c, a\right)\right) \cdot \left(i \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.99999999999999967e168 or 2.00000000000000015e244 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 76.2%
Taylor expanded in i around inf
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
distribute-lft-outN/A
lower-*.f64N/A
distribute-lft-outN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6482.7
Applied rewrites82.7%
Applied rewrites86.0%
if -4.99999999999999967e168 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000015e244Initial program 96.5%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6484.5
Applied rewrites84.5%
Final simplification85.1%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -5e+168) (not (<= t_1 1e+240)))
(* (* -2.0 (* (fma c b a) i)) c)
(* 2.0 (fma t z (* y x))))))
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+168) || !(t_1 <= 1e+240)) {
tmp = (-2.0 * (fma(c, b, a) * i)) * c;
} else {
tmp = 2.0 * fma(t, z, (y * x));
}
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+168) || !(t_1 <= 1e+240)) tmp = Float64(Float64(-2.0 * Float64(fma(c, b, a) * i)) * c); else tmp = Float64(2.0 * fma(t, z, Float64(y * x))); 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+168], N[Not[LessEqual[t$95$1, 1e+240]], $MachinePrecision]], N[(N[(-2.0 * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], N[(2.0 * N[(t * z + N[(y * x), $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^{+168} \lor \neg \left(t\_1 \leq 10^{+240}\right):\\
\;\;\;\;\left(-2 \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right)\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.99999999999999967e168 or 1.00000000000000001e240 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 75.5%
Taylor expanded in i around inf
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
distribute-lft-outN/A
lower-*.f64N/A
distribute-lft-outN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6482.8
Applied rewrites82.8%
if -4.99999999999999967e168 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.00000000000000001e240Initial program 97.2%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6484.3
Applied rewrites84.3%
Final simplification83.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -5e+168) (not (<= t_1 5e+306)))
(* (* (* (* c c) i) b) -2.0)
(* 2.0 (fma t z (* y x))))))
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+168) || !(t_1 <= 5e+306)) {
tmp = (((c * c) * i) * b) * -2.0;
} else {
tmp = 2.0 * fma(t, z, (y * x));
}
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+168) || !(t_1 <= 5e+306)) tmp = Float64(Float64(Float64(Float64(c * c) * i) * b) * -2.0); else tmp = Float64(2.0 * fma(t, z, Float64(y * x))); 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+168], N[Not[LessEqual[t$95$1, 5e+306]], $MachinePrecision]], N[(N[(N[(N[(c * c), $MachinePrecision] * i), $MachinePrecision] * b), $MachinePrecision] * -2.0), $MachinePrecision], N[(2.0 * N[(t * z + N[(y * x), $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^{+168} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+306}\right):\\
\;\;\;\;\left(\left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot -2\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.99999999999999967e168 or 4.99999999999999993e306 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 74.8%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6467.2
Applied rewrites67.2%
if -4.99999999999999967e168 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999993e306Initial program 96.7%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6482.5
Applied rewrites82.5%
Final simplification76.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -5e+168) (not (<= t_1 5e+306)))
(* (* -2.0 (* (* i c) b)) c)
(* 2.0 (fma t z (* y x))))))
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+168) || !(t_1 <= 5e+306)) {
tmp = (-2.0 * ((i * c) * b)) * c;
} else {
tmp = 2.0 * fma(t, z, (y * x));
}
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+168) || !(t_1 <= 5e+306)) tmp = Float64(Float64(-2.0 * Float64(Float64(i * c) * b)) * c); else tmp = Float64(2.0 * fma(t, z, Float64(y * x))); 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+168], N[Not[LessEqual[t$95$1, 5e+306]], $MachinePrecision]], N[(N[(-2.0 * N[(N[(i * c), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], N[(2.0 * N[(t * z + N[(y * x), $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^{+168} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+306}\right):\\
\;\;\;\;\left(-2 \cdot \left(\left(i \cdot c\right) \cdot b\right)\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.99999999999999967e168 or 4.99999999999999993e306 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 74.8%
Taylor expanded in i around inf
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
distribute-lft-outN/A
lower-*.f64N/A
distribute-lft-outN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6484.2
Applied rewrites84.2%
Taylor expanded in a around 0
Applied rewrites63.7%
if -4.99999999999999967e168 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999993e306Initial program 96.7%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6482.5
Applied rewrites82.5%
Final simplification74.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -5e+168)
(* (* -2.0 (* c b)) (* i c))
(if (<= t_1 5e+306)
(* 2.0 (fma t z (* y x)))
(* (* -2.0 (* (* i c) b)) 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+168) {
tmp = (-2.0 * (c * b)) * (i * c);
} else if (t_1 <= 5e+306) {
tmp = 2.0 * fma(t, z, (y * x));
} else {
tmp = (-2.0 * ((i * c) * b)) * 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+168) tmp = Float64(Float64(-2.0 * Float64(c * b)) * Float64(i * c)); elseif (t_1 <= 5e+306) tmp = Float64(2.0 * fma(t, z, Float64(y * x))); else tmp = Float64(Float64(-2.0 * Float64(Float64(i * c) * b)) * 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+168], N[(N[(-2.0 * N[(c * b), $MachinePrecision]), $MachinePrecision] * N[(i * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+306], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * N[(N[(i * c), $MachinePrecision] * b), $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^{+168}:\\
\;\;\;\;\left(-2 \cdot \left(c \cdot b\right)\right) \cdot \left(i \cdot c\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+306}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot \left(\left(i \cdot c\right) \cdot b\right)\right) \cdot c\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.99999999999999967e168Initial program 82.5%
Taylor expanded in i around inf
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
distribute-lft-outN/A
lower-*.f64N/A
distribute-lft-outN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6487.7
Applied rewrites87.7%
Applied rewrites92.3%
Taylor expanded in a around 0
Applied rewrites65.4%
if -4.99999999999999967e168 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999993e306Initial program 96.7%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6482.5
Applied rewrites82.5%
if 4.99999999999999993e306 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 63.9%
Taylor expanded in i around inf
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
distribute-lft-outN/A
lower-*.f64N/A
distribute-lft-outN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6479.4
Applied rewrites79.4%
Taylor expanded in a around 0
Applied rewrites61.3%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* (+ a (* b c)) c) (- INFINITY)) (* (* -2.0 (fma b c a)) (* i c)) (* 2.0 (fma z t (fma x y (* (- i) (* (fma b c a) c)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((a + (b * c)) * c) <= -((double) INFINITY)) {
tmp = (-2.0 * fma(b, c, a)) * (i * c);
} else {
tmp = 2.0 * fma(z, t, fma(x, y, (-i * (fma(b, c, a) * c))));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(a + Float64(b * c)) * c) <= Float64(-Inf)) tmp = Float64(Float64(-2.0 * fma(b, c, a)) * Float64(i * c)); else tmp = Float64(2.0 * fma(z, t, fma(x, y, Float64(Float64(-i) * Float64(fma(b, c, a) * c))))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], (-Infinity)], N[(N[(-2.0 * N[(b * c + a), $MachinePrecision]), $MachinePrecision] * N[(i * c), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * t + N[(x * y + N[((-i) * N[(N[(b * c + a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(a + b \cdot c\right) \cdot c \leq -\infty:\\
\;\;\;\;\left(-2 \cdot \mathsf{fma}\left(b, c, a\right)\right) \cdot \left(i \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(z, t, \mathsf{fma}\left(x, y, \left(-i\right) \cdot \left(\mathsf{fma}\left(b, c, a\right) \cdot c\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (+.f64 a (*.f64 b c)) c) < -inf.0Initial program 64.9%
Taylor expanded in i around inf
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
distribute-lft-outN/A
lower-*.f64N/A
distribute-lft-outN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6494.1
Applied rewrites94.1%
Applied rewrites94.2%
if -inf.0 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 91.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-*.f6496.4
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6497.7
Applied rewrites97.7%
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
associate-*l*N/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites93.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* z t) -5e+31) (not (<= (* z t) 1e+31))) (* 2.0 (fma t z (* y x))) (* 2.0 (fma (- i) (* (fma c b a) c) (* 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) <= -5e+31) || !((z * t) <= 1e+31)) {
tmp = 2.0 * fma(t, z, (y * x));
} else {
tmp = 2.0 * fma(-i, (fma(c, b, a) * c), (y * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(z * t) <= -5e+31) || !(Float64(z * t) <= 1e+31)) tmp = Float64(2.0 * fma(t, z, Float64(y * x))); else tmp = Float64(2.0 * fma(Float64(-i), Float64(fma(c, b, a) * c), Float64(y * x))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -5e+31], N[Not[LessEqual[N[(z * t), $MachinePrecision], 1e+31]], $MachinePrecision]], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[((-i) * N[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+31} \lor \neg \left(z \cdot t \leq 10^{+31}\right):\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-i, \mathsf{fma}\left(c, b, a\right) \cdot c, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -5.00000000000000027e31 or 9.9999999999999996e30 < (*.f64 z t) Initial program 86.5%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6482.3
Applied rewrites82.3%
if -5.00000000000000027e31 < (*.f64 z t) < 9.9999999999999996e30Initial program 88.9%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6488.1
Applied rewrites88.1%
Final simplification85.5%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= b -2.25e-120) (not (<= b 7e-92))) (* 2.0 (fma z t (fma y x (* (* c (- i)) (* c b))))) (* (fma x y (- (* z t) (* (* i c) a))) 2.0)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((b <= -2.25e-120) || !(b <= 7e-92)) {
tmp = 2.0 * fma(z, t, fma(y, x, ((c * -i) * (c * b))));
} else {
tmp = fma(x, y, ((z * t) - ((i * c) * a))) * 2.0;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((b <= -2.25e-120) || !(b <= 7e-92)) tmp = Float64(2.0 * fma(z, t, fma(y, x, Float64(Float64(c * Float64(-i)) * Float64(c * b))))); else tmp = Float64(fma(x, y, Float64(Float64(z * t) - Float64(Float64(i * c) * a))) * 2.0); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[b, -2.25e-120], N[Not[LessEqual[b, 7e-92]], $MachinePrecision]], N[(2.0 * N[(z * t + N[(y * x + N[(N[(c * (-i)), $MachinePrecision] * N[(c * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(N[(z * t), $MachinePrecision] - N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.25 \cdot 10^{-120} \lor \neg \left(b \leq 7 \cdot 10^{-92}\right):\\
\;\;\;\;2 \cdot \mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \left(c \cdot \left(-i\right)\right) \cdot \left(c \cdot b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, z \cdot t - \left(i \cdot c\right) \cdot a\right) \cdot 2\\
\end{array}
\end{array}
if b < -2.25e-120 or 7e-92 < b Initial program 87.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-*.f6493.9
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6495.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.1
Applied rewrites95.1%
Taylor expanded in a around 0
lower-*.f6487.5
Applied rewrites87.5%
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.9
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
lower-*.f6489.9
Applied rewrites89.9%
if -2.25e-120 < b < 7e-92Initial program 88.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6490.4
Applied rewrites90.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.4
Applied rewrites91.4%
Final simplification90.5%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= b -2.25e-120)
(* 2.0 (fma z t (fma y x (* (* (* b c) (- i)) c))))
(if (<= b 7e-92)
(* (fma x y (- (* z t) (* (* i c) a))) 2.0)
(* 2.0 (fma z t (fma y x (* (* c (- i)) (* c b))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (b <= -2.25e-120) {
tmp = 2.0 * fma(z, t, fma(y, x, (((b * c) * -i) * c)));
} else if (b <= 7e-92) {
tmp = fma(x, y, ((z * t) - ((i * c) * a))) * 2.0;
} else {
tmp = 2.0 * fma(z, t, fma(y, x, ((c * -i) * (c * b))));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (b <= -2.25e-120) tmp = Float64(2.0 * fma(z, t, fma(y, x, Float64(Float64(Float64(b * c) * Float64(-i)) * c)))); elseif (b <= 7e-92) tmp = Float64(fma(x, y, Float64(Float64(z * t) - Float64(Float64(i * c) * a))) * 2.0); else tmp = Float64(2.0 * fma(z, t, fma(y, x, Float64(Float64(c * Float64(-i)) * Float64(c * b))))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[b, -2.25e-120], N[(2.0 * N[(z * t + N[(y * x + N[(N[(N[(b * c), $MachinePrecision] * (-i)), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7e-92], N[(N[(x * y + N[(N[(z * t), $MachinePrecision] - N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], N[(2.0 * N[(z * t + N[(y * x + N[(N[(c * (-i)), $MachinePrecision] * N[(c * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.25 \cdot 10^{-120}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \left(\left(b \cdot c\right) \cdot \left(-i\right)\right) \cdot c\right)\right)\\
\mathbf{elif}\;b \leq 7 \cdot 10^{-92}:\\
\;\;\;\;\mathsf{fma}\left(x, y, z \cdot t - \left(i \cdot c\right) \cdot a\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \left(c \cdot \left(-i\right)\right) \cdot \left(c \cdot b\right)\right)\right)\\
\end{array}
\end{array}
if b < -2.25e-120Initial program 89.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-*.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 a around 0
lower-*.f6488.5
Applied rewrites88.5%
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6492.4
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
lower-*.f6492.4
Applied rewrites92.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.6%
if -2.25e-120 < b < 7e-92Initial program 88.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6490.4
Applied rewrites90.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.4
Applied rewrites91.4%
if 7e-92 < b Initial program 85.3%
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-*.f6493.1
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6495.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.4
Applied rewrites95.4%
Taylor expanded in a around 0
lower-*.f6486.6
Applied rewrites86.6%
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6487.7
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
lower-*.f6487.7
Applied rewrites87.7%
Final simplification90.8%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* (* (+ a (* b c)) c) i) -1e+236) (* (* (* i c) a) -2.0) (* 2.0 (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 ((((a + (b * c)) * c) * i) <= -1e+236) {
tmp = ((i * c) * a) * -2.0;
} else {
tmp = 2.0 * fma(t, z, (y * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(Float64(a + Float64(b * c)) * c) * i) <= -1e+236) tmp = Float64(Float64(Float64(i * c) * a) * -2.0); else tmp = Float64(2.0 * fma(t, z, Float64(y * x))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision], -1e+236], N[(N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision] * -2.0), $MachinePrecision], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i \leq -1 \cdot 10^{+236}:\\
\;\;\;\;\left(\left(i \cdot c\right) \cdot a\right) \cdot -2\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1.00000000000000005e236Initial program 81.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6446.2
Applied rewrites46.2%
if -1.00000000000000005e236 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 89.7%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6471.5
Applied rewrites71.5%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* z t) -2e+63) (not (<= (* z t) 2e+159))) (* t (+ z 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+63) || !((z * t) <= 2e+159)) {
tmp = t * (z + 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+63)) .or. (.not. ((z * t) <= 2d+159))) then
tmp = t * (z + 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+63) || !((z * t) <= 2e+159)) {
tmp = t * (z + 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+63) or not ((z * t) <= 2e+159): tmp = t * (z + 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+63) || !(Float64(z * t) <= 2e+159)) tmp = Float64(t * Float64(z + 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+63) || ~(((z * t) <= 2e+159))) tmp = t * (z + 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+63], N[Not[LessEqual[N[(z * t), $MachinePrecision], 2e+159]], $MachinePrecision]], N[(t * N[(z + 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^{+63} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+159}\right):\\
\;\;\;\;t \cdot \left(z + z\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000012e63 or 1.9999999999999999e159 < (*.f64 z t) Initial program 85.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6473.0
Applied rewrites73.0%
Applied rewrites73.0%
if -2.00000000000000012e63 < (*.f64 z t) < 1.9999999999999999e159Initial program 89.3%
Taylor expanded in x around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6439.9
Applied rewrites39.9%
Final simplification51.9%
(FPCore (x y z t a b c i) :precision binary64 (* t (+ z z)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return t * (z + 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 = t * (z + z)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return t * (z + z);
}
def code(x, y, z, t, a, b, c, i): return t * (z + z)
function code(x, y, z, t, a, b, c, i) return Float64(t * Float64(z + z)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = t * (z + z); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(t * N[(z + z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(z + z\right)
\end{array}
Initial program 87.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6431.4
Applied rewrites31.4%
Applied rewrites31.4%
(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 2024352
(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))))