
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i)); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i)); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\end{array}
(FPCore (x y z t a b c i) :precision binary64 (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 (* (- z) (fma (/ (* (fma b c a) i) z) c (- 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 * (-z * fma(((fma(b, c, a) * i) / z), c, -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 * Float64(Float64(-z) * fma(Float64(Float64(fma(b, c, a) * i) / z), c, Float64(-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[((-z) * N[(N[(N[(N[(b * c + a), $MachinePrecision] * i), $MachinePrecision] / z), $MachinePrecision] * c + (-t)), $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 \left(\left(-z\right) \cdot \mathsf{fma}\left(\frac{\mathsf{fma}\left(b, c, a\right) \cdot i}{z}, c, -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 96.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-*.f6499.1
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.1
Applied rewrites99.1%
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 x around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6414.3
Applied rewrites14.3%
Taylor expanded in z around -inf
Applied rewrites64.3%
Final simplification97.2%
(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))
(t_3 (* 2.0 (* y x))))
(if (<= t_2 -5e-24)
t_1
(if (<= t_2 -2e-257)
t_3
(if (<= t_2 1e-160) (* t (+ z z)) (if (<= t_2 5e+88) t_3 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;
double t_3 = 2.0 * (y * x);
double tmp;
if (t_2 <= -5e-24) {
tmp = t_1;
} else if (t_2 <= -2e-257) {
tmp = t_3;
} else if (t_2 <= 1e-160) {
tmp = t * (z + z);
} else if (t_2 <= 5e+88) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(-2.0 * Float64(fma(c, b, a) * i)) * c) t_2 = Float64(Float64(a + Float64(b * c)) * c) t_3 = Float64(2.0 * Float64(y * x)) tmp = 0.0 if (t_2 <= -5e-24) tmp = t_1; elseif (t_2 <= -2e-257) tmp = t_3; elseif (t_2 <= 1e-160) tmp = Float64(t * Float64(z + z)); elseif (t_2 <= 5e+88) tmp = t_3; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(-2.0 * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-24], t$95$1, If[LessEqual[t$95$2, -2e-257], t$95$3, If[LessEqual[t$95$2, 1e-160], N[(t * N[(z + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+88], t$95$3, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-2 \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right)\right) \cdot c\\
t_2 := \left(a + b \cdot c\right) \cdot c\\
t_3 := 2 \cdot \left(y \cdot x\right)\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-257}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 10^{-160}:\\
\;\;\;\;t \cdot \left(z + z\right)\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+88}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (+.f64 a (*.f64 b c)) c) < -4.9999999999999998e-24 or 4.99999999999999997e88 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 84.0%
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.f6471.3
Applied rewrites71.3%
if -4.9999999999999998e-24 < (*.f64 (+.f64 a (*.f64 b c)) c) < -2e-257 or 9.9999999999999999e-161 < (*.f64 (+.f64 a (*.f64 b c)) c) < 4.99999999999999997e88Initial program 98.7%
Taylor expanded in x around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6456.2
Applied rewrites56.2%
if -2e-257 < (*.f64 (+.f64 a (*.f64 b c)) c) < 9.9999999999999999e-161Initial program 100.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6466.5
Applied rewrites66.5%
Applied rewrites66.5%
(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 -5e+256)
t_1
(if (<= t_2 1e-269)
(* 2.0 (fma (- i) (* a c) (* t z)))
(if (<= t_2 2e+22) (* 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 = (-2.0 * (fma(c, b, a) * i)) * c;
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -5e+256) {
tmp = t_1;
} else if (t_2 <= 1e-269) {
tmp = 2.0 * fma(-i, (a * c), (t * z));
} else if (t_2 <= 2e+22) {
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(-2.0 * Float64(fma(c, b, a) * i)) * c) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -5e+256) tmp = t_1; elseif (t_2 <= 1e-269) tmp = Float64(2.0 * fma(Float64(-i), Float64(a * c), Float64(t * z))); elseif (t_2 <= 2e+22) tmp = Float64(2.0 * 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[(-2.0 * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+256], t$95$1, If[LessEqual[t$95$2, 1e-269], N[(2.0 * N[((-i) * N[(a * c), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+22], N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-2 \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right)\right) \cdot c\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+256}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{-269}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-i, a \cdot c, t \cdot z\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+22}:\\
\;\;\;\;2 \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.00000000000000015e256 or 2e22 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 78.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.f6481.6
Applied rewrites81.6%
if -5.00000000000000015e256 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.9999999999999996e-270Initial program 99.9%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6464.8
Applied rewrites64.8%
Taylor expanded in a around inf
Applied rewrites56.0%
if 9.9999999999999996e-270 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2e22Initial program 99.9%
Taylor expanded in x around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6463.1
Applied rewrites63.1%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -5e+222)
(* (* c (* c (* i b))) -2.0)
(if (<= t_1 1e-269)
(* t (+ z z))
(if (<= t_1 5e+90) (* 2.0 (* y x)) (* (* (* (* c b) i) c) -2.0))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -5e+222) {
tmp = (c * (c * (i * b))) * -2.0;
} else if (t_1 <= 1e-269) {
tmp = t * (z + z);
} else if (t_1 <= 5e+90) {
tmp = 2.0 * (y * x);
} else {
tmp = (((c * b) * i) * c) * -2.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = ((a + (b * c)) * c) * i
if (t_1 <= (-5d+222)) then
tmp = (c * (c * (i * b))) * (-2.0d0)
else if (t_1 <= 1d-269) then
tmp = t * (z + z)
else if (t_1 <= 5d+90) then
tmp = 2.0d0 * (y * x)
else
tmp = (((c * b) * i) * c) * (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -5e+222) {
tmp = (c * (c * (i * b))) * -2.0;
} else if (t_1 <= 1e-269) {
tmp = t * (z + z);
} else if (t_1 <= 5e+90) {
tmp = 2.0 * (y * x);
} else {
tmp = (((c * b) * i) * c) * -2.0;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = ((a + (b * c)) * c) * i tmp = 0 if t_1 <= -5e+222: tmp = (c * (c * (i * b))) * -2.0 elif t_1 <= 1e-269: tmp = t * (z + z) elif t_1 <= 5e+90: tmp = 2.0 * (y * x) else: tmp = (((c * b) * i) * c) * -2.0 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= -5e+222) tmp = Float64(Float64(c * Float64(c * Float64(i * b))) * -2.0); elseif (t_1 <= 1e-269) tmp = Float64(t * Float64(z + z)); elseif (t_1 <= 5e+90) tmp = Float64(2.0 * Float64(y * x)); else tmp = Float64(Float64(Float64(Float64(c * b) * i) * c) * -2.0); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = ((a + (b * c)) * c) * i; tmp = 0.0; if (t_1 <= -5e+222) tmp = (c * (c * (i * b))) * -2.0; elseif (t_1 <= 1e-269) tmp = t * (z + z); elseif (t_1 <= 5e+90) tmp = 2.0 * (y * x); else tmp = (((c * b) * i) * c) * -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+222], N[(N[(c * N[(c * N[(i * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision], If[LessEqual[t$95$1, 1e-269], N[(t * N[(z + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+90], N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(c * b), $MachinePrecision] * i), $MachinePrecision] * c), $MachinePrecision] * -2.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+222}:\\
\;\;\;\;\left(c \cdot \left(c \cdot \left(i \cdot b\right)\right)\right) \cdot -2\\
\mathbf{elif}\;t\_1 \leq 10^{-269}:\\
\;\;\;\;t \cdot \left(z + z\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+90}:\\
\;\;\;\;2 \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(c \cdot b\right) \cdot i\right) \cdot c\right) \cdot -2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.00000000000000023e222Initial program 73.7%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6472.1
Applied rewrites72.1%
Applied rewrites74.5%
if -5.00000000000000023e222 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.9999999999999996e-270Initial program 99.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6447.0
Applied rewrites47.0%
Applied rewrites47.0%
if 9.9999999999999996e-270 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.0000000000000004e90Initial program 99.9%
Taylor expanded in x around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6458.9
Applied rewrites58.9%
if 5.0000000000000004e90 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 83.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6450.2
Applied rewrites50.2%
Applied rewrites57.3%
Applied rewrites59.0%
(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 -5e+222)
t_1
(if (<= t_2 1e-269)
(* t (+ z z))
(if (<= t_2 5e+90) (* 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 = (c * (c * (i * b))) * -2.0;
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -5e+222) {
tmp = t_1;
} else if (t_2 <= 1e-269) {
tmp = t * (z + z);
} else if (t_2 <= 5e+90) {
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 = (c * (c * (i * b))) * (-2.0d0)
t_2 = ((a + (b * c)) * c) * i
if (t_2 <= (-5d+222)) then
tmp = t_1
else if (t_2 <= 1d-269) then
tmp = t * (z + z)
else if (t_2 <= 5d+90) 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 = (c * (c * (i * b))) * -2.0;
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -5e+222) {
tmp = t_1;
} else if (t_2 <= 1e-269) {
tmp = t * (z + z);
} else if (t_2 <= 5e+90) {
tmp = 2.0 * (y * x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (c * (c * (i * b))) * -2.0 t_2 = ((a + (b * c)) * c) * i tmp = 0 if t_2 <= -5e+222: tmp = t_1 elif t_2 <= 1e-269: tmp = t * (z + z) elif t_2 <= 5e+90: 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(c * Float64(c * Float64(i * b))) * -2.0) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -5e+222) tmp = t_1; elseif (t_2 <= 1e-269) tmp = Float64(t * Float64(z + z)); elseif (t_2 <= 5e+90) 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 = (c * (c * (i * b))) * -2.0; t_2 = ((a + (b * c)) * c) * i; tmp = 0.0; if (t_2 <= -5e+222) tmp = t_1; elseif (t_2 <= 1e-269) tmp = t * (z + z); elseif (t_2 <= 5e+90) 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[(c * N[(c * N[(i * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+222], t$95$1, If[LessEqual[t$95$2, 1e-269], N[(t * N[(z + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+90], N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(c \cdot \left(c \cdot \left(i \cdot b\right)\right)\right) \cdot -2\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+222}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{-269}:\\
\;\;\;\;t \cdot \left(z + z\right)\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+90}:\\
\;\;\;\;2 \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.00000000000000023e222 or 5.0000000000000004e90 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 78.5%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6461.5
Applied rewrites61.5%
Applied rewrites66.5%
if -5.00000000000000023e222 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.9999999999999996e-270Initial program 99.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6447.0
Applied rewrites47.0%
Applied rewrites47.0%
if 9.9999999999999996e-270 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.0000000000000004e90Initial program 99.9%
Taylor expanded in x around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6458.9
Applied rewrites58.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+305)))
(* (* -2.0 (* (fma c b a) i)) c)
(* 2.0 (fma y x (- (* t z) (* i (* (fma c b a) c))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+305)) {
tmp = (-2.0 * (fma(c, b, a) * i)) * c;
} else {
tmp = 2.0 * fma(y, x, ((t * z) - (i * (fma(c, b, a) * c))));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+305)) tmp = Float64(Float64(-2.0 * Float64(fma(c, b, a) * i)) * c); else tmp = Float64(2.0 * fma(y, x, Float64(Float64(t * z) - Float64(i * Float64(fma(c, b, a) * 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[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+305]], $MachinePrecision]], N[(N[(-2.0 * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], N[(2.0 * N[(y * x + N[(N[(t * z), $MachinePrecision] - N[(i * N[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{+305}\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(y, x, t \cdot z - i \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot c\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0 or 1.9999999999999999e305 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 72.5%
Taylor expanded in i around inf
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
distribute-lft-outN/A
lower-*.f64N/A
distribute-lft-outN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6489.6
Applied rewrites89.6%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.9999999999999999e305Initial program 99.9%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Final simplification96.5%
(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 c b a) i)) c)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((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(c, b, a) * i)) * c;
}
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(Float64(-2.0 * Float64(fma(c, b, a) * i)) * c); 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[(N[(-2.0 * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * c), $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}:\\
\;\;\;\;\left(-2 \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right)\right) \cdot c\\
\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 96.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-*.f6499.1
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.1
Applied rewrites99.1%
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 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.f6464.3
Applied rewrites64.3%
Final simplification97.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+130)))
(* (* -2.0 (* (fma c b a) i)) c)
(* 2.0 (fma (- i) (* c a) (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 <= -((double) INFINITY)) || !(t_1 <= 5e+130)) {
tmp = (-2.0 * (fma(c, b, a) * i)) * c;
} else {
tmp = 2.0 * fma(-i, (c * a), 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 <= Float64(-Inf)) || !(t_1 <= 5e+130)) tmp = Float64(Float64(-2.0 * Float64(fma(c, b, a) * i)) * c); else tmp = Float64(2.0 * fma(Float64(-i), Float64(c * a), 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, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+130]], $MachinePrecision]], N[(N[(-2.0 * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], N[(2.0 * N[((-i) * N[(c * a), $MachinePrecision] + N[(t * z + N[(y * x), $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 -\infty \lor \neg \left(t\_1 \leq 5 \cdot 10^{+130}\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(-i, c \cdot a, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0 or 4.9999999999999996e130 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 74.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.f6487.9
Applied rewrites87.9%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.9999999999999996e130Initial program 99.8%
Taylor expanded in b around 0
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
mul-1-negN/A
+-commutativeN/A
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-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6490.1
Applied rewrites90.1%
Final simplification89.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 (- INFINITY))
(* (* -2.0 (* (fma c b a) i)) c)
(if (<= t_1 1e+106)
(* 2.0 (fma (- i) (* c a) (fma t z (* y x))))
(* 2.0 (fma (- i) (* (fma c b a) c) (* y x)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (-2.0 * (fma(c, b, a) * i)) * c;
} else if (t_1 <= 1e+106) {
tmp = 2.0 * fma(-i, (c * a), fma(t, z, (y * x)));
} else {
tmp = 2.0 * fma(-i, (fma(c, b, a) * c), (y * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(-2.0 * Float64(fma(c, b, a) * i)) * c); elseif (t_1 <= 1e+106) tmp = Float64(2.0 * fma(Float64(-i), Float64(c * a), fma(t, z, Float64(y * x)))); else tmp = Float64(2.0 * fma(Float64(-i), Float64(fma(c, b, a) * c), Float64(y * x))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(-2.0 * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[t$95$1, 1e+106], N[(2.0 * N[((-i) * N[(c * a), $MachinePrecision] + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[((-i) * N[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(-2 \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right)\right) \cdot c\\
\mathbf{elif}\;t\_1 \leq 10^{+106}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-i, c \cdot a, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-i, \mathsf{fma}\left(c, b, a\right) \cdot c, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0Initial program 69.4%
Taylor expanded in i around inf
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
distribute-lft-outN/A
lower-*.f64N/A
distribute-lft-outN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6487.8
Applied rewrites87.8%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.00000000000000009e106Initial program 99.9%
Taylor expanded in b around 0
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
mul-1-negN/A
+-commutativeN/A
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-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6490.4
Applied rewrites90.4%
if 1.00000000000000009e106 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 82.6%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6488.2
Applied rewrites88.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* c c) b))
(t_2 (* 2.0 (fma (- i) t_1 (* t z))))
(t_3 (* 2.0 (fma (- i) t_1 (* y x)))))
(if (<= (* x y) -1e-71)
t_3
(if (<= (* x y) -5e-230)
t_2
(if (<= (* x y) 4e-307)
(* 2.0 (fma (- i) (* a c) (* t z)))
(if (<= (* x y) 5e+30) t_2 t_3))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (c * c) * b;
double t_2 = 2.0 * fma(-i, t_1, (t * z));
double t_3 = 2.0 * fma(-i, t_1, (y * x));
double tmp;
if ((x * y) <= -1e-71) {
tmp = t_3;
} else if ((x * y) <= -5e-230) {
tmp = t_2;
} else if ((x * y) <= 4e-307) {
tmp = 2.0 * fma(-i, (a * c), (t * z));
} else if ((x * y) <= 5e+30) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(c * c) * b) t_2 = Float64(2.0 * fma(Float64(-i), t_1, Float64(t * z))) t_3 = Float64(2.0 * fma(Float64(-i), t_1, Float64(y * x))) tmp = 0.0 if (Float64(x * y) <= -1e-71) tmp = t_3; elseif (Float64(x * y) <= -5e-230) tmp = t_2; elseif (Float64(x * y) <= 4e-307) tmp = Float64(2.0 * fma(Float64(-i), Float64(a * c), Float64(t * z))); elseif (Float64(x * y) <= 5e+30) tmp = t_2; else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * c), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[((-i) * t$95$1 + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * N[((-i) * t$95$1 + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1e-71], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], -5e-230], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 4e-307], N[(2.0 * N[((-i) * N[(a * c), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+30], t$95$2, t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(c \cdot c\right) \cdot b\\
t_2 := 2 \cdot \mathsf{fma}\left(-i, t\_1, t \cdot z\right)\\
t_3 := 2 \cdot \mathsf{fma}\left(-i, t\_1, y \cdot x\right)\\
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-71}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-230}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{-307}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-i, a \cdot c, t \cdot z\right)\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+30}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (*.f64 x y) < -9.9999999999999992e-72 or 4.9999999999999998e30 < (*.f64 x y) Initial program 87.1%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6482.0
Applied rewrites82.0%
Taylor expanded in a around 0
Applied rewrites71.7%
if -9.9999999999999992e-72 < (*.f64 x y) < -5.00000000000000035e-230 or 3.99999999999999964e-307 < (*.f64 x y) < 4.9999999999999998e30Initial program 93.6%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6485.5
Applied rewrites85.5%
Taylor expanded in a around 0
Applied rewrites72.6%
if -5.00000000000000035e-230 < (*.f64 x y) < 3.99999999999999964e-307Initial program 97.6%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6496.6
Applied rewrites96.6%
Taylor expanded in a around inf
Applied rewrites85.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* -2.0 (* (fma c b a) i)) c)))
(if (<= c -2.4e+92)
t_1
(if (<= c -8.5e-223)
(* 2.0 (fma (- i) (* c a) (* y x)))
(if (<= c 5.6e-57)
(* 2.0 (fma (- i) (* a c) (* t z)))
(if (<= c 2.15e+70)
(* 2.0 (fma (- i) (* (* c c) b) (* 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 * (fma(c, b, a) * i)) * c;
double tmp;
if (c <= -2.4e+92) {
tmp = t_1;
} else if (c <= -8.5e-223) {
tmp = 2.0 * fma(-i, (c * a), (y * x));
} else if (c <= 5.6e-57) {
tmp = 2.0 * fma(-i, (a * c), (t * z));
} else if (c <= 2.15e+70) {
tmp = 2.0 * fma(-i, ((c * c) * b), (t * z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(-2.0 * Float64(fma(c, b, a) * i)) * c) tmp = 0.0 if (c <= -2.4e+92) tmp = t_1; elseif (c <= -8.5e-223) tmp = Float64(2.0 * fma(Float64(-i), Float64(c * a), Float64(y * x))); elseif (c <= 5.6e-57) tmp = Float64(2.0 * fma(Float64(-i), Float64(a * c), Float64(t * z))); elseif (c <= 2.15e+70) tmp = Float64(2.0 * fma(Float64(-i), Float64(Float64(c * c) * b), Float64(t * z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(-2.0 * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, If[LessEqual[c, -2.4e+92], t$95$1, If[LessEqual[c, -8.5e-223], N[(2.0 * N[((-i) * N[(c * a), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 5.6e-57], N[(2.0 * N[((-i) * N[(a * c), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.15e+70], N[(2.0 * N[((-i) * N[(N[(c * c), $MachinePrecision] * b), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-2 \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right)\right) \cdot c\\
\mathbf{if}\;c \leq -2.4 \cdot 10^{+92}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq -8.5 \cdot 10^{-223}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-i, c \cdot a, y \cdot x\right)\\
\mathbf{elif}\;c \leq 5.6 \cdot 10^{-57}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-i, a \cdot c, t \cdot z\right)\\
\mathbf{elif}\;c \leq 2.15 \cdot 10^{+70}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-i, \left(c \cdot c\right) \cdot b, t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -2.40000000000000005e92 or 2.15e70 < c 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.f6483.8
Applied rewrites83.8%
if -2.40000000000000005e92 < c < -8.5000000000000003e-223Initial program 94.3%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6476.0
Applied rewrites76.0%
Taylor expanded in a around inf
Applied rewrites67.8%
if -8.5000000000000003e-223 < c < 5.5999999999999999e-57Initial program 98.4%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6466.2
Applied rewrites66.2%
Taylor expanded in a around inf
Applied rewrites66.2%
if 5.5999999999999999e-57 < c < 2.15e70Initial program 96.8%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6476.4
Applied rewrites76.4%
Taylor expanded in a around 0
Applied rewrites66.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* 2.0 (fma (- i) (* c a) (* y x))))
(t_2 (* (* -2.0 (* (fma c b a) i)) c)))
(if (<= c -2.4e+92)
t_2
(if (<= c -8.5e-223)
t_1
(if (<= c 2e-219)
(* 2.0 (fma (- i) (* a c) (* t z)))
(if (<= c 0.000112) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = 2.0 * fma(-i, (c * a), (y * x));
double t_2 = (-2.0 * (fma(c, b, a) * i)) * c;
double tmp;
if (c <= -2.4e+92) {
tmp = t_2;
} else if (c <= -8.5e-223) {
tmp = t_1;
} else if (c <= 2e-219) {
tmp = 2.0 * fma(-i, (a * c), (t * z));
} else if (c <= 0.000112) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * fma(Float64(-i), Float64(c * a), Float64(y * x))) t_2 = Float64(Float64(-2.0 * Float64(fma(c, b, a) * i)) * c) tmp = 0.0 if (c <= -2.4e+92) tmp = t_2; elseif (c <= -8.5e-223) tmp = t_1; elseif (c <= 2e-219) tmp = Float64(2.0 * fma(Float64(-i), Float64(a * c), Float64(t * z))); elseif (c <= 0.000112) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(2.0 * N[((-i) * N[(c * a), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(-2.0 * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, If[LessEqual[c, -2.4e+92], t$95$2, If[LessEqual[c, -8.5e-223], t$95$1, If[LessEqual[c, 2e-219], N[(2.0 * N[((-i) * N[(a * c), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 0.000112], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \mathsf{fma}\left(-i, c \cdot a, y \cdot x\right)\\
t_2 := \left(-2 \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right)\right) \cdot c\\
\mathbf{if}\;c \leq -2.4 \cdot 10^{+92}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;c \leq -8.5 \cdot 10^{-223}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq 2 \cdot 10^{-219}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-i, a \cdot c, t \cdot z\right)\\
\mathbf{elif}\;c \leq 0.000112:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if c < -2.40000000000000005e92 or 1.11999999999999998e-4 < c Initial program 82.0%
Taylor expanded in i around inf
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
distribute-lft-outN/A
lower-*.f64N/A
distribute-lft-outN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6479.6
Applied rewrites79.6%
if -2.40000000000000005e92 < c < -8.5000000000000003e-223 or 2.0000000000000001e-219 < c < 1.11999999999999998e-4Initial program 95.9%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6473.0
Applied rewrites73.0%
Taylor expanded in a around inf
Applied rewrites65.1%
if -8.5000000000000003e-223 < c < 2.0000000000000001e-219Initial program 99.8%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6477.4
Applied rewrites77.4%
Taylor expanded in a around inf
Applied rewrites77.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -1.5e+63) (not (<= x 2.85e-118))) (* 2.0 (fma (- i) (* (* c c) b) (* y x))) (* (fma (* (- i) c) (* b c) (* z t)) 2.0)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x <= -1.5e+63) || !(x <= 2.85e-118)) {
tmp = 2.0 * fma(-i, ((c * c) * b), (y * x));
} else {
tmp = fma((-i * c), (b * c), (z * t)) * 2.0;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -1.5e+63) || !(x <= 2.85e-118)) tmp = Float64(2.0 * fma(Float64(-i), Float64(Float64(c * c) * b), Float64(y * x))); else tmp = Float64(fma(Float64(Float64(-i) * c), Float64(b * c), Float64(z * t)) * 2.0); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -1.5e+63], N[Not[LessEqual[x, 2.85e-118]], $MachinePrecision]], N[(2.0 * N[((-i) * N[(N[(c * c), $MachinePrecision] * b), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-i) * c), $MachinePrecision] * N[(b * c), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{+63} \lor \neg \left(x \leq 2.85 \cdot 10^{-118}\right):\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-i, \left(c \cdot c\right) \cdot b, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(-i\right) \cdot c, b \cdot c, z \cdot t\right) \cdot 2\\
\end{array}
\end{array}
if x < -1.5e63 or 2.85000000000000006e-118 < x Initial program 87.9%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6479.2
Applied rewrites79.2%
Taylor expanded in a around 0
Applied rewrites65.3%
if -1.5e63 < x < 2.85000000000000006e-118Initial program 94.6%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6481.2
Applied rewrites81.2%
Taylor expanded in a around 0
Applied rewrites71.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.7
Applied rewrites72.6%
Final simplification68.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -6.4e+62) (not (<= x 2.85e-118))) (* 2.0 (fma (- i) (* (* c c) b) (* y x))) (* 2.0 (fma (- i) (* (* b c) c) (* t z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x <= -6.4e+62) || !(x <= 2.85e-118)) {
tmp = 2.0 * fma(-i, ((c * c) * b), (y * x));
} else {
tmp = 2.0 * fma(-i, ((b * c) * c), (t * z));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -6.4e+62) || !(x <= 2.85e-118)) tmp = Float64(2.0 * fma(Float64(-i), Float64(Float64(c * c) * b), Float64(y * x))); else tmp = Float64(2.0 * fma(Float64(-i), Float64(Float64(b * c) * c), Float64(t * z))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -6.4e+62], N[Not[LessEqual[x, 2.85e-118]], $MachinePrecision]], N[(2.0 * N[((-i) * N[(N[(c * c), $MachinePrecision] * b), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[((-i) * N[(N[(b * c), $MachinePrecision] * c), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.4 \cdot 10^{+62} \lor \neg \left(x \leq 2.85 \cdot 10^{-118}\right):\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-i, \left(c \cdot c\right) \cdot b, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-i, \left(b \cdot c\right) \cdot c, t \cdot z\right)\\
\end{array}
\end{array}
if x < -6.39999999999999968e62 or 2.85000000000000006e-118 < x Initial program 88.0%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6479.3
Applied rewrites79.3%
Taylor expanded in a around 0
Applied rewrites65.5%
if -6.39999999999999968e62 < x < 2.85000000000000006e-118Initial program 94.6%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6481.9
Applied rewrites81.9%
Taylor expanded in a around 0
Applied rewrites72.3%
Final simplification68.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -1.1e+63) (not (<= x 2.85e-118))) (* 2.0 (* y x)) (* t (+ z z))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x <= -1.1e+63) || !(x <= 2.85e-118)) {
tmp = 2.0 * (y * x);
} else {
tmp = t * (z + z);
}
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 ((x <= (-1.1d+63)) .or. (.not. (x <= 2.85d-118))) then
tmp = 2.0d0 * (y * x)
else
tmp = t * (z + z)
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 ((x <= -1.1e+63) || !(x <= 2.85e-118)) {
tmp = 2.0 * (y * x);
} else {
tmp = t * (z + z);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (x <= -1.1e+63) or not (x <= 2.85e-118): tmp = 2.0 * (y * x) else: tmp = t * (z + z) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -1.1e+63) || !(x <= 2.85e-118)) tmp = Float64(2.0 * Float64(y * x)); else tmp = Float64(t * Float64(z + z)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((x <= -1.1e+63) || ~((x <= 2.85e-118))) tmp = 2.0 * (y * x); else tmp = t * (z + z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -1.1e+63], N[Not[LessEqual[x, 2.85e-118]], $MachinePrecision]], N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision], N[(t * N[(z + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{+63} \lor \neg \left(x \leq 2.85 \cdot 10^{-118}\right):\\
\;\;\;\;2 \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(z + z\right)\\
\end{array}
\end{array}
if x < -1.0999999999999999e63 or 2.85000000000000006e-118 < x Initial program 88.0%
Taylor expanded in x around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6444.3
Applied rewrites44.3%
if -1.0999999999999999e63 < x < 2.85000000000000006e-118Initial program 94.6%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6440.9
Applied rewrites40.9%
Applied rewrites40.9%
Final simplification42.9%
(FPCore (x y z t a b c i) :precision binary64 (* t (+ z z)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return t * (z + z);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = t * (z + z)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return t * (z + z);
}
def code(x, y, z, t, a, b, c, i): return t * (z + z)
function code(x, y, z, t, a, b, c, i) return Float64(t * Float64(z + z)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = t * (z + z); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(t * N[(z + z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(z + z\right)
\end{array}
Initial program 90.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6428.3
Applied rewrites28.3%
Applied rewrites28.3%
(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 2024360
(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))))