
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i)); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i)); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\end{array}
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -1e+287)
(* (fma (* i (fma c b a)) (- c) (* z t)) 2.0)
(if (<= t_1 5e+276)
(* 2.0 (fma z t (- (* y x) (* i (* (fma c b a) c)))))
(* 2.0 (fma z t (fma x y (* (- c) (* i (fma b c a))))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -1e+287) {
tmp = fma((i * fma(c, b, a)), -c, (z * t)) * 2.0;
} else if (t_1 <= 5e+276) {
tmp = 2.0 * fma(z, t, ((y * x) - (i * (fma(c, b, a) * c))));
} else {
tmp = 2.0 * fma(z, t, fma(x, y, (-c * (i * fma(b, c, a)))));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= -1e+287) tmp = Float64(fma(Float64(i * fma(c, b, a)), Float64(-c), Float64(z * t)) * 2.0); elseif (t_1 <= 5e+276) tmp = Float64(2.0 * fma(z, t, Float64(Float64(y * x) - Float64(i * Float64(fma(c, b, a) * c))))); else tmp = Float64(2.0 * fma(z, t, fma(x, y, Float64(Float64(-c) * Float64(i * fma(b, c, a)))))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+287], N[(N[(N[(i * N[(c * b + a), $MachinePrecision]), $MachinePrecision] * (-c) + N[(z * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[t$95$1, 5e+276], N[(2.0 * N[(z * t + N[(N[(y * x), $MachinePrecision] - N[(i * N[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * t + N[(x * y + N[((-c) * N[(i * N[(b * c + a), $MachinePrecision]), $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 -1 \cdot 10^{+287}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot \mathsf{fma}\left(c, b, a\right), -c, z \cdot t\right) \cdot 2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+276}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(z, t, y \cdot x - i \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(z, t, \mathsf{fma}\left(x, y, \left(-c\right) \cdot \left(i \cdot \mathsf{fma}\left(b, c, a\right)\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1.0000000000000001e287Initial program 75.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6475.5
Applied rewrites95.3%
Taylor expanded in x around 0
Applied rewrites95.3%
if -1.0000000000000001e287 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.00000000000000001e276Initial program 99.9%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lift-*.f64N/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%
if 5.00000000000000001e276 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 75.1%
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-*.f6490.6
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6490.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.6
Applied rewrites90.6%
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -2e+171)
(* (fma (* i (fma c b a)) (- c) (* z t)) 2.0)
(if (<= t_1 4e+55)
(* 2.0 (fma t z (* y x)))
(if (<= t_1 5e+211)
(* 2.0 (fma (- i) (* (fma c b a) c) (* t z)))
(* (* -2.0 (fma b c a)) (* i c)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -2e+171) {
tmp = fma((i * fma(c, b, a)), -c, (z * t)) * 2.0;
} else if (t_1 <= 4e+55) {
tmp = 2.0 * fma(t, z, (y * x));
} else if (t_1 <= 5e+211) {
tmp = 2.0 * fma(-i, (fma(c, b, a) * c), (t * z));
} else {
tmp = (-2.0 * fma(b, c, a)) * (i * c);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= -2e+171) tmp = Float64(fma(Float64(i * fma(c, b, a)), Float64(-c), Float64(z * t)) * 2.0); elseif (t_1 <= 4e+55) tmp = Float64(2.0 * fma(t, z, Float64(y * x))); elseif (t_1 <= 5e+211) tmp = Float64(2.0 * fma(Float64(-i), Float64(fma(c, b, a) * c), Float64(t * z))); else tmp = Float64(Float64(-2.0 * fma(b, c, a)) * Float64(i * c)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+171], N[(N[(N[(i * N[(c * b + a), $MachinePrecision]), $MachinePrecision] * (-c) + N[(z * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[t$95$1, 4e+55], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+211], N[(2.0 * N[((-i) * N[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * N[(b * c + a), $MachinePrecision]), $MachinePrecision] * N[(i * c), $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^{+171}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot \mathsf{fma}\left(c, b, a\right), -c, z \cdot t\right) \cdot 2\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+55}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+211}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(-i, \mathsf{fma}\left(c, b, a\right) \cdot c, t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot \mathsf{fma}\left(b, c, a\right)\right) \cdot \left(i \cdot c\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1.99999999999999991e171Initial program 80.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.0
Applied rewrites92.5%
Taylor expanded in x around 0
Applied rewrites90.8%
if -1.99999999999999991e171 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.00000000000000004e55Initial program 100.0%
Taylor expanded in c around 0
Applied rewrites92.7%
if 4.00000000000000004e55 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.9999999999999995e211Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites85.5%
if 4.9999999999999995e211 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 78.9%
Taylor expanded in i around inf
Applied rewrites93.8%
Applied rewrites96.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* 2.0 (fma (- i) (* (fma c b a) c) (* t z))))
(t_2 (* (* (+ a (* b c)) c) i)))
(if (<= t_2 -4e+164)
t_1
(if (<= t_2 4e+55)
(* 2.0 (fma t z (* y x)))
(if (<= t_2 5e+211) t_1 (* (* -2.0 (fma b c a)) (* i c)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = 2.0 * fma(-i, (fma(c, b, a) * c), (t * z));
double t_2 = ((a + (b * c)) * c) * i;
double tmp;
if (t_2 <= -4e+164) {
tmp = t_1;
} else if (t_2 <= 4e+55) {
tmp = 2.0 * fma(t, z, (y * x));
} else if (t_2 <= 5e+211) {
tmp = t_1;
} else {
tmp = (-2.0 * fma(b, c, a)) * (i * c);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * fma(Float64(-i), Float64(fma(c, b, a) * c), Float64(t * z))) t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_2 <= -4e+164) tmp = t_1; elseif (t_2 <= 4e+55) tmp = Float64(2.0 * fma(t, z, Float64(y * x))); elseif (t_2 <= 5e+211) tmp = t_1; else tmp = Float64(Float64(-2.0 * fma(b, c, a)) * Float64(i * c)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(2.0 * N[((-i) * N[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+164], t$95$1, If[LessEqual[t$95$2, 4e+55], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+211], t$95$1, N[(N[(-2.0 * N[(b * c + a), $MachinePrecision]), $MachinePrecision] * N[(i * c), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \mathsf{fma}\left(-i, \mathsf{fma}\left(c, b, a\right) \cdot c, t \cdot z\right)\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+164}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+55}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+211}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot \mathsf{fma}\left(b, c, a\right)\right) \cdot \left(i \cdot c\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -4e164 or 4.00000000000000004e55 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.9999999999999995e211Initial program 85.8%
Taylor expanded in x around 0
Applied rewrites82.2%
if -4e164 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.00000000000000004e55Initial program 100.0%
Taylor expanded in c around 0
Applied rewrites93.4%
if 4.9999999999999995e211 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 78.9%
Taylor expanded in i around inf
Applied rewrites93.8%
Applied rewrites96.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -1e+287)
(* (fma (* i (fma c b a)) (- c) (* z t)) 2.0)
(if (<= t_1 5e+276)
(* 2.0 (fma z t (- (* y x) (* i (* (fma c b a) c)))))
(* (* -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 t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -1e+287) {
tmp = fma((i * fma(c, b, a)), -c, (z * t)) * 2.0;
} else if (t_1 <= 5e+276) {
tmp = 2.0 * fma(z, t, ((y * x) - (i * (fma(c, b, a) * c))));
} else {
tmp = (-2.0 * (fma(c, b, a) * i)) * c;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= -1e+287) tmp = Float64(fma(Float64(i * fma(c, b, a)), Float64(-c), Float64(z * t)) * 2.0); elseif (t_1 <= 5e+276) tmp = Float64(2.0 * fma(z, t, Float64(Float64(y * x) - Float64(i * Float64(fma(c, b, a) * c))))); 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_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+287], N[(N[(N[(i * N[(c * b + a), $MachinePrecision]), $MachinePrecision] * (-c) + N[(z * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[t$95$1, 5e+276], N[(2.0 * N[(z * t + N[(N[(y * x), $MachinePrecision] - N[(i * N[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision]), $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}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+287}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot \mathsf{fma}\left(c, b, a\right), -c, z \cdot t\right) \cdot 2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+276}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(z, t, y \cdot x - i \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot c\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 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1.0000000000000001e287Initial program 75.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6475.5
Applied rewrites95.3%
Taylor expanded in x around 0
Applied rewrites95.3%
if -1.0000000000000001e287 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.00000000000000001e276Initial program 99.9%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lift-*.f64N/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%
if 5.00000000000000001e276 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 75.1%
Taylor expanded in i around inf
Applied rewrites97.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -1e+286)
(* (fma (* i (fma c b a)) (- c) (* z t)) 2.0)
(if (<= t_1 2e+141)
(* (fma (* (* i c) b) (- c) (fma t z (* y x))) 2.0)
(* (* -2.0 (fma b c a)) (* i c))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -1e+286) {
tmp = fma((i * fma(c, b, a)), -c, (z * t)) * 2.0;
} else if (t_1 <= 2e+141) {
tmp = fma(((i * c) * b), -c, fma(t, z, (y * x))) * 2.0;
} else {
tmp = (-2.0 * fma(b, c, a)) * (i * c);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= -1e+286) tmp = Float64(fma(Float64(i * fma(c, b, a)), Float64(-c), Float64(z * t)) * 2.0); elseif (t_1 <= 2e+141) tmp = Float64(fma(Float64(Float64(i * c) * b), Float64(-c), fma(t, z, Float64(y * x))) * 2.0); else tmp = Float64(Float64(-2.0 * fma(b, c, a)) * Float64(i * c)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+286], N[(N[(N[(i * N[(c * b + a), $MachinePrecision]), $MachinePrecision] * (-c) + N[(z * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[t$95$1, 2e+141], N[(N[(N[(N[(i * c), $MachinePrecision] * b), $MachinePrecision] * (-c) + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[(-2.0 * N[(b * c + a), $MachinePrecision]), $MachinePrecision] * N[(i * c), $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^{+286}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot \mathsf{fma}\left(c, b, a\right), -c, z \cdot t\right) \cdot 2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+141}:\\
\;\;\;\;\mathsf{fma}\left(\left(i \cdot c\right) \cdot b, -c, \mathsf{fma}\left(t, z, y \cdot x\right)\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot \mathsf{fma}\left(b, c, a\right)\right) \cdot \left(i \cdot c\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1.00000000000000003e286Initial program 76.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6476.0
Applied rewrites95.4%
Taylor expanded in x around 0
Applied rewrites95.4%
if -1.00000000000000003e286 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000003e141Initial program 99.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites96.5%
Taylor expanded in a around 0
Applied rewrites91.4%
if 2.00000000000000003e141 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 80.8%
Taylor expanded in i around inf
Applied rewrites90.2%
Applied rewrites94.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -1e+286) (not (<= t_1 1e+203)))
(* (* -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 <= -1e+286) || !(t_1 <= 1e+203)) {
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 <= -1e+286) || !(t_1 <= 1e+203)) 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, -1e+286], N[Not[LessEqual[t$95$1, 1e+203]], $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 -1 \cdot 10^{+286} \lor \neg \left(t\_1 \leq 10^{+203}\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) < -1.00000000000000003e286 or 9.9999999999999999e202 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 78.0%
Taylor expanded in i around inf
Applied rewrites91.9%
if -1.00000000000000003e286 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.9999999999999999e202Initial program 99.9%
Taylor expanded in c around 0
Applied rewrites84.8%
Final simplification87.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -4e+164) (not (<= t_1 5e+115)))
(* (* (* (fma b c a) c) -2.0) i)
(* 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 <= -4e+164) || !(t_1 <= 5e+115)) {
tmp = ((fma(b, c, a) * c) * -2.0) * i;
} 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 <= -4e+164) || !(t_1 <= 5e+115)) tmp = Float64(Float64(Float64(fma(b, c, a) * c) * -2.0) * i); 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, -4e+164], N[Not[LessEqual[t$95$1, 5e+115]], $MachinePrecision]], N[(N[(N[(N[(b * c + a), $MachinePrecision] * c), $MachinePrecision] * -2.0), $MachinePrecision] * i), $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 -4 \cdot 10^{+164} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+115}\right):\\
\;\;\;\;\left(\left(\mathsf{fma}\left(b, c, a\right) \cdot c\right) \cdot -2\right) \cdot i\\
\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) < -4e164 or 5.00000000000000008e115 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 81.9%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6493.9
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6493.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6493.9
Applied rewrites93.9%
Taylor expanded in i around inf
Applied rewrites77.1%
if -4e164 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.00000000000000008e115Initial program 100.0%
Taylor expanded in c around 0
Applied rewrites92.1%
Final simplification84.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -1e+286)
(* (* -2.0 (* (fma c b a) i)) c)
(if (<= t_1 5e+115)
(* 2.0 (fma t z (* y x)))
(* (* -2.0 (fma b c a)) (* i c))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if (t_1 <= -1e+286) {
tmp = (-2.0 * (fma(c, b, a) * i)) * c;
} else if (t_1 <= 5e+115) {
tmp = 2.0 * fma(t, z, (y * x));
} else {
tmp = (-2.0 * fma(b, c, a)) * (i * c);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if (t_1 <= -1e+286) tmp = Float64(Float64(-2.0 * Float64(fma(c, b, a) * i)) * c); elseif (t_1 <= 5e+115) tmp = Float64(2.0 * fma(t, z, Float64(y * x))); else tmp = Float64(Float64(-2.0 * fma(b, c, a)) * Float64(i * c)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+286], N[(N[(-2.0 * N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[t$95$1, 5e+115], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * N[(b * c + a), $MachinePrecision]), $MachinePrecision] * N[(i * c), $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^{+286}:\\
\;\;\;\;\left(-2 \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right)\right) \cdot c\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+115}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot \mathsf{fma}\left(b, c, a\right)\right) \cdot \left(i \cdot c\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1.00000000000000003e286Initial program 76.0%
Taylor expanded in i around inf
Applied rewrites88.9%
if -1.00000000000000003e286 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.00000000000000008e115Initial program 99.9%
Taylor expanded in c around 0
Applied rewrites88.3%
if 5.00000000000000008e115 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 82.7%
Taylor expanded in i around inf
Applied rewrites86.2%
Applied rewrites89.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -1e+286) (not (<= t_1 1e+203)))
(* (* (* (* b c) i) -2.0) 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 <= -1e+286) || !(t_1 <= 1e+203)) {
tmp = (((b * c) * i) * -2.0) * 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 <= -1e+286) || !(t_1 <= 1e+203)) tmp = Float64(Float64(Float64(Float64(b * c) * i) * -2.0) * 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, -1e+286], N[Not[LessEqual[t$95$1, 1e+203]], $MachinePrecision]], N[(N[(N[(N[(b * c), $MachinePrecision] * i), $MachinePrecision] * -2.0), $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 -1 \cdot 10^{+286} \lor \neg \left(t\_1 \leq 10^{+203}\right):\\
\;\;\;\;\left(\left(\left(b \cdot c\right) \cdot i\right) \cdot -2\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) < -1.00000000000000003e286 or 9.9999999999999999e202 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 78.0%
Taylor expanded in i around inf
Applied rewrites91.9%
Taylor expanded in a around 0
Applied rewrites70.0%
Applied rewrites69.2%
if -1.00000000000000003e286 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.9999999999999999e202Initial program 99.9%
Taylor expanded in c around 0
Applied rewrites84.8%
Final simplification78.1%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (<= t_1 -1e+286)
(* (* (* (* b c) i) -2.0) c)
(if (<= t_1 1e+203)
(* 2.0 (fma t z (* y x)))
(* (* (* (* i c) b) -2.0) 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 <= -1e+286) {
tmp = (((b * c) * i) * -2.0) * c;
} else if (t_1 <= 1e+203) {
tmp = 2.0 * fma(t, z, (y * x));
} else {
tmp = (((i * c) * b) * -2.0) * 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 <= -1e+286) tmp = Float64(Float64(Float64(Float64(b * c) * i) * -2.0) * c); elseif (t_1 <= 1e+203) tmp = Float64(2.0 * fma(t, z, Float64(y * x))); else tmp = Float64(Float64(Float64(Float64(i * c) * b) * -2.0) * c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+286], N[(N[(N[(N[(b * c), $MachinePrecision] * i), $MachinePrecision] * -2.0), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[t$95$1, 1e+203], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(i * c), $MachinePrecision] * b), $MachinePrecision] * -2.0), $MachinePrecision] * c), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+286}:\\
\;\;\;\;\left(\left(\left(b \cdot c\right) \cdot i\right) \cdot -2\right) \cdot c\\
\mathbf{elif}\;t\_1 \leq 10^{+203}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(i \cdot c\right) \cdot b\right) \cdot -2\right) \cdot c\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1.00000000000000003e286Initial program 76.0%
Taylor expanded in i around inf
Applied rewrites88.9%
Taylor expanded in a around 0
Applied rewrites75.0%
Applied rewrites75.0%
if -1.00000000000000003e286 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 9.9999999999999999e202Initial program 99.9%
Taylor expanded in c around 0
Applied rewrites84.8%
if 9.9999999999999999e202 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 79.3%
Taylor expanded in i around inf
Applied rewrites93.9%
Taylor expanded in a around 0
Applied rewrites66.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* (+ a (* b c)) c) i)))
(if (or (<= t_1 -1e+286) (not (<= t_1 5e+182)))
(* (* (* 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+286) || !(t_1 <= 5e+182)) {
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+286) || !(t_1 <= 5e+182)) 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+286], N[Not[LessEqual[t$95$1, 5e+182]], $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^{+286} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+182}\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) < -1.00000000000000003e286 or 4.99999999999999973e182 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 78.5%
Taylor expanded in a around inf
Applied rewrites50.5%
if -1.00000000000000003e286 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999973e182Initial program 99.9%
Taylor expanded in c around 0
Applied rewrites85.8%
Final simplification70.4%
(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 7e+135)))
(* (* (* i c) a) -2.0)
(* 2.0 (* y x)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if ((t_1 <= -1e+153) || !(t_1 <= 7e+135)) {
tmp = ((i * c) * a) * -2.0;
} else {
tmp = 2.0 * (y * x);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = ((a + (b * c)) * c) * i
if ((t_1 <= (-1d+153)) .or. (.not. (t_1 <= 7d+135))) then
tmp = ((i * c) * a) * (-2.0d0)
else
tmp = 2.0d0 * (y * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a + (b * c)) * c) * i;
double tmp;
if ((t_1 <= -1e+153) || !(t_1 <= 7e+135)) {
tmp = ((i * c) * a) * -2.0;
} else {
tmp = 2.0 * (y * x);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = ((a + (b * c)) * c) * i tmp = 0 if (t_1 <= -1e+153) or not (t_1 <= 7e+135): tmp = ((i * c) * a) * -2.0 else: tmp = 2.0 * (y * x) return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i) tmp = 0.0 if ((t_1 <= -1e+153) || !(t_1 <= 7e+135)) tmp = Float64(Float64(Float64(i * c) * a) * -2.0); else tmp = Float64(2.0 * Float64(y * x)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = ((a + (b * c)) * c) * i; tmp = 0.0; if ((t_1 <= -1e+153) || ~((t_1 <= 7e+135))) tmp = ((i * c) * a) * -2.0; else tmp = 2.0 * (y * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+153], N[Not[LessEqual[t$95$1, 7e+135]], $MachinePrecision]], N[(N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision] * -2.0), $MachinePrecision], N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+153} \lor \neg \left(t\_1 \leq 7 \cdot 10^{+135}\right):\\
\;\;\;\;\left(\left(i \cdot c\right) \cdot a\right) \cdot -2\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1e153 or 7.0000000000000005e135 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 81.3%
Taylor expanded in a around inf
Applied rewrites47.2%
if -1e153 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 7.0000000000000005e135Initial program 100.0%
Taylor expanded in x around inf
Applied rewrites53.4%
Final simplification50.3%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* (* (+ a (* b c)) c) i) 5e+276) (* 2.0 (fma (fma c b a) (* (- i) c) (fma t z (* y x)))) (* 2.0 (fma z t (fma x y (* (- c) (* i (fma b c a))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((((a + (b * c)) * c) * i) <= 5e+276) {
tmp = 2.0 * fma(fma(c, b, a), (-i * c), fma(t, z, (y * x)));
} else {
tmp = 2.0 * fma(z, t, fma(x, y, (-c * (i * fma(b, c, a)))));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(Float64(a + Float64(b * c)) * c) * i) <= 5e+276) 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(z, t, fma(x, y, Float64(Float64(-c) * Float64(i * fma(b, c, a)))))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision], 5e+276], 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 * t + N[(x * y + N[((-c) * N[(i * N[(b * c + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i \leq 5 \cdot 10^{+276}:\\
\;\;\;\;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(z, t, \mathsf{fma}\left(x, y, \left(-c\right) \cdot \left(i \cdot \mathsf{fma}\left(b, c, a\right)\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.00000000000000001e276Initial program 94.7%
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.1
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6498.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.1
Applied rewrites98.1%
if 5.00000000000000001e276 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 75.1%
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-*.f6490.6
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6490.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.6
Applied rewrites90.6%
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Final simplification98.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* 2.0 (* y x))))
(if (<= (* x y) -1e+70)
t_1
(if (<= (* x y) 1e-270)
(* 2.0 (* t z))
(if (<= (* x y) 4e-20) (* (* (* a i) -2.0) c) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = 2.0 * (y * x);
double tmp;
if ((x * y) <= -1e+70) {
tmp = t_1;
} else if ((x * y) <= 1e-270) {
tmp = 2.0 * (t * z);
} else if ((x * y) <= 4e-20) {
tmp = ((a * i) * -2.0) * 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 = 2.0d0 * (y * x)
if ((x * y) <= (-1d+70)) then
tmp = t_1
else if ((x * y) <= 1d-270) then
tmp = 2.0d0 * (t * z)
else if ((x * y) <= 4d-20) then
tmp = ((a * i) * (-2.0d0)) * 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 = 2.0 * (y * x);
double tmp;
if ((x * y) <= -1e+70) {
tmp = t_1;
} else if ((x * y) <= 1e-270) {
tmp = 2.0 * (t * z);
} else if ((x * y) <= 4e-20) {
tmp = ((a * i) * -2.0) * c;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = 2.0 * (y * x) tmp = 0 if (x * y) <= -1e+70: tmp = t_1 elif (x * y) <= 1e-270: tmp = 2.0 * (t * z) elif (x * y) <= 4e-20: tmp = ((a * i) * -2.0) * c else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * Float64(y * x)) tmp = 0.0 if (Float64(x * y) <= -1e+70) tmp = t_1; elseif (Float64(x * y) <= 1e-270) tmp = Float64(2.0 * Float64(t * z)); elseif (Float64(x * y) <= 4e-20) tmp = Float64(Float64(Float64(a * i) * -2.0) * c); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = 2.0 * (y * x); tmp = 0.0; if ((x * y) <= -1e+70) tmp = t_1; elseif ((x * y) <= 1e-270) tmp = 2.0 * (t * z); elseif ((x * y) <= 4e-20) tmp = ((a * i) * -2.0) * c; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1e+70], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1e-270], N[(2.0 * N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4e-20], N[(N[(N[(a * i), $MachinePrecision] * -2.0), $MachinePrecision] * c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(y \cdot x\right)\\
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 10^{-270}:\\
\;\;\;\;2 \cdot \left(t \cdot z\right)\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{-20}:\\
\;\;\;\;\left(\left(a \cdot i\right) \cdot -2\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -1.00000000000000007e70 or 3.99999999999999978e-20 < (*.f64 x y) Initial program 91.9%
Taylor expanded in x around inf
Applied rewrites58.6%
if -1.00000000000000007e70 < (*.f64 x y) < 1e-270Initial program 89.6%
Taylor expanded in z around inf
Applied rewrites39.7%
if 1e-270 < (*.f64 x y) < 3.99999999999999978e-20Initial program 88.8%
Taylor expanded in i around inf
Applied rewrites59.7%
Taylor expanded in a around inf
Applied rewrites43.3%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -1e+70) (not (<= (* x y) 500.0))) (* 2.0 (* y x)) (* 2.0 (* t z))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -1e+70) || !((x * y) <= 500.0)) {
tmp = 2.0 * (y * x);
} else {
tmp = 2.0 * (t * 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 * y) <= (-1d+70)) .or. (.not. ((x * y) <= 500.0d0))) then
tmp = 2.0d0 * (y * x)
else
tmp = 2.0d0 * (t * 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 * y) <= -1e+70) || !((x * y) <= 500.0)) {
tmp = 2.0 * (y * x);
} else {
tmp = 2.0 * (t * z);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -1e+70) or not ((x * y) <= 500.0): tmp = 2.0 * (y * x) else: tmp = 2.0 * (t * z) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -1e+70) || !(Float64(x * y) <= 500.0)) tmp = Float64(2.0 * Float64(y * x)); else tmp = Float64(2.0 * Float64(t * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((x * y) <= -1e+70) || ~(((x * y) <= 500.0))) tmp = 2.0 * (y * x); else tmp = 2.0 * (t * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1e+70], N[Not[LessEqual[N[(x * y), $MachinePrecision], 500.0]], $MachinePrecision]], N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+70} \lor \neg \left(x \cdot y \leq 500\right):\\
\;\;\;\;2 \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.00000000000000007e70 or 500 < (*.f64 x y) Initial program 91.8%
Taylor expanded in x around inf
Applied rewrites59.1%
if -1.00000000000000007e70 < (*.f64 x y) < 500Initial program 89.5%
Taylor expanded in z around inf
Applied rewrites37.6%
Final simplification47.7%
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (* t z)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (t * z);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = 2.0d0 * (t * z)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (t * z);
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (t * z)
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(t * z)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (t * z); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(t * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(t \cdot z\right)
\end{array}
Initial program 90.6%
Taylor expanded in z around inf
Applied rewrites26.9%
(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 2025018
(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))))