
(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 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 (if (<= (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))) INFINITY) (* 2.0 (fma (fma c b a) (* (- i) c) (fma t z (* y x)))) (* 2.0 (fma y x (fma (* (* i c) b) (- c) (* z t))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))) <= ((double) INFINITY)) {
tmp = 2.0 * fma(fma(c, b, a), (-i * c), fma(t, z, (y * x)));
} else {
tmp = 2.0 * fma(y, x, fma(((i * c) * b), -c, (z * t)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) <= Inf) tmp = Float64(2.0 * fma(fma(c, b, a), Float64(Float64(-i) * c), fma(t, z, Float64(y * x)))); else tmp = Float64(2.0 * fma(y, x, fma(Float64(Float64(i * c) * b), Float64(-c), Float64(z * t)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(2.0 * N[(N[(c * b + a), $MachinePrecision] * N[((-i) * c), $MachinePrecision] + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(y * x + N[(N[(N[(i * c), $MachinePrecision] * b), $MachinePrecision] * (-c) + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \leq \infty:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(c, b, a\right), \left(-i\right) \cdot c, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(y, x, \mathsf{fma}\left(\left(i \cdot c\right) \cdot b, -c, z \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 #s(literal 2 binary64) (-.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i))) < +inf.0Initial program 93.8%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6498.0
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6498.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.0
Applied rewrites98.0%
if +inf.0 < (*.f64 #s(literal 2 binary64) (-.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i))) Initial program 0.0%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6428.6
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6428.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6428.6
Applied rewrites28.6%
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6471.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.4
Applied rewrites71.4%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.6
Applied rewrites78.6%
Final simplification96.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (* i c) a) -2.0)) (t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 -1e+153)
t_1
(if (<= t_2 -5e-58)
(* t (+ z z))
(if (<= t_2 1e+113) (* 2.0 (* y x)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((i * c) * a) * -2.0;
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -1e+153) {
tmp = t_1;
} else if (t_2 <= -5e-58) {
tmp = t * (z + z);
} else if (t_2 <= 1e+113) {
tmp = 2.0 * (y * x);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ((i * c) * a) * (-2.0d0)
t_2 = ((a + (b * c)) * c) * i
if (t_2 <= (-1d+153)) then
tmp = t_1
else if (t_2 <= (-5d-58)) then
tmp = t * (z + z)
else if (t_2 <= 1d+113) then
tmp = 2.0d0 * (y * x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((i * c) * a) * -2.0;
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -1e+153) {
tmp = t_1;
} else if (t_2 <= -5e-58) {
tmp = t * (z + z);
} else if (t_2 <= 1e+113) {
tmp = 2.0 * (y * x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = ((i * c) * a) * -2.0 t_2 = ((a + (b * c)) * c) * i tmp = 0 if t_2 <= -1e+153: tmp = t_1 elif t_2 <= -5e-58: tmp = t * (z + z) elif t_2 <= 1e+113: tmp = 2.0 * (y * x) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(i * c) * a) * -2.0) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -1e+153) tmp = t_1; elseif (t_2 <= -5e-58) tmp = Float64(t * Float64(z + z)); elseif (t_2 <= 1e+113) tmp = Float64(2.0 * Float64(y * x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = ((i * c) * a) * -2.0; t_2 = ((a + (b * c)) * c) * i; tmp = 0.0; if (t_2 <= -1e+153) tmp = t_1; elseif (t_2 <= -5e-58) tmp = t * (z + z); elseif (t_2 <= 1e+113) tmp = 2.0 * (y * x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision] * -2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+153], t$95$1, If[LessEqual[t$95$2, -5e-58], N[(t * N[(z + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+113], N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(i \cdot c\right) \cdot a\right) \cdot -2\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+153}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-58}:\\
\;\;\;\;t \cdot \left(z + z\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+113}:\\
\;\;\;\;2 \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1e153 or 1e113 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 80.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6444.8
Applied rewrites44.8%
if -1e153 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4.99999999999999977e-58Initial program 100.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6466.6
Applied rewrites66.6%
Applied rewrites66.6%
if -4.99999999999999977e-58 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1e113Initial program 98.8%
Taylor expanded in x around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.8
Applied rewrites49.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -1e+236) (not (<= t_1 1e+279)))
(* 2.0 (fma y x (* (- c) (* (fma c b a) i))))
(* 2.0 (fma (- a) (* i c) (fma x y (* z t)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if ((t_1 <= -1e+236) || !(t_1 <= 1e+279)) {
tmp = 2.0 * fma(y, x, (-c * (fma(c, b, a) * i)));
} else {
tmp = 2.0 * fma(-a, (i * c), fma(x, y, (z * t)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if ((t_1 <= -1e+236) || !(t_1 <= 1e+279)) tmp = Float64(2.0 * fma(y, x, Float64(Float64(-c) * Float64(fma(c, b, a) * i)))); else tmp = Float64(2.0 * fma(Float64(-a), Float64(i * c), fma(x, y, Float64(z * t)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+236], N[Not[LessEqual[t$95$1, 1e+279]], $MachinePrecision]], N[(2.0 * N[(y * x + N[((-c) * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[((-a) * N[(i * c), $MachinePrecision] + N[(x * y + N[(z * t), $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 -1 \cdot 10^{+236} \lor \neg \left(t\_1 \leq 10^{+279}\right):\\
\;\;\;\;2 \cdot \mathsf{fma}\left(y, x, \left(-c\right) \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-a, i \cdot c, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1.00000000000000005e236 or 1.00000000000000006e279 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 76.2%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6489.5
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6489.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6489.5
Applied rewrites89.5%
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6492.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6492.4
Applied rewrites92.4%
Taylor expanded in z around 0
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6492.4
Applied rewrites92.4%
if -1.00000000000000005e236 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.00000000000000006e279Initial program 98.5%
Taylor expanded in a around inf
mul-1-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6418.1
Applied rewrites18.1%
Taylor expanded in b around 0
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
mul-1-negN/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
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6493.4
Applied rewrites93.4%
Final simplification92.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+138) (not (<= t_1 1e+279)))
(* (* (* i c) (fma c b a)) -2.0)
(* 2.0 (fma (- a) (* i c) (fma x y (* z t)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if ((t_1 <= -2e+138) || !(t_1 <= 1e+279)) {
tmp = ((i * c) * fma(c, b, a)) * -2.0;
} else {
tmp = 2.0 * fma(-a, (i * c), fma(x, y, (z * t)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if ((t_1 <= -2e+138) || !(t_1 <= 1e+279)) tmp = Float64(Float64(Float64(i * c) * fma(c, b, a)) * -2.0); else tmp = Float64(2.0 * fma(Float64(-a), Float64(i * c), fma(x, y, Float64(z * t)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+138], N[Not[LessEqual[t$95$1, 1e+279]], $MachinePrecision]], N[(N[(N[(i * c), $MachinePrecision] * N[(c * b + a), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision], N[(2.0 * N[((-a) * N[(i * c), $MachinePrecision] + N[(x * y + N[(z * t), $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^{+138} \lor \neg \left(t\_1 \leq 10^{+279}\right):\\
\;\;\;\;\left(\left(i \cdot c\right) \cdot \mathsf{fma}\left(c, b, a\right)\right) \cdot -2\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-a, i \cdot c, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2.0000000000000001e138 or 1.00000000000000006e279 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 78.6%
Taylor expanded in i around inf
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
distribute-lft-outN/A
lower-*.f64N/A
distribute-lft-outN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6483.3
Applied rewrites83.3%
Applied rewrites87.9%
if -2.0000000000000001e138 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.00000000000000006e279Initial program 98.4%
Taylor expanded in a around inf
mul-1-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6414.9
Applied rewrites14.9%
Taylor expanded in b around 0
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
mul-1-negN/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
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6496.4
Applied rewrites96.4%
Final simplification92.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -2e+138) (not (<= t_1 1e+256)))
(* (* (* i c) (fma c b 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+138) || !(t_1 <= 1e+256)) {
tmp = ((i * c) * fma(c, b, 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+138) || !(t_1 <= 1e+256)) tmp = Float64(Float64(Float64(i * c) * fma(c, b, 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+138], N[Not[LessEqual[t$95$1, 1e+256]], $MachinePrecision]], N[(N[(N[(i * c), $MachinePrecision] * N[(c * b + a), $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^{+138} \lor \neg \left(t\_1 \leq 10^{+256}\right):\\
\;\;\;\;\left(\left(i \cdot c\right) \cdot \mathsf{fma}\left(c, b, a\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.0000000000000001e138 or 1e256 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 79.1%
Taylor expanded in i around inf
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
distribute-lft-outN/A
lower-*.f64N/A
distribute-lft-outN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6482.2
Applied rewrites82.2%
Applied rewrites87.4%
if -2.0000000000000001e138 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1e256Initial program 98.4%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6483.7
Applied rewrites83.7%
Final simplification85.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+138) (not (<= t_1 2e+205)))
(* (* -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+138) || !(t_1 <= 2e+205)) {
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+138) || !(t_1 <= 2e+205)) tmp = Float64(Float64(-2.0 * Float64(fma(c, b, a) * i)) * c); else tmp = Float64(2.0 * fma(t, z, Float64(y * x))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+138], N[Not[LessEqual[t$95$1, 2e+205]], $MachinePrecision]], N[(N[(-2.0 * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+138} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+205}\right):\\
\;\;\;\;\left(-2 \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right)\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2.0000000000000001e138 or 2.00000000000000003e205 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 79.9%
Taylor expanded in i around inf
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
distribute-lft-outN/A
lower-*.f64N/A
distribute-lft-outN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6482.2
Applied rewrites82.2%
if -2.0000000000000001e138 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000003e205Initial program 98.3%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6484.6
Applied rewrites84.6%
Final simplification83.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+138) (not (<= t_1 1e+279)))
(* (* -2.0 (* (* i c) b)) c)
(* 2.0 (fma t z (* y x))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if ((t_1 <= -2e+138) || !(t_1 <= 1e+279)) {
tmp = (-2.0 * ((i * c) * b)) * c;
} else {
tmp = 2.0 * fma(t, z, (y * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if ((t_1 <= -2e+138) || !(t_1 <= 1e+279)) tmp = Float64(Float64(-2.0 * Float64(Float64(i * c) * b)) * c); else tmp = Float64(2.0 * fma(t, z, Float64(y * x))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+138], N[Not[LessEqual[t$95$1, 1e+279]], $MachinePrecision]], N[(N[(-2.0 * N[(N[(i * c), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+138} \lor \neg \left(t\_1 \leq 10^{+279}\right):\\
\;\;\;\;\left(-2 \cdot \left(\left(i \cdot c\right) \cdot b\right)\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2.0000000000000001e138 or 1.00000000000000006e279 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 78.6%
Taylor expanded in i around inf
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
distribute-lft-outN/A
lower-*.f64N/A
distribute-lft-outN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6483.3
Applied rewrites83.3%
Taylor expanded in a around 0
Applied rewrites63.7%
if -2.0000000000000001e138 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.00000000000000006e279Initial program 98.4%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6482.5
Applied rewrites82.5%
Final simplification73.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -2e+138)
(* (* -2.0 (* (* i c) b)) c)
(if (<= t_1 1e+279)
(* 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+138) {
tmp = (-2.0 * ((i * c) * b)) * c;
} else if (t_1 <= 1e+279) {
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+138) tmp = Float64(Float64(-2.0 * Float64(Float64(i * c) * b)) * c); elseif (t_1 <= 1e+279) tmp = Float64(2.0 * fma(t, z, Float64(y * x))); else tmp = Float64(Float64(Float64(Float64(c * c) * 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+138], N[(N[(-2.0 * N[(N[(i * c), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[t$95$1, 1e+279], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(c * c), $MachinePrecision] * i), $MachinePrecision] * b), $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^{+138}:\\
\;\;\;\;\left(-2 \cdot \left(\left(i \cdot c\right) \cdot b\right)\right) \cdot c\\
\mathbf{elif}\;t\_1 \leq 10^{+279}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot -2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -2.0000000000000001e138Initial program 82.9%
Taylor expanded in i around inf
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
distribute-lft-outN/A
lower-*.f64N/A
distribute-lft-outN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6478.3
Applied rewrites78.3%
Taylor expanded in a around 0
Applied rewrites60.3%
if -2.0000000000000001e138 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.00000000000000006e279Initial program 98.4%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6482.5
Applied rewrites82.5%
if 1.00000000000000006e279 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 73.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6467.5
Applied rewrites67.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -1e+153) (not (<= t_1 1e+256)))
(* (* (* 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 <= -1e+153) || !(t_1 <= 1e+256)) {
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 <= -1e+153) || !(t_1 <= 1e+256)) 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, -1e+153], N[Not[LessEqual[t$95$1, 1e+256]], $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 -1 \cdot 10^{+153} \lor \neg \left(t\_1 \leq 10^{+256}\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) < -1e153 or 1e256 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 78.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6446.8
Applied rewrites46.8%
if -1e153 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1e256Initial program 98.4%
Taylor expanded in c around 0
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6482.5
Applied rewrites82.5%
Final simplification64.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* t (+ z z))))
(if (<= (* z t) -4e+69)
t_1
(if (<= (* z t) 5e-165)
(* 2.0 (* y x))
(if (<= (* z t) 2e+162) (* (* -2.0 (* i a)) c) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = t * (z + z);
double tmp;
if ((z * t) <= -4e+69) {
tmp = t_1;
} else if ((z * t) <= 5e-165) {
tmp = 2.0 * (y * x);
} else if ((z * t) <= 2e+162) {
tmp = (-2.0 * (i * a)) * c;
} 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 = t * (z + z)
if ((z * t) <= (-4d+69)) then
tmp = t_1
else if ((z * t) <= 5d-165) then
tmp = 2.0d0 * (y * x)
else if ((z * t) <= 2d+162) then
tmp = ((-2.0d0) * (i * a)) * c
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 = t * (z + z);
double tmp;
if ((z * t) <= -4e+69) {
tmp = t_1;
} else if ((z * t) <= 5e-165) {
tmp = 2.0 * (y * x);
} else if ((z * t) <= 2e+162) {
tmp = (-2.0 * (i * a)) * c;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = t * (z + z) tmp = 0 if (z * t) <= -4e+69: tmp = t_1 elif (z * t) <= 5e-165: tmp = 2.0 * (y * x) elif (z * t) <= 2e+162: tmp = (-2.0 * (i * a)) * c else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(t * Float64(z + z)) tmp = 0.0 if (Float64(z * t) <= -4e+69) tmp = t_1; elseif (Float64(z * t) <= 5e-165) tmp = Float64(2.0 * Float64(y * x)); elseif (Float64(z * t) <= 2e+162) tmp = Float64(Float64(-2.0 * Float64(i * a)) * c); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = t * (z + z); tmp = 0.0; if ((z * t) <= -4e+69) tmp = t_1; elseif ((z * t) <= 5e-165) tmp = 2.0 * (y * x); elseif ((z * t) <= 2e+162) tmp = (-2.0 * (i * a)) * c; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(t * N[(z + z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -4e+69], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e-165], N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+162], N[(N[(-2.0 * N[(i * a), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(z + z\right)\\
\mathbf{if}\;z \cdot t \leq -4 \cdot 10^{+69}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-165}:\\
\;\;\;\;2 \cdot \left(y \cdot x\right)\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+162}:\\
\;\;\;\;\left(-2 \cdot \left(i \cdot a\right)\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -4.0000000000000003e69 or 1.9999999999999999e162 < (*.f64 z t) Initial program 88.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6462.7
Applied rewrites62.7%
Applied rewrites62.7%
if -4.0000000000000003e69 < (*.f64 z t) < 4.99999999999999981e-165Initial program 87.5%
Taylor expanded in x around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6437.2
Applied rewrites37.2%
if 4.99999999999999981e-165 < (*.f64 z t) < 1.9999999999999999e162Initial program 91.2%
Taylor expanded in i around inf
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
distribute-lft-outN/A
lower-*.f64N/A
distribute-lft-outN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6457.2
Applied rewrites57.2%
Taylor expanded in a around inf
Applied rewrites44.3%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= c -2e-128) (not (<= c 2.4e-84))) (* 2.0 (fma y x (fma (* (fma b c a) i) (- c) (* z t)))) (* 2.0 (- (+ (* x y) (* z t)) (* (* c a) i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c <= -2e-128) || !(c <= 2.4e-84)) {
tmp = 2.0 * fma(y, x, fma((fma(b, c, a) * i), -c, (z * t)));
} else {
tmp = 2.0 * (((x * y) + (z * t)) - ((c * a) * i));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((c <= -2e-128) || !(c <= 2.4e-84)) tmp = Float64(2.0 * fma(y, x, fma(Float64(fma(b, c, a) * i), Float64(-c), Float64(z * t)))); else tmp = Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(c * a) * i))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[c, -2e-128], N[Not[LessEqual[c, 2.4e-84]], $MachinePrecision]], N[(2.0 * N[(y * x + N[(N[(N[(b * c + a), $MachinePrecision] * i), $MachinePrecision] * (-c) + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(c * a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -2 \cdot 10^{-128} \lor \neg \left(c \leq 2.4 \cdot 10^{-84}\right):\\
\;\;\;\;2 \cdot \mathsf{fma}\left(y, x, \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right) \cdot i, -c, z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(c \cdot a\right) \cdot i\right)\\
\end{array}
\end{array}
if c < -2.00000000000000011e-128 or 2.40000000000000017e-84 < c Initial program 84.0%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6492.6
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6492.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6492.6
Applied rewrites92.6%
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6495.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.6
Applied rewrites95.6%
if -2.00000000000000011e-128 < c < 2.40000000000000017e-84Initial program 98.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6495.2
Applied rewrites95.2%
Final simplification95.5%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* z t) -4e+69) (not (<= (* z t) 4e-20))) (* t (+ z z)) (* 2.0 (* y x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((z * t) <= -4e+69) || !((z * t) <= 4e-20)) {
tmp = t * (z + z);
} else {
tmp = 2.0 * (y * x);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (((z * t) <= (-4d+69)) .or. (.not. ((z * t) <= 4d-20))) then
tmp = t * (z + z)
else
tmp = 2.0d0 * (y * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((z * t) <= -4e+69) || !((z * t) <= 4e-20)) {
tmp = t * (z + z);
} else {
tmp = 2.0 * (y * x);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((z * t) <= -4e+69) or not ((z * t) <= 4e-20): tmp = t * (z + z) else: tmp = 2.0 * (y * x) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(z * t) <= -4e+69) || !(Float64(z * t) <= 4e-20)) tmp = Float64(t * Float64(z + z)); else tmp = Float64(2.0 * Float64(y * x)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((z * t) <= -4e+69) || ~(((z * t) <= 4e-20))) tmp = t * (z + z); else tmp = 2.0 * (y * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -4e+69], N[Not[LessEqual[N[(z * t), $MachinePrecision], 4e-20]], $MachinePrecision]], N[(t * N[(z + z), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -4 \cdot 10^{+69} \lor \neg \left(z \cdot t \leq 4 \cdot 10^{-20}\right):\\
\;\;\;\;t \cdot \left(z + z\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -4.0000000000000003e69 or 3.99999999999999978e-20 < (*.f64 z t) Initial program 90.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6454.1
Applied rewrites54.1%
Applied rewrites54.1%
if -4.0000000000000003e69 < (*.f64 z t) < 3.99999999999999978e-20Initial program 87.4%
Taylor expanded in x around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6438.1
Applied rewrites38.1%
Final simplification45.0%
(FPCore (x y z t a b c i) :precision binary64 (* t (+ z z)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return t * (z + z);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = t * (z + z)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return t * (z + z);
}
def code(x, y, z, t, a, b, c, i): return t * (z + z)
function code(x, y, z, t, a, b, c, i) return Float64(t * Float64(z + z)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = t * (z + z); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(t * N[(z + z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(z + z\right)
\end{array}
Initial program 88.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6426.7
Applied rewrites26.7%
Applied rewrites26.7%
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(a + Float64(b * c)) * Float64(c * i)))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i))); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)
\end{array}
herbie shell --seed 2024346
(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))))