
(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}
Herbie found 13 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 (* (- x) (fma c (/ (* (fma b c a) i) x) (- y)))))))
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 * (-x * fma(c, ((fma(b, c, a) * i) / x), -y));
}
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 * Float64(Float64(-x) * fma(c, Float64(Float64(fma(b, c, a) * i) / x), Float64(-y)))); 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[((-x) * N[(c * N[(N[(N[(b * c + a), $MachinePrecision] * i), $MachinePrecision] / x), $MachinePrecision] + (-y)), $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 \left(\left(-x\right) \cdot \mathsf{fma}\left(c, \frac{\mathsf{fma}\left(b, c, a\right) \cdot i}{x}, -y\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 94.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-*.f6498.4
Applied rewrites98.4%
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%
Taylor expanded in z around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6437.7
Applied rewrites37.7%
Taylor expanded in x around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6472.9
Applied rewrites72.9%
(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 (- c) (* (fma b c a) i) (* y x)))))))
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(-c, (fma(b, c, a) * i), (y * x)));
}
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, fma(Float64(-c), Float64(fma(b, c, a) * i), Float64(y * x)))); 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[((-c) * N[(N[(b * c + a), $MachinePrecision] * i), $MachinePrecision] + N[(y * x), $MachinePrecision]), $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, \mathsf{fma}\left(-c, \mathsf{fma}\left(b, c, a\right) \cdot i, y \cdot x\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 94.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-*.f6498.4
Applied rewrites98.4%
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-*.f6411.9
Applied rewrites11.9%
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate--l+N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
Applied rewrites48.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -2e+299)
(* 2.0 (- (* y x) (* (* (fma c b a) i) c)))
(if (<= t_1 20000000000000.0)
(* 2.0 (- (fma t z (* y x)) (* (* i c) a)))
(* 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 t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -2e+299) {
tmp = 2.0 * ((y * x) - ((fma(c, b, a) * i) * c));
} else if (t_1 <= 20000000000000.0) {
tmp = 2.0 * (fma(t, z, (y * x)) - ((i * c) * a));
} else {
tmp = 2.0 * ((t * z) - (fma(c, b, a) * (i * c)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= -2e+299) tmp = Float64(2.0 * Float64(Float64(y * x) - Float64(Float64(fma(c, b, a) * i) * c))); elseif (t_1 <= 20000000000000.0) tmp = Float64(2.0 * Float64(fma(t, z, Float64(y * x)) - Float64(Float64(i * c) * a))); 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_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+299], N[(2.0 * N[(N[(y * x), $MachinePrecision] - N[(N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 20000000000000.0], N[(2.0 * N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] - N[(N[(i * c), $MachinePrecision] * a), $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}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+299}:\\
\;\;\;\;2 \cdot \left(y \cdot x - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right)\\
\mathbf{elif}\;t\_1 \leq 20000000000000:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(i \cdot c\right) \cdot a\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) < -2.0000000000000001e299Initial program 75.1%
Taylor expanded in z around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.3
Applied rewrites88.3%
if -2.0000000000000001e299 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2e13Initial program 99.1%
Taylor expanded in b around 0
lower--.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6491.8
Applied rewrites91.8%
if 2e13 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 85.3%
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-*.f6491.6
Applied rewrites91.6%
Taylor expanded in x around 0
lift-*.f6483.1
Applied rewrites83.1%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* 2.0 (- (* y x) (* (* (fma c b a) i) c))))
(t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 -2e+299)
t_1
(if (<= t_2 2e+260) (* 2.0 (- (fma t z (* y x)) (* (* i c) a))) 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 * ((y * x) - ((fma(c, b, a) * i) * c));
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -2e+299) {
tmp = t_1;
} else if (t_2 <= 2e+260) {
tmp = 2.0 * (fma(t, z, (y * x)) - ((i * c) * a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * Float64(Float64(y * x) - 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+299) tmp = t_1; elseif (t_2 <= 2e+260) tmp = Float64(2.0 * Float64(fma(t, z, Float64(y * x)) - Float64(Float64(i * c) * a))); 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[(y * x), $MachinePrecision] - N[(N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+299], t$95$1, If[LessEqual[t$95$2, 2e+260], N[(2.0 * N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] - N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(y \cdot x - \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^{+299}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+260}:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(i \cdot c\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2.0000000000000001e299 or 2.00000000000000013e260 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 76.5%
Taylor expanded in z around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6486.5
Applied rewrites86.5%
if -2.0000000000000001e299 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000013e260Initial program 99.1%
Taylor expanded in b around 0
lower--.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6489.5
Applied rewrites89.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -1e+86)
(* 2.0 (- (* y x) (* (* (fma c b a) i) c)))
(if (<= t_1 5e+138)
(* 2.0 (fma t z (* y x)))
(* (* (* (fma b c a) c) i) -2.0)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -1e+86) {
tmp = 2.0 * ((y * x) - ((fma(c, b, a) * i) * c));
} else if (t_1 <= 5e+138) {
tmp = 2.0 * fma(t, z, (y * x));
} else {
tmp = ((fma(b, c, a) * c) * i) * -2.0;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= -1e+86) tmp = Float64(2.0 * Float64(Float64(y * x) - Float64(Float64(fma(c, b, a) * i) * c))); elseif (t_1 <= 5e+138) tmp = Float64(2.0 * fma(t, z, Float64(y * x))); else tmp = Float64(Float64(Float64(fma(b, c, a) * c) * i) * -2.0); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+86], N[(2.0 * N[(N[(y * x), $MachinePrecision] - N[(N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+138], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(b * c + a), $MachinePrecision] * c), $MachinePrecision] * i), $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 -1 \cdot 10^{+86}:\\
\;\;\;\;2 \cdot \left(y \cdot x - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+138}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(b, c, a\right) \cdot c\right) \cdot i\right) \cdot -2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1e86Initial program 82.2%
Taylor expanded in z around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6481.2
Applied rewrites81.2%
if -1e86 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.00000000000000016e138Initial program 99.0%
Taylor expanded in c around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.9
Applied rewrites85.9%
if 5.00000000000000016e138 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 81.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.7
Applied rewrites89.7%
Taylor expanded in i around inf
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f6478.3
Applied rewrites78.3%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -2e+299)
(* -2.0 (* (* (fma c b a) i) c))
(if (<= t_1 5e+138)
(* 2.0 (fma t z (* y x)))
(* (* (* (fma b c a) c) i) -2.0)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -2e+299) {
tmp = -2.0 * ((fma(c, b, a) * i) * c);
} else if (t_1 <= 5e+138) {
tmp = 2.0 * fma(t, z, (y * x));
} else {
tmp = ((fma(b, c, a) * c) * i) * -2.0;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= -2e+299) tmp = Float64(-2.0 * Float64(Float64(fma(c, b, a) * i) * c)); elseif (t_1 <= 5e+138) tmp = Float64(2.0 * fma(t, z, Float64(y * x))); else tmp = Float64(Float64(Float64(fma(b, c, a) * c) * i) * -2.0); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+299], N[(-2.0 * N[(N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+138], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(b * c + a), $MachinePrecision] * c), $MachinePrecision] * i), $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^{+299}:\\
\;\;\;\;-2 \cdot \left(\left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+138}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(b, c, a\right) \cdot c\right) \cdot i\right) \cdot -2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2.0000000000000001e299Initial program 75.1%
Taylor expanded in i around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.5
Applied rewrites88.5%
if -2.0000000000000001e299 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.00000000000000016e138Initial program 99.1%
Taylor expanded in c around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6480.3
Applied rewrites80.3%
if 5.00000000000000016e138 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 81.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.7
Applied rewrites89.7%
Taylor expanded in i around inf
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f6478.3
Applied rewrites78.3%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.3%
(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+299)
t_1
(if (<= t_2 5e+138) (* 2.0 (fma t z (* y x))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = -2.0 * ((fma(c, b, a) * i) * c);
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -2e+299) {
tmp = t_1;
} else if (t_2 <= 5e+138) {
tmp = 2.0 * fma(t, z, (y * x));
} 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+299) tmp = t_1; elseif (t_2 <= 5e+138) tmp = Float64(2.0 * fma(t, z, Float64(y * x))); 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+299], t$95$1, If[LessEqual[t$95$2, 5e+138], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $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^{+299}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+138}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2.0000000000000001e299 or 5.00000000000000016e138 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 79.0%
Taylor expanded in i around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6482.6
Applied rewrites82.6%
if -2.0000000000000001e299 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.00000000000000016e138Initial program 99.1%
Taylor expanded in c around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6480.3
Applied rewrites80.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (* (* c c) i) b) -2.0)) (t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 -2e+299)
t_1
(if (<= t_2 5e+279) (* 2.0 (fma t z (* y x))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((c * c) * i) * b) * -2.0;
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -2e+299) {
tmp = t_1;
} else if (t_2 <= 5e+279) {
tmp = 2.0 * fma(t, z, (y * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(c * c) * i) * b) * -2.0) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -2e+299) tmp = t_1; elseif (t_2 <= 5e+279) tmp = Float64(2.0 * fma(t, z, Float64(y * x))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(c * c), $MachinePrecision] * i), $MachinePrecision] * b), $MachinePrecision] * -2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+299], t$95$1, If[LessEqual[t$95$2, 5e+279], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot -2\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+299}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+279}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2.0000000000000001e299 or 5.0000000000000002e279 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 76.1%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6468.1
Applied rewrites68.1%
if -2.0000000000000001e299 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.0000000000000002e279Initial program 99.1%
Taylor expanded in c around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6476.6
Applied rewrites76.6%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (* 2.0 (fma t z (* y x)))) (t_2 (+ (* x y) (* z t)))) (if (<= t_2 -5e+48) t_1 (if (<= t_2 1e-22) (* (* (* i c) a) -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(t, z, (y * x));
double t_2 = (x * y) + (z * t);
double tmp;
if (t_2 <= -5e+48) {
tmp = t_1;
} else if (t_2 <= 1e-22) {
tmp = ((i * c) * a) * -2.0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * fma(t, z, Float64(y * x))) t_2 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (t_2 <= -5e+48) tmp = t_1; elseif (t_2 <= 1e-22) tmp = Float64(Float64(Float64(i * c) * a) * -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[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+48], t$95$1, If[LessEqual[t$95$2, 1e-22], N[(N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision] * -2.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
t_2 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{-22}:\\
\;\;\;\;\left(\left(i \cdot c\right) \cdot a\right) \cdot -2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -4.99999999999999973e48 or 1e-22 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 89.2%
Taylor expanded in c around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6465.2
Applied rewrites65.2%
if -4.99999999999999973e48 < (+.f64 (*.f64 x y) (*.f64 z t)) < 1e-22Initial program 93.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6437.0
Applied rewrites37.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* 2.0 (fma z t (fma (- c) (* (fma b c a) i) (* y x))))))
(if (<= c -8.6e-106)
t_1
(if (<= c 1e-183) (* 2.0 (- (fma t z (* y x)) (* (* i c) a))) 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(z, t, fma(-c, (fma(b, c, a) * i), (y * x)));
double tmp;
if (c <= -8.6e-106) {
tmp = t_1;
} else if (c <= 1e-183) {
tmp = 2.0 * (fma(t, z, (y * x)) - ((i * c) * a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * fma(z, t, fma(Float64(-c), Float64(fma(b, c, a) * i), Float64(y * x)))) tmp = 0.0 if (c <= -8.6e-106) tmp = t_1; elseif (c <= 1e-183) tmp = Float64(2.0 * Float64(fma(t, z, Float64(y * x)) - Float64(Float64(i * c) * a))); 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[(z * t + N[((-c) * N[(N[(b * c + a), $MachinePrecision] * i), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -8.6e-106], t$95$1, If[LessEqual[c, 1e-183], N[(2.0 * N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] - N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 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{if}\;c \leq -8.6 \cdot 10^{-106}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq 10^{-183}:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(i \cdot c\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -8.6000000000000004e-106 or 1.00000000000000001e-183 < c Initial program 87.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-*.f6493.1
Applied rewrites93.1%
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate--l+N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
Applied rewrites93.7%
if -8.6000000000000004e-106 < c < 1.00000000000000001e-183Initial program 98.5%
Taylor expanded in b around 0
lower--.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6496.2
Applied rewrites96.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma t z (* y x)))
(t_2 (* 2.0 (fma (- c) (* (fma c b a) i) t_1))))
(if (<= c -8.6e-106)
t_2
(if (<= c 1e-183) (* 2.0 (- t_1 (* (* i c) a))) t_2))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(t, z, (y * x));
double t_2 = 2.0 * fma(-c, (fma(c, b, a) * i), t_1);
double tmp;
if (c <= -8.6e-106) {
tmp = t_2;
} else if (c <= 1e-183) {
tmp = 2.0 * (t_1 - ((i * c) * a));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(t, z, Float64(y * x)) t_2 = Float64(2.0 * fma(Float64(-c), Float64(fma(c, b, a) * i), t_1)) tmp = 0.0 if (c <= -8.6e-106) tmp = t_2; elseif (c <= 1e-183) tmp = Float64(2.0 * Float64(t_1 - Float64(Float64(i * c) * a))); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[((-c) * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -8.6e-106], t$95$2, If[LessEqual[c, 1e-183], N[(2.0 * N[(t$95$1 - N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, z, y \cdot x\right)\\
t_2 := 2 \cdot \mathsf{fma}\left(-c, \mathsf{fma}\left(c, b, a\right) \cdot i, t\_1\right)\\
\mathbf{if}\;c \leq -8.6 \cdot 10^{-106}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;c \leq 10^{-183}:\\
\;\;\;\;2 \cdot \left(t\_1 - \left(i \cdot c\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if c < -8.6000000000000004e-106 or 1.00000000000000001e-183 < c Initial program 87.4%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6492.4
Applied rewrites92.4%
if -8.6000000000000004e-106 < c < 1.00000000000000001e-183Initial program 98.5%
Taylor expanded in b around 0
lower--.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6496.2
Applied rewrites96.2%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (* 2.0 (* y x)))) (if (<= (* x y) -5e+48) t_1 (if (<= (* x y) 2e-13) (* 2.0 (* t z)) 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 * (y * x);
double tmp;
if ((x * y) <= -5e+48) {
tmp = t_1;
} else if ((x * y) <= 2e-13) {
tmp = 2.0 * (t * z);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = 2.0d0 * (y * x)
if ((x * y) <= (-5d+48)) then
tmp = t_1
else if ((x * y) <= 2d-13) then
tmp = 2.0d0 * (t * z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = 2.0 * (y * x);
double tmp;
if ((x * y) <= -5e+48) {
tmp = t_1;
} else if ((x * y) <= 2e-13) {
tmp = 2.0 * (t * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = 2.0 * (y * x) tmp = 0 if (x * y) <= -5e+48: tmp = t_1 elif (x * y) <= 2e-13: tmp = 2.0 * (t * z) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * Float64(y * x)) tmp = 0.0 if (Float64(x * y) <= -5e+48) tmp = t_1; elseif (Float64(x * y) <= 2e-13) tmp = Float64(2.0 * Float64(t * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = 2.0 * (y * x); tmp = 0.0; if ((x * y) <= -5e+48) tmp = t_1; elseif ((x * y) <= 2e-13) tmp = 2.0 * (t * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -5e+48], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e-13], N[(2.0 * N[(t * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(y \cdot x\right)\\
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-13}:\\
\;\;\;\;2 \cdot \left(t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999973e48 or 2.0000000000000001e-13 < (*.f64 x y) Initial program 88.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6450.7
Applied rewrites50.7%
if -4.99999999999999973e48 < (*.f64 x y) < 2.0000000000000001e-13Initial program 92.3%
Taylor expanded in z around inf
lower-*.f6438.2
Applied rewrites38.2%
(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 90.4%
Taylor expanded in z around inf
lower-*.f6429.7
Applied rewrites29.7%
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(a + Float64(b * c)) * Float64(c * i)))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i))); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)
\end{array}
herbie shell --seed 2025096
(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))))