
(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 16 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
(let* ((t_1 (+ (* x y) (* z t))))
(if (<= (* 2.0 (- t_1 (* (* (+ a (* b c)) c) i))) INFINITY)
(* 2.0 (- t_1 (* (fma c b a) (* i c))))
(* 2.0 (fma z t (* (* (fma b c a) i) (- c)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) + (z * t);
double tmp;
if ((2.0 * (t_1 - (((a + (b * c)) * c) * i))) <= ((double) INFINITY)) {
tmp = 2.0 * (t_1 - (fma(c, b, a) * (i * c)));
} else {
tmp = 2.0 * fma(z, t, ((fma(b, c, a) * i) * -c));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (Float64(2.0 * Float64(t_1 - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) <= Inf) tmp = Float64(2.0 * Float64(t_1 - Float64(fma(c, b, a) * Float64(i * c)))); else tmp = Float64(2.0 * fma(z, t, Float64(Float64(fma(b, c, a) * i) * Float64(-c)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(2.0 * N[(t$95$1 - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(2.0 * N[(t$95$1 - N[(N[(c * b + a), $MachinePrecision] * N[(i * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * t + N[(N[(N[(b * c + a), $MachinePrecision] * i), $MachinePrecision] * (-c)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;2 \cdot \left(t\_1 - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \leq \infty:\\
\;\;\;\;2 \cdot \left(t\_1 - \mathsf{fma}\left(c, b, a\right) \cdot \left(i \cdot c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(z, t, \left(\mathsf{fma}\left(b, c, a\right) \cdot i\right) \cdot \left(-c\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 92.4%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.7
Applied rewrites98.7%
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
lift-+.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f646.3
Applied rewrites6.3%
Applied rewrites43.8%
Taylor expanded in x around 0
Applied rewrites75.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* -2.0 (* (* (fma c b a) i) c))) (t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 -2e+62)
t_1
(if (<= t_2 1e+77)
(* 2.0 (fma t z (* y x)))
(if (<= t_2 5e+300) (* (* (* (fma b c a) c) i) -2.0) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = -2.0 * ((fma(c, b, a) * i) * c);
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -2e+62) {
tmp = t_1;
} else if (t_2 <= 1e+77) {
tmp = 2.0 * fma(t, z, (y * x));
} else if (t_2 <= 5e+300) {
tmp = ((fma(b, c, a) * c) * i) * -2.0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(-2.0 * Float64(Float64(fma(c, b, a) * i) * c)) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -2e+62) tmp = t_1; elseif (t_2 <= 1e+77) tmp = Float64(2.0 * fma(t, z, Float64(y * x))); elseif (t_2 <= 5e+300) tmp = Float64(Float64(Float64(fma(b, c, a) * c) * i) * -2.0); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(-2.0 * N[(N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+62], t$95$1, If[LessEqual[t$95$2, 1e+77], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+300], N[(N[(N[(N[(b * c + a), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision] * -2.0), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -2 \cdot \left(\left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right)\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+77}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+300}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(b, c, a\right) \cdot c\right) \cdot i\right) \cdot -2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2.00000000000000007e62 or 5.00000000000000026e300 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 74.4%
Taylor expanded in i around inf
Applied rewrites86.6%
if -2.00000000000000007e62 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.99999999999999983e76Initial program 97.2%
Taylor expanded in c around 0
Applied rewrites90.2%
if 9.99999999999999983e76 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.00000000000000026e300Initial program 99.6%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in i around inf
Applied rewrites44.6%
Applied rewrites78.8%
Final simplification87.6%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -2e+62) (not (<= t_1 1e+77)))
(* 2.0 (- (* t z) (* (fma c b a) (* i c))))
(* 2.0 (- (fma t z (* y x)) (* (* i c) a))))))
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 <= -2e+62) || !(t_1 <= 1e+77)) {
tmp = 2.0 * ((t * z) - (fma(c, b, a) * (i * c)));
} else {
tmp = 2.0 * (fma(t, z, (y * x)) - ((i * c) * a));
}
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 <= -2e+62) || !(t_1 <= 1e+77)) tmp = Float64(2.0 * Float64(Float64(t * z) - Float64(fma(c, b, a) * Float64(i * c)))); else tmp = Float64(2.0 * Float64(fma(t, z, Float64(y * x)) - Float64(Float64(i * c) * a))); 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, -2e+62], N[Not[LessEqual[t$95$1, 1e+77]], $MachinePrecision]], N[(2.0 * N[(N[(t * z), $MachinePrecision] - N[(N[(c * b + a), $MachinePrecision] * N[(i * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] - N[(N[(i * c), $MachinePrecision] * a), $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 -2 \cdot 10^{+62} \lor \neg \left(t\_1 \leq 10^{+77}\right):\\
\;\;\;\;2 \cdot \left(t \cdot z - \mathsf{fma}\left(c, b, a\right) \cdot \left(i \cdot c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(i \cdot c\right) \cdot a\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2.00000000000000007e62 or 9.99999999999999983e76 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 77.8%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6488.5
Applied rewrites88.5%
Taylor expanded in x around 0
Applied rewrites91.5%
if -2.00000000000000007e62 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.99999999999999983e76Initial program 97.2%
Taylor expanded in b around 0
Applied rewrites95.9%
Final simplification93.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -2e+62)
(* 2.0 (- (* t z) (* (* (fma c b a) i) c)))
(if (<= t_1 1e+77)
(* 2.0 (- (fma t z (* y x)) (* (* i c) a)))
(* (* (fma c b a) (* i c)) -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 <= -2e+62) {
tmp = 2.0 * ((t * z) - ((fma(c, b, a) * i) * c));
} else if (t_1 <= 1e+77) {
tmp = 2.0 * (fma(t, z, (y * x)) - ((i * c) * a));
} else {
tmp = (fma(c, b, a) * (i * c)) * -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 <= -2e+62) tmp = Float64(2.0 * Float64(Float64(t * z) - Float64(Float64(fma(c, b, a) * i) * c))); elseif (t_1 <= 1e+77) tmp = Float64(2.0 * Float64(fma(t, z, Float64(y * x)) - Float64(Float64(i * c) * a))); else tmp = Float64(Float64(fma(c, b, a) * Float64(i * c)) * -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, -2e+62], N[(2.0 * N[(N[(t * z), $MachinePrecision] - N[(N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+77], N[(2.0 * N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] - N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(c * b + a), $MachinePrecision] * N[(i * c), $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 -2 \cdot 10^{+62}:\\
\;\;\;\;2 \cdot \left(t \cdot z - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+77}:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(i \cdot c\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(c, b, a\right) \cdot \left(i \cdot c\right)\right) \cdot -2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2.00000000000000007e62Initial program 80.5%
Taylor expanded in x around 0
Applied rewrites85.7%
if -2.00000000000000007e62 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.99999999999999983e76Initial program 97.2%
Taylor expanded in b around 0
Applied rewrites95.9%
if 9.99999999999999983e76 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 74.8%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.2
Applied rewrites89.2%
Taylor expanded in i around inf
Applied rewrites82.3%
Applied rewrites79.5%
Applied rewrites92.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -2e+62) (not (<= t_1 1e+77)))
(* (* (fma c b a) (* i c)) -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 <= -2e+62) || !(t_1 <= 1e+77)) {
tmp = (fma(c, b, a) * (i * c)) * -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 <= -2e+62) || !(t_1 <= 1e+77)) tmp = Float64(Float64(fma(c, b, a) * Float64(i * c)) * -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, -2e+62], N[Not[LessEqual[t$95$1, 1e+77]], $MachinePrecision]], N[(N[(N[(c * b + a), $MachinePrecision] * N[(i * c), $MachinePrecision]), $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 -2 \cdot 10^{+62} \lor \neg \left(t\_1 \leq 10^{+77}\right):\\
\;\;\;\;\left(\mathsf{fma}\left(c, b, a\right) \cdot \left(i \cdot c\right)\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) < -2.00000000000000007e62 or 9.99999999999999983e76 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 77.8%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6488.5
Applied rewrites88.5%
Taylor expanded in i around inf
Applied rewrites80.8%
Applied rewrites78.6%
Applied rewrites88.0%
if -2.00000000000000007e62 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.99999999999999983e76Initial program 97.2%
Taylor expanded in c around 0
Applied rewrites90.2%
Final simplification89.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -2e+62) (not (<= t_1 1e+77)))
(* -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 <= -2e+62) || !(t_1 <= 1e+77)) {
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 <= -2e+62) || !(t_1 <= 1e+77)) tmp = Float64(-2.0 * Float64(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, -2e+62], N[Not[LessEqual[t$95$1, 1e+77]], $MachinePrecision]], N[(-2.0 * N[(N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] * 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 -2 \cdot 10^{+62} \lor \neg \left(t\_1 \leq 10^{+77}\right):\\
\;\;\;\;-2 \cdot \left(\left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \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) < -2.00000000000000007e62 or 9.99999999999999983e76 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 77.8%
Taylor expanded in i around inf
Applied rewrites80.8%
if -2.00000000000000007e62 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.99999999999999983e76Initial program 97.2%
Taylor expanded in c around 0
Applied rewrites90.2%
Final simplification85.1%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -2e+62)
(* 2.0 (- (* t z) (* (* (fma c b a) i) c)))
(if (<= t_1 1e+77)
(* 2.0 (fma t z (* y x)))
(* (* (fma c b a) (* i c)) -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 <= -2e+62) {
tmp = 2.0 * ((t * z) - ((fma(c, b, a) * i) * c));
} else if (t_1 <= 1e+77) {
tmp = 2.0 * fma(t, z, (y * x));
} else {
tmp = (fma(c, b, a) * (i * c)) * -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 <= -2e+62) tmp = Float64(2.0 * Float64(Float64(t * z) - Float64(Float64(fma(c, b, a) * i) * c))); elseif (t_1 <= 1e+77) tmp = Float64(2.0 * fma(t, z, Float64(y * x))); else tmp = Float64(Float64(fma(c, b, a) * Float64(i * c)) * -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, -2e+62], N[(2.0 * N[(N[(t * z), $MachinePrecision] - N[(N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+77], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(c * b + a), $MachinePrecision] * N[(i * c), $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 -2 \cdot 10^{+62}:\\
\;\;\;\;2 \cdot \left(t \cdot z - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+77}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(c, b, a\right) \cdot \left(i \cdot c\right)\right) \cdot -2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2.00000000000000007e62Initial program 80.5%
Taylor expanded in x around 0
Applied rewrites85.7%
if -2.00000000000000007e62 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.99999999999999983e76Initial program 97.2%
Taylor expanded in c around 0
Applied rewrites90.2%
if 9.99999999999999983e76 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 74.8%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.2
Applied rewrites89.2%
Taylor expanded in i around inf
Applied rewrites82.3%
Applied rewrites79.5%
Applied rewrites92.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -2e+62) (not (<= t_1 1e+77)))
(* (* (* c (* i c)) 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 <= -2e+62) || !(t_1 <= 1e+77)) {
tmp = ((c * (i * c)) * 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 <= -2e+62) || !(t_1 <= 1e+77)) tmp = Float64(Float64(Float64(c * Float64(i * c)) * 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, -2e+62], N[Not[LessEqual[t$95$1, 1e+77]], $MachinePrecision]], N[(N[(N[(c * N[(i * c), $MachinePrecision]), $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 -2 \cdot 10^{+62} \lor \neg \left(t\_1 \leq 10^{+77}\right):\\
\;\;\;\;\left(\left(c \cdot \left(i \cdot c\right)\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) < -2.00000000000000007e62 or 9.99999999999999983e76 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 77.8%
Taylor expanded in b around inf
Applied rewrites54.4%
Applied rewrites59.1%
if -2.00000000000000007e62 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.99999999999999983e76Initial program 97.2%
Taylor expanded in c around 0
Applied rewrites90.2%
Final simplification73.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -2e+198) (not (<= t_1 2e+174)))
(* (* (* b (* c c)) i) -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 <= -2e+198) || !(t_1 <= 2e+174)) {
tmp = ((b * (c * c)) * i) * -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 <= -2e+198) || !(t_1 <= 2e+174)) tmp = Float64(Float64(Float64(b * Float64(c * c)) * i) * -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, -2e+198], N[Not[LessEqual[t$95$1, 2e+174]], $MachinePrecision]], N[(N[(N[(b * N[(c * c), $MachinePrecision]), $MachinePrecision] * i), $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 -2 \cdot 10^{+198} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+174}\right):\\
\;\;\;\;\left(\left(b \cdot \left(c \cdot c\right)\right) \cdot i\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) < -2.00000000000000004e198 or 2.00000000000000014e174 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 73.9%
Taylor expanded in b around inf
Applied rewrites60.4%
Applied rewrites59.6%
if -2.00000000000000004e198 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000014e174Initial program 97.6%
Taylor expanded in c around 0
Applied rewrites80.7%
Final simplification71.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -2e+62)
(* (* (* c (* i c)) b) -2.0)
(if (<= t_1 1e+77)
(* 2.0 (fma t z (* y x)))
(* (* -2.0 c) (* (* i c) b))))))
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 <= -2e+62) {
tmp = ((c * (i * c)) * b) * -2.0;
} else if (t_1 <= 1e+77) {
tmp = 2.0 * fma(t, z, (y * x));
} else {
tmp = (-2.0 * c) * ((i * c) * b);
}
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 <= -2e+62) tmp = Float64(Float64(Float64(c * Float64(i * c)) * b) * -2.0); elseif (t_1 <= 1e+77) tmp = Float64(2.0 * fma(t, z, Float64(y * x))); else tmp = Float64(Float64(-2.0 * c) * Float64(Float64(i * c) * b)); 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, -2e+62], N[(N[(N[(c * N[(i * c), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision] * -2.0), $MachinePrecision], If[LessEqual[t$95$1, 1e+77], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * c), $MachinePrecision] * N[(N[(i * c), $MachinePrecision] * b), $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 -2 \cdot 10^{+62}:\\
\;\;\;\;\left(\left(c \cdot \left(i \cdot c\right)\right) \cdot b\right) \cdot -2\\
\mathbf{elif}\;t\_1 \leq 10^{+77}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot c\right) \cdot \left(\left(i \cdot c\right) \cdot b\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2.00000000000000007e62Initial program 80.5%
Taylor expanded in b around inf
Applied rewrites53.6%
Applied rewrites57.4%
if -2.00000000000000007e62 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.99999999999999983e76Initial program 97.2%
Taylor expanded in c around 0
Applied rewrites90.2%
if 9.99999999999999983e76 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 74.8%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.2
Applied rewrites89.2%
Taylor expanded in i around inf
Applied rewrites82.3%
Taylor expanded in a around 0
Applied rewrites62.5%
Final simplification73.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -2e+198)
(* (* (* b (* c c)) i) -2.0)
(if (<= t_1 2e+174)
(* 2.0 (fma t z (* y x)))
(* (* (* c c) (* i b)) -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 <= -2e+198) {
tmp = ((b * (c * c)) * i) * -2.0;
} else if (t_1 <= 2e+174) {
tmp = 2.0 * fma(t, z, (y * x));
} else {
tmp = ((c * c) * (i * b)) * -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 <= -2e+198) tmp = Float64(Float64(Float64(b * Float64(c * c)) * i) * -2.0); elseif (t_1 <= 2e+174) tmp = Float64(2.0 * fma(t, z, Float64(y * x))); else tmp = Float64(Float64(Float64(c * c) * Float64(i * b)) * -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, -2e+198], N[(N[(N[(b * N[(c * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision] * -2.0), $MachinePrecision], If[LessEqual[t$95$1, 2e+174], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(c * c), $MachinePrecision] * N[(i * b), $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 -2 \cdot 10^{+198}:\\
\;\;\;\;\left(\left(b \cdot \left(c \cdot c\right)\right) \cdot i\right) \cdot -2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+174}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(c \cdot c\right) \cdot \left(i \cdot b\right)\right) \cdot -2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2.00000000000000004e198Initial program 76.8%
Taylor expanded in b around inf
Applied rewrites58.9%
Applied rewrites57.4%
if -2.00000000000000004e198 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000014e174Initial program 97.6%
Taylor expanded in c around 0
Applied rewrites80.7%
if 2.00000000000000014e174 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 70.8%
Taylor expanded in b around inf
Applied rewrites62.1%
Applied rewrites63.6%
Final simplification71.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -2e+140) (not (<= t_1 2e+282)))
(* (* (* 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 t_1 = ((a + (b * c)) * c) * i;
double tmp;
if ((t_1 <= -2e+140) || !(t_1 <= 2e+282)) {
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) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if ((t_1 <= -2e+140) || !(t_1 <= 2e+282)) 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_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+140], N[Not[LessEqual[t$95$1, 2e+282]], $MachinePrecision]], 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}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+140} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+282}\right):\\
\;\;\;\;\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) < -2.00000000000000012e140 or 2.00000000000000007e282 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 74.3%
Taylor expanded in a around inf
Applied rewrites45.8%
if -2.00000000000000012e140 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000007e282Initial program 97.5%
Taylor expanded in c around 0
Applied rewrites81.7%
Final simplification64.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -2e+134) (not (<= t_1 2e+149)))
(* (* (* i c) a) -2.0)
(* 2.0 (* 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 <= -2e+134) || !(t_1 <= 2e+149)) {
tmp = ((i * c) * a) * -2.0;
} 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) :: t_1
real(8) :: tmp
t_1 = ((a + (b * c)) * c) * i
if ((t_1 <= (-2d+134)) .or. (.not. (t_1 <= 2d+149))) then
tmp = ((i * c) * a) * (-2.0d0)
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 t_1 = ((a + (b * c)) * c) * i;
double tmp;
if ((t_1 <= -2e+134) || !(t_1 <= 2e+149)) {
tmp = ((i * c) * a) * -2.0;
} else {
tmp = 2.0 * (y * x);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = ((a + (b * c)) * c) * i tmp = 0 if (t_1 <= -2e+134) or not (t_1 <= 2e+149): tmp = ((i * c) * a) * -2.0 else: tmp = 2.0 * (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 <= -2e+134) || !(t_1 <= 2e+149)) tmp = Float64(Float64(Float64(i * c) * a) * -2.0); else tmp = Float64(2.0 * Float64(y * x)); 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 <= -2e+134) || ~((t_1 <= 2e+149))) tmp = ((i * c) * a) * -2.0; else tmp = 2.0 * (y * x); 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[Or[LessEqual[t$95$1, -2e+134], N[Not[LessEqual[t$95$1, 2e+149]], $MachinePrecision]], N[(N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision] * -2.0), $MachinePrecision], N[(2.0 * N[(y * x), $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 -2 \cdot 10^{+134} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+149}\right):\\
\;\;\;\;\left(\left(i \cdot c\right) \cdot a\right) \cdot -2\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1.99999999999999984e134 or 2.0000000000000001e149 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 75.9%
Taylor expanded in a around inf
Applied rewrites44.6%
if -1.99999999999999984e134 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.0000000000000001e149Initial program 97.4%
Taylor expanded in x around inf
Applied rewrites49.8%
Final simplification47.2%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* (* (+ a (* b c)) c) i) 1e+77) (* 2.0 (fma z t (fma (- c) (* (fma b c a) i) (* y x)))) (* 2.0 (- (* t z) (* (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 tmp;
if ((((a + (b * c)) * c) * i) <= 1e+77) {
tmp = 2.0 * fma(z, t, fma(-c, (fma(b, c, a) * i), (y * x)));
} else {
tmp = 2.0 * ((t * z) - (fma(c, b, a) * (i * c)));
}
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+77) tmp = Float64(2.0 * fma(z, t, fma(Float64(-c), Float64(fma(b, c, a) * i), Float64(y * x)))); else tmp = Float64(2.0 * Float64(Float64(t * z) - Float64(fma(c, b, a) * Float64(i * c)))); 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+77], N[(2.0 * N[(z * t + N[((-c) * N[(N[(b * c + a), $MachinePrecision] * i), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(t * z), $MachinePrecision] - N[(N[(c * b + a), $MachinePrecision] * N[(i * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i \leq 10^{+77}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(z, t, \mathsf{fma}\left(-c, \mathsf{fma}\left(b, c, a\right) \cdot i, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t \cdot z - \mathsf{fma}\left(c, b, a\right) \cdot \left(i \cdot c\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.99999999999999983e76Initial program 90.7%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6494.2
Applied rewrites94.2%
Applied rewrites93.9%
if 9.99999999999999983e76 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 74.8%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.2
Applied rewrites89.2%
Taylor expanded in x around 0
Applied rewrites94.0%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* z t) -2e+199) (not (<= (* z t) 2e+93))) (* 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+199) || !((z * t) <= 2e+93)) {
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+199)) .or. (.not. ((z * t) <= 2d+93))) 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+199) || !((z * t) <= 2e+93)) {
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+199) or not ((z * t) <= 2e+93): 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+199) || !(Float64(z * t) <= 2e+93)) 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+199) || ~(((z * t) <= 2e+93))) 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+199], N[Not[LessEqual[N[(z * t), $MachinePrecision], 2e+93]], $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^{+199} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+93}\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.00000000000000019e199 or 2.00000000000000009e93 < (*.f64 z t) Initial program 84.7%
Taylor expanded in z around inf
Applied rewrites66.3%
if -2.00000000000000019e199 < (*.f64 z t) < 2.00000000000000009e93Initial program 87.5%
Taylor expanded in x around inf
Applied rewrites37.8%
Final simplification46.4%
(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 86.7%
Taylor expanded in z around inf
Applied rewrites27.2%
(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 2025026
(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))))