
(FPCore (x y z t a b c i j k) :precision binary64 (- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
}
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, j, k)
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), intent (in) :: j
real(8), intent (in) :: k
code = (((((((x * 18.0d0) * y) * z) * t) - ((a * 4.0d0) * t)) + (b * c)) - ((x * 4.0d0) * i)) - ((j * 27.0d0) * k)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
}
def code(x, y, z, t, a, b, c, i, j, k): return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k)
function code(x, y, z, t, a, b, c, i, j, k) return Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * 18.0) * y) * z) * t) - Float64(Float64(a * 4.0) * t)) + Float64(b * c)) - Float64(Float64(x * 4.0) * i)) - Float64(Float64(j * 27.0) * k)) end
function tmp = code(x, y, z, t, a, b, c, i, j, k) tmp = (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := N[(N[(N[(N[(N[(N[(N[(N[(x * 18.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - N[(N[(x * 4.0), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] - N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k
\end{array}
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i j k) :precision binary64 (- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
}
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, j, k)
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), intent (in) :: j
real(8), intent (in) :: k
code = (((((((x * 18.0d0) * y) * z) * t) - ((a * 4.0d0) * t)) + (b * c)) - ((x * 4.0d0) * i)) - ((j * 27.0d0) * k)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
}
def code(x, y, z, t, a, b, c, i, j, k): return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k)
function code(x, y, z, t, a, b, c, i, j, k) return Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * 18.0) * y) * z) * t) - Float64(Float64(a * 4.0) * t)) + Float64(b * c)) - Float64(Float64(x * 4.0) * i)) - Float64(Float64(j * 27.0) * k)) end
function tmp = code(x, y, z, t, a, b, c, i, j, k) tmp = (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := N[(N[(N[(N[(N[(N[(N[(N[(x * 18.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - N[(N[(x * 4.0), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] - N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k
\end{array}
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (* j 27.0) k)))
(if (<=
(-
(-
(+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c))
(* (* x 4.0) i))
t_1)
INFINITY)
(fma
c
b
(-
(* (fma (* (* x y) z) 18.0 (* a -4.0)) t)
(fma (* i x) 4.0 (* (* j k) 27.0))))
(- (* (* (* (* y x) z) t) 18.0) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = (j * 27.0) * k;
double tmp;
if (((((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - t_1) <= ((double) INFINITY)) {
tmp = fma(c, b, ((fma(((x * y) * z), 18.0, (a * -4.0)) * t) - fma((i * x), 4.0, ((j * k) * 27.0))));
} else {
tmp = ((((y * x) * z) * t) * 18.0) - t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * 18.0) * y) * z) * t) - Float64(Float64(a * 4.0) * t)) + Float64(b * c)) - Float64(Float64(x * 4.0) * i)) - t_1) <= Inf) tmp = fma(c, b, Float64(Float64(fma(Float64(Float64(x * y) * z), 18.0, Float64(a * -4.0)) * t) - fma(Float64(i * x), 4.0, Float64(Float64(j * k) * 27.0)))); else tmp = Float64(Float64(Float64(Float64(Float64(y * x) * z) * t) * 18.0) - t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(N[(N[(N[(N[(x * 18.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - N[(N[(x * 4.0), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], Infinity], N[(c * b + N[(N[(N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] * 18.0 + N[(a * -4.0), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] - N[(N[(i * x), $MachinePrecision] * 4.0 + N[(N[(j * k), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] * 18.0), $MachinePrecision] - t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - t\_1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(c, b, \mathsf{fma}\left(\left(x \cdot y\right) \cdot z, 18, a \cdot -4\right) \cdot t - \mathsf{fma}\left(i \cdot x, 4, \left(j \cdot k\right) \cdot 27\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18 - t\_1\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 (-.f64 (*.f64 (*.f64 (*.f64 (*.f64 x #s(literal 18 binary64)) y) z) t) (*.f64 (*.f64 a #s(literal 4 binary64)) t)) (*.f64 b c)) (*.f64 (*.f64 x #s(literal 4 binary64)) i)) (*.f64 (*.f64 j #s(literal 27 binary64)) k)) < +inf.0Initial program 95.4%
Applied rewrites94.4%
Applied rewrites94.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6495.4
Applied rewrites95.4%
if +inf.0 < (-.f64 (-.f64 (+.f64 (-.f64 (*.f64 (*.f64 (*.f64 (*.f64 x #s(literal 18 binary64)) y) z) t) (*.f64 (*.f64 a #s(literal 4 binary64)) t)) (*.f64 b c)) (*.f64 (*.f64 x #s(literal 4 binary64)) i)) (*.f64 (*.f64 j #s(literal 27 binary64)) k)) Initial program 0.0%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6427.4
Applied rewrites27.4%
Taylor expanded in i around inf
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6433.8
Applied rewrites33.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6442.2
Applied rewrites42.2%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (* j 27.0) k)))
(if (<=
(-
(-
(+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c))
(* (* x 4.0) i))
t_1)
INFINITY)
(-
(fma (fma (* (* x y) z) 18.0 (* -4.0 a)) t (* c b))
(fma (* 4.0 x) i (* (* k j) 27.0)))
(- (* (* (* (* y x) z) t) 18.0) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = (j * 27.0) * k;
double tmp;
if (((((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - t_1) <= ((double) INFINITY)) {
tmp = fma(fma(((x * y) * z), 18.0, (-4.0 * a)), t, (c * b)) - fma((4.0 * x), i, ((k * j) * 27.0));
} else {
tmp = ((((y * x) * z) * t) * 18.0) - t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * 18.0) * y) * z) * t) - Float64(Float64(a * 4.0) * t)) + Float64(b * c)) - Float64(Float64(x * 4.0) * i)) - t_1) <= Inf) tmp = Float64(fma(fma(Float64(Float64(x * y) * z), 18.0, Float64(-4.0 * a)), t, Float64(c * b)) - fma(Float64(4.0 * x), i, Float64(Float64(k * j) * 27.0))); else tmp = Float64(Float64(Float64(Float64(Float64(y * x) * z) * t) * 18.0) - t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(N[(N[(N[(N[(x * 18.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - N[(N[(x * 4.0), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], Infinity], N[(N[(N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] * 18.0 + N[(-4.0 * a), $MachinePrecision]), $MachinePrecision] * t + N[(c * b), $MachinePrecision]), $MachinePrecision] - N[(N[(4.0 * x), $MachinePrecision] * i + N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] * 18.0), $MachinePrecision] - t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - t\_1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(x \cdot y\right) \cdot z, 18, -4 \cdot a\right), t, c \cdot b\right) - \mathsf{fma}\left(4 \cdot x, i, \left(k \cdot j\right) \cdot 27\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18 - t\_1\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 (-.f64 (*.f64 (*.f64 (*.f64 (*.f64 x #s(literal 18 binary64)) y) z) t) (*.f64 (*.f64 a #s(literal 4 binary64)) t)) (*.f64 b c)) (*.f64 (*.f64 x #s(literal 4 binary64)) i)) (*.f64 (*.f64 j #s(literal 27 binary64)) k)) < +inf.0Initial program 95.4%
Applied rewrites94.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6495.4
Applied rewrites95.4%
if +inf.0 < (-.f64 (-.f64 (+.f64 (-.f64 (*.f64 (*.f64 (*.f64 (*.f64 x #s(literal 18 binary64)) y) z) t) (*.f64 (*.f64 a #s(literal 4 binary64)) t)) (*.f64 b c)) (*.f64 (*.f64 x #s(literal 4 binary64)) i)) (*.f64 (*.f64 j #s(literal 27 binary64)) k)) Initial program 0.0%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6427.4
Applied rewrites27.4%
Taylor expanded in i around inf
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6433.8
Applied rewrites33.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6442.2
Applied rewrites42.2%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (fma b c (* (fma i x (* t a)) -4.0))) (t_2 (* (* j 27.0) k)))
(if (<= t_2 -2e+147)
(fma c b (* (* k j) -27.0))
(if (<= t_2 2e-227)
t_1
(if (<= t_2 1e-99)
(* (fma (* (* t z) 18.0) y (* i -4.0)) x)
(if (<= t_2 2e+51) t_1 (- (* -4.0 (* a t)) t_2)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = fma(b, c, (fma(i, x, (t * a)) * -4.0));
double t_2 = (j * 27.0) * k;
double tmp;
if (t_2 <= -2e+147) {
tmp = fma(c, b, ((k * j) * -27.0));
} else if (t_2 <= 2e-227) {
tmp = t_1;
} else if (t_2 <= 1e-99) {
tmp = fma(((t * z) * 18.0), y, (i * -4.0)) * x;
} else if (t_2 <= 2e+51) {
tmp = t_1;
} else {
tmp = (-4.0 * (a * t)) - t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k) t_1 = fma(b, c, Float64(fma(i, x, Float64(t * a)) * -4.0)) t_2 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_2 <= -2e+147) tmp = fma(c, b, Float64(Float64(k * j) * -27.0)); elseif (t_2 <= 2e-227) tmp = t_1; elseif (t_2 <= 1e-99) tmp = Float64(fma(Float64(Float64(t * z) * 18.0), y, Float64(i * -4.0)) * x); elseif (t_2 <= 2e+51) tmp = t_1; else tmp = Float64(Float64(-4.0 * Float64(a * t)) - t_2); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(b * c + N[(N[(i * x + N[(t * a), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+147], N[(c * b + N[(N[(k * j), $MachinePrecision] * -27.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e-227], t$95$1, If[LessEqual[t$95$2, 1e-99], N[(N[(N[(N[(t * z), $MachinePrecision] * 18.0), $MachinePrecision] * y + N[(i * -4.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$2, 2e+51], t$95$1, N[(N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, c, \mathsf{fma}\left(i, x, t \cdot a\right) \cdot -4\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+147}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-227}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{-99}:\\
\;\;\;\;\mathsf{fma}\left(\left(t \cdot z\right) \cdot 18, y, i \cdot -4\right) \cdot x\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(a \cdot t\right) - t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -2e147Initial program 79.0%
Applied rewrites81.9%
Applied rewrites82.7%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6469.8
Applied rewrites69.8%
if -2e147 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1.99999999999999989e-227 or 1e-99 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 2e51Initial program 87.6%
Taylor expanded in j around 0
associate--l+N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6483.0
Applied rewrites83.0%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6470.7
Applied rewrites70.7%
if 1.99999999999999989e-227 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1e-99Initial program 85.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6451.1
Applied rewrites51.1%
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6452.3
Applied rewrites52.3%
if 2e51 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 83.1%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6459.7
Applied rewrites59.7%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (fma b c (* (fma i x (* t a)) -4.0))) (t_2 (* (* j 27.0) k)))
(if (<= t_2 -2e+147)
(fma c b (* (* k j) -27.0))
(if (<= t_2 1e-251)
t_1
(if (<= t_2 4e-137)
(* (fma (* (* y x) z) 18.0 (* -4.0 a)) t)
(if (<= t_2 2e+51) t_1 (- (* -4.0 (* a t)) t_2)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = fma(b, c, (fma(i, x, (t * a)) * -4.0));
double t_2 = (j * 27.0) * k;
double tmp;
if (t_2 <= -2e+147) {
tmp = fma(c, b, ((k * j) * -27.0));
} else if (t_2 <= 1e-251) {
tmp = t_1;
} else if (t_2 <= 4e-137) {
tmp = fma(((y * x) * z), 18.0, (-4.0 * a)) * t;
} else if (t_2 <= 2e+51) {
tmp = t_1;
} else {
tmp = (-4.0 * (a * t)) - t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k) t_1 = fma(b, c, Float64(fma(i, x, Float64(t * a)) * -4.0)) t_2 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_2 <= -2e+147) tmp = fma(c, b, Float64(Float64(k * j) * -27.0)); elseif (t_2 <= 1e-251) tmp = t_1; elseif (t_2 <= 4e-137) tmp = Float64(fma(Float64(Float64(y * x) * z), 18.0, Float64(-4.0 * a)) * t); elseif (t_2 <= 2e+51) tmp = t_1; else tmp = Float64(Float64(-4.0 * Float64(a * t)) - t_2); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(b * c + N[(N[(i * x + N[(t * a), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+147], N[(c * b + N[(N[(k * j), $MachinePrecision] * -27.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e-251], t$95$1, If[LessEqual[t$95$2, 4e-137], N[(N[(N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision] * 18.0 + N[(-4.0 * a), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$2, 2e+51], t$95$1, N[(N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, c, \mathsf{fma}\left(i, x, t \cdot a\right) \cdot -4\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+147}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right)\\
\mathbf{elif}\;t\_2 \leq 10^{-251}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-137}:\\
\;\;\;\;\mathsf{fma}\left(\left(y \cdot x\right) \cdot z, 18, -4 \cdot a\right) \cdot t\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(a \cdot t\right) - t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -2e147Initial program 79.0%
Applied rewrites81.9%
Applied rewrites82.7%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6469.8
Applied rewrites69.8%
if -2e147 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1.00000000000000002e-251 or 3.99999999999999991e-137 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 2e51Initial program 87.5%
Taylor expanded in j around 0
associate--l+N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6482.9
Applied rewrites82.9%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6470.6
Applied rewrites70.6%
if 1.00000000000000002e-251 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 3.99999999999999991e-137Initial program 86.5%
Applied rewrites86.7%
Applied rewrites88.6%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6491.0
Applied rewrites91.0%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites51.0%
if 2e51 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 83.1%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6459.7
Applied rewrites59.7%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (fma b c (* (fma i x (* t a)) -4.0))) (t_2 (* (* j 27.0) k)))
(if (<= t_2 -2e+147)
(fma c b (* (* k j) -27.0))
(if (<= t_2 5e-207)
t_1
(if (<= t_2 4e-137)
(* (* (* (* y x) z) t) 18.0)
(if (<= t_2 2e+51) t_1 (- (* -4.0 (* a t)) t_2)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = fma(b, c, (fma(i, x, (t * a)) * -4.0));
double t_2 = (j * 27.0) * k;
double tmp;
if (t_2 <= -2e+147) {
tmp = fma(c, b, ((k * j) * -27.0));
} else if (t_2 <= 5e-207) {
tmp = t_1;
} else if (t_2 <= 4e-137) {
tmp = (((y * x) * z) * t) * 18.0;
} else if (t_2 <= 2e+51) {
tmp = t_1;
} else {
tmp = (-4.0 * (a * t)) - t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k) t_1 = fma(b, c, Float64(fma(i, x, Float64(t * a)) * -4.0)) t_2 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_2 <= -2e+147) tmp = fma(c, b, Float64(Float64(k * j) * -27.0)); elseif (t_2 <= 5e-207) tmp = t_1; elseif (t_2 <= 4e-137) tmp = Float64(Float64(Float64(Float64(y * x) * z) * t) * 18.0); elseif (t_2 <= 2e+51) tmp = t_1; else tmp = Float64(Float64(-4.0 * Float64(a * t)) - t_2); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(b * c + N[(N[(i * x + N[(t * a), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+147], N[(c * b + N[(N[(k * j), $MachinePrecision] * -27.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e-207], t$95$1, If[LessEqual[t$95$2, 4e-137], N[(N[(N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] * 18.0), $MachinePrecision], If[LessEqual[t$95$2, 2e+51], t$95$1, N[(N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, c, \mathsf{fma}\left(i, x, t \cdot a\right) \cdot -4\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+147}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right)\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-207}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-137}:\\
\;\;\;\;\left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(a \cdot t\right) - t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -2e147Initial program 79.0%
Applied rewrites81.9%
Applied rewrites82.7%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6469.8
Applied rewrites69.8%
if -2e147 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 5.00000000000000014e-207 or 3.99999999999999991e-137 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 2e51Initial program 87.5%
Taylor expanded in j around 0
associate--l+N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6483.1
Applied rewrites83.1%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6470.8
Applied rewrites70.8%
if 5.00000000000000014e-207 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 3.99999999999999991e-137Initial program 85.0%
Applied rewrites85.4%
Applied rewrites87.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6490.5
Applied rewrites90.5%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6429.8
Applied rewrites29.8%
if 2e51 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 83.1%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6459.7
Applied rewrites59.7%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (fma c b (* (* k j) -27.0)))
(t_2 (fma b c (* (fma i x (* t a)) -4.0)))
(t_3 (* (* j 27.0) k)))
(if (<= t_3 -2e+147)
t_1
(if (<= t_3 5e-207)
t_2
(if (<= t_3 4e-137)
(* (* (* (* y x) z) t) 18.0)
(if (<= t_3 1e+98) t_2 t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = fma(c, b, ((k * j) * -27.0));
double t_2 = fma(b, c, (fma(i, x, (t * a)) * -4.0));
double t_3 = (j * 27.0) * k;
double tmp;
if (t_3 <= -2e+147) {
tmp = t_1;
} else if (t_3 <= 5e-207) {
tmp = t_2;
} else if (t_3 <= 4e-137) {
tmp = (((y * x) * z) * t) * 18.0;
} else if (t_3 <= 1e+98) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k) t_1 = fma(c, b, Float64(Float64(k * j) * -27.0)) t_2 = fma(b, c, Float64(fma(i, x, Float64(t * a)) * -4.0)) t_3 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_3 <= -2e+147) tmp = t_1; elseif (t_3 <= 5e-207) tmp = t_2; elseif (t_3 <= 4e-137) tmp = Float64(Float64(Float64(Float64(y * x) * z) * t) * 18.0); elseif (t_3 <= 1e+98) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(c * b + N[(N[(k * j), $MachinePrecision] * -27.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b * c + N[(N[(i * x + N[(t * a), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$3, -2e+147], t$95$1, If[LessEqual[t$95$3, 5e-207], t$95$2, If[LessEqual[t$95$3, 4e-137], N[(N[(N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] * 18.0), $MachinePrecision], If[LessEqual[t$95$3, 1e+98], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right)\\
t_2 := \mathsf{fma}\left(b, c, \mathsf{fma}\left(i, x, t \cdot a\right) \cdot -4\right)\\
t_3 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{+147}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{-207}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{-137}:\\
\;\;\;\;\left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18\\
\mathbf{elif}\;t\_3 \leq 10^{+98}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -2e147 or 9.99999999999999998e97 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 81.0%
Applied rewrites83.9%
Applied rewrites84.5%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6467.8
Applied rewrites67.8%
if -2e147 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 5.00000000000000014e-207 or 3.99999999999999991e-137 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 9.99999999999999998e97Initial program 87.4%
Taylor expanded in j around 0
associate--l+N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6482.5
Applied rewrites82.5%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6470.4
Applied rewrites70.4%
if 5.00000000000000014e-207 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 3.99999999999999991e-137Initial program 85.0%
Applied rewrites85.4%
Applied rewrites87.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6490.5
Applied rewrites90.5%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6429.8
Applied rewrites29.8%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (fma c b (* (* k j) -27.0))) (t_2 (* (* j 27.0) k)))
(if (<= t_2 -1e+68)
t_1
(if (<= t_2 1e-192)
(fma c b (* (* i x) -4.0))
(if (<= t_2 1e-99)
(* (* (* (* z y) 18.0) t) x)
(if (<= t_2 1e+60) (fma (* i -4.0) x (* b c)) t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = fma(c, b, ((k * j) * -27.0));
double t_2 = (j * 27.0) * k;
double tmp;
if (t_2 <= -1e+68) {
tmp = t_1;
} else if (t_2 <= 1e-192) {
tmp = fma(c, b, ((i * x) * -4.0));
} else if (t_2 <= 1e-99) {
tmp = (((z * y) * 18.0) * t) * x;
} else if (t_2 <= 1e+60) {
tmp = fma((i * -4.0), x, (b * c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k) t_1 = fma(c, b, Float64(Float64(k * j) * -27.0)) t_2 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_2 <= -1e+68) tmp = t_1; elseif (t_2 <= 1e-192) tmp = fma(c, b, Float64(Float64(i * x) * -4.0)); elseif (t_2 <= 1e-99) tmp = Float64(Float64(Float64(Float64(z * y) * 18.0) * t) * x); elseif (t_2 <= 1e+60) tmp = fma(Float64(i * -4.0), x, Float64(b * c)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(c * b + N[(N[(k * j), $MachinePrecision] * -27.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+68], t$95$1, If[LessEqual[t$95$2, 1e-192], N[(c * b + N[(N[(i * x), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e-99], N[(N[(N[(N[(z * y), $MachinePrecision] * 18.0), $MachinePrecision] * t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$2, 1e+60], N[(N[(i * -4.0), $MachinePrecision] * x + N[(b * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{-192}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot -4\right)\\
\mathbf{elif}\;t\_2 \leq 10^{-99}:\\
\;\;\;\;\left(\left(\left(z \cdot y\right) \cdot 18\right) \cdot t\right) \cdot x\\
\mathbf{elif}\;t\_2 \leq 10^{+60}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot -4, x, b \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -9.99999999999999953e67 or 9.9999999999999995e59 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 82.1%
Applied rewrites84.9%
Applied rewrites85.5%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6462.4
Applied rewrites62.4%
if -9.99999999999999953e67 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1.0000000000000001e-192Initial program 87.2%
Applied rewrites89.4%
Applied rewrites89.9%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
lift-*.f6450.7
Applied rewrites50.7%
if 1.0000000000000001e-192 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1e-99Initial program 85.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6452.6
Applied rewrites52.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6429.0
Applied rewrites29.0%
if 1e-99 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 9.9999999999999995e59Initial program 88.8%
Taylor expanded in j around 0
associate--l+N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6480.6
Applied rewrites80.6%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6448.1
Applied rewrites48.1%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (fma c b (* (* k j) -27.0)))
(t_2 (fma c b (* (* i x) -4.0)))
(t_3 (* (* j 27.0) k)))
(if (<= t_3 -1e+68)
t_1
(if (<= t_3 1e-251)
t_2
(if (<= t_3 4e-137)
(* (* (* (* y x) z) t) 18.0)
(if (<= t_3 1e+60) t_2 t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = fma(c, b, ((k * j) * -27.0));
double t_2 = fma(c, b, ((i * x) * -4.0));
double t_3 = (j * 27.0) * k;
double tmp;
if (t_3 <= -1e+68) {
tmp = t_1;
} else if (t_3 <= 1e-251) {
tmp = t_2;
} else if (t_3 <= 4e-137) {
tmp = (((y * x) * z) * t) * 18.0;
} else if (t_3 <= 1e+60) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k) t_1 = fma(c, b, Float64(Float64(k * j) * -27.0)) t_2 = fma(c, b, Float64(Float64(i * x) * -4.0)) t_3 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_3 <= -1e+68) tmp = t_1; elseif (t_3 <= 1e-251) tmp = t_2; elseif (t_3 <= 4e-137) tmp = Float64(Float64(Float64(Float64(y * x) * z) * t) * 18.0); elseif (t_3 <= 1e+60) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(c * b + N[(N[(k * j), $MachinePrecision] * -27.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c * b + N[(N[(i * x), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$3, -1e+68], t$95$1, If[LessEqual[t$95$3, 1e-251], t$95$2, If[LessEqual[t$95$3, 4e-137], N[(N[(N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] * 18.0), $MachinePrecision], If[LessEqual[t$95$3, 1e+60], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right)\\
t_2 := \mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot -4\right)\\
t_3 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_3 \leq -1 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 10^{-251}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{-137}:\\
\;\;\;\;\left(\left(\left(y \cdot x\right) \cdot z\right) \cdot t\right) \cdot 18\\
\mathbf{elif}\;t\_3 \leq 10^{+60}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -9.99999999999999953e67 or 9.9999999999999995e59 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 82.1%
Applied rewrites84.9%
Applied rewrites85.5%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6462.4
Applied rewrites62.4%
if -9.99999999999999953e67 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1.00000000000000002e-251 or 3.99999999999999991e-137 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 9.9999999999999995e59Initial program 87.5%
Applied rewrites89.7%
Applied rewrites90.2%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
lift-*.f6450.2
Applied rewrites50.2%
if 1.00000000000000002e-251 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 3.99999999999999991e-137Initial program 86.5%
Applied rewrites86.7%
Applied rewrites88.6%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6491.0
Applied rewrites91.0%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6429.2
Applied rewrites29.2%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (fma c b (- (fma (* 4.0 i) x (* (* k j) 27.0)))))
(t_2 (* (* j 27.0) k)))
(if (<= t_2 -2e+147)
t_1
(if (<= t_2 1e+18)
(fma (* 18.0 t) (* (* z y) x) (- (* c b) (* 4.0 (fma a t (* i x)))))
t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = fma(c, b, -fma((4.0 * i), x, ((k * j) * 27.0)));
double t_2 = (j * 27.0) * k;
double tmp;
if (t_2 <= -2e+147) {
tmp = t_1;
} else if (t_2 <= 1e+18) {
tmp = fma((18.0 * t), ((z * y) * x), ((c * b) - (4.0 * fma(a, t, (i * x)))));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k) t_1 = fma(c, b, Float64(-fma(Float64(4.0 * i), x, Float64(Float64(k * j) * 27.0)))) t_2 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_2 <= -2e+147) tmp = t_1; elseif (t_2 <= 1e+18) tmp = fma(Float64(18.0 * t), Float64(Float64(z * y) * x), Float64(Float64(c * b) - Float64(4.0 * fma(a, t, Float64(i * x))))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(c * b + (-N[(N[(4.0 * i), $MachinePrecision] * x + N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]}, Block[{t$95$2 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+147], t$95$1, If[LessEqual[t$95$2, 1e+18], N[(N[(18.0 * t), $MachinePrecision] * N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision] + N[(N[(c * b), $MachinePrecision] - N[(4.0 * N[(a * t + N[(i * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, b, -\mathsf{fma}\left(4 \cdot i, x, \left(k \cdot j\right) \cdot 27\right)\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+147}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(18 \cdot t, \left(z \cdot y\right) \cdot x, c \cdot b - 4 \cdot \mathsf{fma}\left(a, t, i \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -2e147 or 1e18 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 81.9%
Applied rewrites84.8%
Applied rewrites85.4%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6474.3
Applied rewrites74.3%
if -2e147 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1e18Initial program 87.3%
Taylor expanded in j around 0
associate--l+N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6483.3
Applied rewrites83.3%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (* j 27.0) k)))
(if (<= t_1 -2e+147)
(* -27.0 (* k j))
(if (<= t_1 1e-99)
(* -4.0 (* a t))
(if (<= t_1 2e+51) (* c b) (* (* -27.0 k) j))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = (j * 27.0) * k;
double tmp;
if (t_1 <= -2e+147) {
tmp = -27.0 * (k * j);
} else if (t_1 <= 1e-99) {
tmp = -4.0 * (a * t);
} else if (t_1 <= 2e+51) {
tmp = c * b;
} else {
tmp = (-27.0 * k) * j;
}
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, j, k)
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), intent (in) :: j
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: tmp
t_1 = (j * 27.0d0) * k
if (t_1 <= (-2d+147)) then
tmp = (-27.0d0) * (k * j)
else if (t_1 <= 1d-99) then
tmp = (-4.0d0) * (a * t)
else if (t_1 <= 2d+51) then
tmp = c * b
else
tmp = ((-27.0d0) * k) * j
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 j, double k) {
double t_1 = (j * 27.0) * k;
double tmp;
if (t_1 <= -2e+147) {
tmp = -27.0 * (k * j);
} else if (t_1 <= 1e-99) {
tmp = -4.0 * (a * t);
} else if (t_1 <= 2e+51) {
tmp = c * b;
} else {
tmp = (-27.0 * k) * j;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j, k): t_1 = (j * 27.0) * k tmp = 0 if t_1 <= -2e+147: tmp = -27.0 * (k * j) elif t_1 <= 1e-99: tmp = -4.0 * (a * t) elif t_1 <= 2e+51: tmp = c * b else: tmp = (-27.0 * k) * j return tmp
function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_1 <= -2e+147) tmp = Float64(-27.0 * Float64(k * j)); elseif (t_1 <= 1e-99) tmp = Float64(-4.0 * Float64(a * t)); elseif (t_1 <= 2e+51) tmp = Float64(c * b); else tmp = Float64(Float64(-27.0 * k) * j); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k) t_1 = (j * 27.0) * k; tmp = 0.0; if (t_1 <= -2e+147) tmp = -27.0 * (k * j); elseif (t_1 <= 1e-99) tmp = -4.0 * (a * t); elseif (t_1 <= 2e+51) tmp = c * b; else tmp = (-27.0 * k) * j; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+147], N[(-27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-99], N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+51], N[(c * b), $MachinePrecision], N[(N[(-27.0 * k), $MachinePrecision] * j), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+147}:\\
\;\;\;\;-27 \cdot \left(k \cdot j\right)\\
\mathbf{elif}\;t\_1 \leq 10^{-99}:\\
\;\;\;\;-4 \cdot \left(a \cdot t\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+51}:\\
\;\;\;\;c \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(-27 \cdot k\right) \cdot j\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -2e147Initial program 79.0%
Taylor expanded in j around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6460.3
Applied rewrites60.3%
if -2e147 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1e-99Initial program 87.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6425.0
Applied rewrites25.0%
if 1e-99 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 2e51Initial program 88.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6426.6
Applied rewrites26.6%
if 2e51 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 83.1%
Taylor expanded in j around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6448.9
Applied rewrites48.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6448.9
Applied rewrites48.9%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* -27.0 (* k j))) (t_2 (* (* j 27.0) k)))
(if (<= t_2 -2e+147)
t_1
(if (<= t_2 1e-99) (* -4.0 (* a t)) (if (<= t_2 2e+51) (* c b) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = -27.0 * (k * j);
double t_2 = (j * 27.0) * k;
double tmp;
if (t_2 <= -2e+147) {
tmp = t_1;
} else if (t_2 <= 1e-99) {
tmp = -4.0 * (a * t);
} else if (t_2 <= 2e+51) {
tmp = c * b;
} 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, j, k)
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), intent (in) :: j
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-27.0d0) * (k * j)
t_2 = (j * 27.0d0) * k
if (t_2 <= (-2d+147)) then
tmp = t_1
else if (t_2 <= 1d-99) then
tmp = (-4.0d0) * (a * t)
else if (t_2 <= 2d+51) then
tmp = c * b
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 j, double k) {
double t_1 = -27.0 * (k * j);
double t_2 = (j * 27.0) * k;
double tmp;
if (t_2 <= -2e+147) {
tmp = t_1;
} else if (t_2 <= 1e-99) {
tmp = -4.0 * (a * t);
} else if (t_2 <= 2e+51) {
tmp = c * b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j, k): t_1 = -27.0 * (k * j) t_2 = (j * 27.0) * k tmp = 0 if t_2 <= -2e+147: tmp = t_1 elif t_2 <= 1e-99: tmp = -4.0 * (a * t) elif t_2 <= 2e+51: tmp = c * b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(-27.0 * Float64(k * j)) t_2 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_2 <= -2e+147) tmp = t_1; elseif (t_2 <= 1e-99) tmp = Float64(-4.0 * Float64(a * t)); elseif (t_2 <= 2e+51) tmp = Float64(c * b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k) t_1 = -27.0 * (k * j); t_2 = (j * 27.0) * k; tmp = 0.0; if (t_2 <= -2e+147) tmp = t_1; elseif (t_2 <= 1e-99) tmp = -4.0 * (a * t); elseif (t_2 <= 2e+51) tmp = c * b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(-27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+147], t$95$1, If[LessEqual[t$95$2, 1e-99], N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+51], N[(c * b), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -27 \cdot \left(k \cdot j\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+147}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{-99}:\\
\;\;\;\;-4 \cdot \left(a \cdot t\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+51}:\\
\;\;\;\;c \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -2e147 or 2e51 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 81.4%
Taylor expanded in j around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6453.6
Applied rewrites53.6%
if -2e147 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1e-99Initial program 87.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6425.0
Applied rewrites25.0%
if 1e-99 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 2e51Initial program 88.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6426.6
Applied rewrites26.6%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (fma c b (* (* k j) -27.0))) (t_2 (* (* j 27.0) k)))
(if (<= t_2 -1e+68)
t_1
(if (<= t_2 1e+60) (fma c b (* (* i x) -4.0)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = fma(c, b, ((k * j) * -27.0));
double t_2 = (j * 27.0) * k;
double tmp;
if (t_2 <= -1e+68) {
tmp = t_1;
} else if (t_2 <= 1e+60) {
tmp = fma(c, b, ((i * x) * -4.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k) t_1 = fma(c, b, Float64(Float64(k * j) * -27.0)) t_2 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_2 <= -1e+68) tmp = t_1; elseif (t_2 <= 1e+60) tmp = fma(c, b, Float64(Float64(i * x) * -4.0)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(c * b + N[(N[(k * j), $MachinePrecision] * -27.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+68], t$95$1, If[LessEqual[t$95$2, 1e+60], N[(c * b + N[(N[(i * x), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, b, \left(k \cdot j\right) \cdot -27\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+60}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -9.99999999999999953e67 or 9.9999999999999995e59 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 82.1%
Applied rewrites84.9%
Applied rewrites85.5%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6462.4
Applied rewrites62.4%
if -9.99999999999999953e67 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 9.9999999999999995e59Initial program 87.4%
Applied rewrites89.4%
Applied rewrites90.0%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
lift-*.f6450.4
Applied rewrites50.4%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* -27.0 (* k j))) (t_2 (* (* j 27.0) k)))
(if (<= t_2 -2e+262)
t_1
(if (<= t_2 5e+195) (fma c b (* (* i x) -4.0)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = -27.0 * (k * j);
double t_2 = (j * 27.0) * k;
double tmp;
if (t_2 <= -2e+262) {
tmp = t_1;
} else if (t_2 <= 5e+195) {
tmp = fma(c, b, ((i * x) * -4.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(-27.0 * Float64(k * j)) t_2 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_2 <= -2e+262) tmp = t_1; elseif (t_2 <= 5e+195) tmp = fma(c, b, Float64(Float64(i * x) * -4.0)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(-27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+262], t$95$1, If[LessEqual[t$95$2, 5e+195], N[(c * b + N[(N[(i * x), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -27 \cdot \left(k \cdot j\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+262}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+195}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(i \cdot x\right) \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -2e262 or 4.9999999999999998e195 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 76.3%
Taylor expanded in j around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6472.3
Applied rewrites72.3%
if -2e262 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 4.9999999999999998e195Initial program 87.5%
Applied rewrites89.6%
Applied rewrites90.3%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
lift-*.f6447.3
Applied rewrites47.3%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* -27.0 (* k j))) (t_2 (* (* j 27.0) k)))
(if (<= t_2 -2e+262)
t_1
(if (<= t_2 5e+195) (fma (* i -4.0) x (* b c)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = -27.0 * (k * j);
double t_2 = (j * 27.0) * k;
double tmp;
if (t_2 <= -2e+262) {
tmp = t_1;
} else if (t_2 <= 5e+195) {
tmp = fma((i * -4.0), x, (b * c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(-27.0 * Float64(k * j)) t_2 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_2 <= -2e+262) tmp = t_1; elseif (t_2 <= 5e+195) tmp = fma(Float64(i * -4.0), x, Float64(b * c)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(-27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+262], t$95$1, If[LessEqual[t$95$2, 5e+195], N[(N[(i * -4.0), $MachinePrecision] * x + N[(b * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -27 \cdot \left(k \cdot j\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+262}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+195}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot -4, x, b \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -2e262 or 4.9999999999999998e195 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 76.3%
Taylor expanded in j around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6472.3
Applied rewrites72.3%
if -2e262 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 4.9999999999999998e195Initial program 87.5%
Taylor expanded in j around 0
associate--l+N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6479.0
Applied rewrites79.0%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6447.3
Applied rewrites47.3%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (fma (* (* y x) z) 18.0 (* -4.0 a)) t)))
(if (<= t -2.65e+122)
t_1
(if (<= t 7.8e+62)
(fma c b (- (fma (* 4.0 i) x (* (* k j) 27.0))))
t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = fma(((y * x) * z), 18.0, (-4.0 * a)) * t;
double tmp;
if (t <= -2.65e+122) {
tmp = t_1;
} else if (t <= 7.8e+62) {
tmp = fma(c, b, -fma((4.0 * i), x, ((k * j) * 27.0)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(fma(Float64(Float64(y * x) * z), 18.0, Float64(-4.0 * a)) * t) tmp = 0.0 if (t <= -2.65e+122) tmp = t_1; elseif (t <= 7.8e+62) tmp = fma(c, b, Float64(-fma(Float64(4.0 * i), x, Float64(Float64(k * j) * 27.0)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision] * 18.0 + N[(-4.0 * a), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -2.65e+122], t$95$1, If[LessEqual[t, 7.8e+62], N[(c * b + (-N[(N[(4.0 * i), $MachinePrecision] * x + N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\left(y \cdot x\right) \cdot z, 18, -4 \cdot a\right) \cdot t\\
\mathbf{if}\;t \leq -2.65 \cdot 10^{+122}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{+62}:\\
\;\;\;\;\mathsf{fma}\left(c, b, -\mathsf{fma}\left(4 \cdot i, x, \left(k \cdot j\right) \cdot 27\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.65e122 or 7.8e62 < t Initial program 81.7%
Applied rewrites88.7%
Applied rewrites89.7%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6489.3
Applied rewrites89.3%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites70.0%
if -2.65e122 < t < 7.8e62Initial program 87.2%
Applied rewrites87.0%
Applied rewrites87.5%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6473.8
Applied rewrites73.8%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (fma (* (* y x) z) 18.0 (* -4.0 a)) t)))
(if (<= t -2.65e+122)
t_1
(if (<= t 7.8e+62) (- (* b c) (fma (* 4.0 x) i (* (* k j) 27.0))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = fma(((y * x) * z), 18.0, (-4.0 * a)) * t;
double tmp;
if (t <= -2.65e+122) {
tmp = t_1;
} else if (t <= 7.8e+62) {
tmp = (b * c) - fma((4.0 * x), i, ((k * j) * 27.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(fma(Float64(Float64(y * x) * z), 18.0, Float64(-4.0 * a)) * t) tmp = 0.0 if (t <= -2.65e+122) tmp = t_1; elseif (t <= 7.8e+62) tmp = Float64(Float64(b * c) - fma(Float64(4.0 * x), i, Float64(Float64(k * j) * 27.0))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision] * 18.0 + N[(-4.0 * a), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -2.65e+122], t$95$1, If[LessEqual[t, 7.8e+62], N[(N[(b * c), $MachinePrecision] - N[(N[(4.0 * x), $MachinePrecision] * i + N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\left(y \cdot x\right) \cdot z, 18, -4 \cdot a\right) \cdot t\\
\mathbf{if}\;t \leq -2.65 \cdot 10^{+122}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{+62}:\\
\;\;\;\;b \cdot c - \mathsf{fma}\left(4 \cdot x, i, \left(k \cdot j\right) \cdot 27\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.65e122 or 7.8e62 < t Initial program 81.7%
Applied rewrites88.7%
Applied rewrites89.7%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6489.3
Applied rewrites89.3%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites70.0%
if -2.65e122 < t < 7.8e62Initial program 87.2%
Applied rewrites87.0%
Taylor expanded in t around 0
lower-*.f6473.1
Applied rewrites73.1%
(FPCore (x y z t a b c i j k) :precision binary64 (if (<= (* b c) -4e+162) (* c b) (if (<= (* b c) 4e+110) (* -27.0 (* k j)) (* c b))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double tmp;
if ((b * c) <= -4e+162) {
tmp = c * b;
} else if ((b * c) <= 4e+110) {
tmp = -27.0 * (k * j);
} else {
tmp = c * b;
}
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, j, k)
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), intent (in) :: j
real(8), intent (in) :: k
real(8) :: tmp
if ((b * c) <= (-4d+162)) then
tmp = c * b
else if ((b * c) <= 4d+110) then
tmp = (-27.0d0) * (k * j)
else
tmp = c * b
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 j, double k) {
double tmp;
if ((b * c) <= -4e+162) {
tmp = c * b;
} else if ((b * c) <= 4e+110) {
tmp = -27.0 * (k * j);
} else {
tmp = c * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j, k): tmp = 0 if (b * c) <= -4e+162: tmp = c * b elif (b * c) <= 4e+110: tmp = -27.0 * (k * j) else: tmp = c * b return tmp
function code(x, y, z, t, a, b, c, i, j, k) tmp = 0.0 if (Float64(b * c) <= -4e+162) tmp = Float64(c * b); elseif (Float64(b * c) <= 4e+110) tmp = Float64(-27.0 * Float64(k * j)); else tmp = Float64(c * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k) tmp = 0.0; if ((b * c) <= -4e+162) tmp = c * b; elseif ((b * c) <= 4e+110) tmp = -27.0 * (k * j); else tmp = c * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := If[LessEqual[N[(b * c), $MachinePrecision], -4e+162], N[(c * b), $MachinePrecision], If[LessEqual[N[(b * c), $MachinePrecision], 4e+110], N[(-27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision], N[(c * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot c \leq -4 \cdot 10^{+162}:\\
\;\;\;\;c \cdot b\\
\mathbf{elif}\;b \cdot c \leq 4 \cdot 10^{+110}:\\
\;\;\;\;-27 \cdot \left(k \cdot j\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot b\\
\end{array}
\end{array}
if (*.f64 b c) < -3.9999999999999998e162 or 4.0000000000000001e110 < (*.f64 b c) Initial program 81.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6460.0
Applied rewrites60.0%
if -3.9999999999999998e162 < (*.f64 b c) < 4.0000000000000001e110Initial program 86.7%
Taylor expanded in j around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6427.1
Applied rewrites27.1%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* -4.0 (* a t))))
(if (<= a -2.6e+65)
t_1
(if (<= a -1.15e-171)
(* (* -4.0 i) x)
(if (<= a 1.2e+95) (* (* -27.0 k) j) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = -4.0 * (a * t);
double tmp;
if (a <= -2.6e+65) {
tmp = t_1;
} else if (a <= -1.15e-171) {
tmp = (-4.0 * i) * x;
} else if (a <= 1.2e+95) {
tmp = (-27.0 * k) * j;
} 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, j, k)
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), intent (in) :: j
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: tmp
t_1 = (-4.0d0) * (a * t)
if (a <= (-2.6d+65)) then
tmp = t_1
else if (a <= (-1.15d-171)) then
tmp = ((-4.0d0) * i) * x
else if (a <= 1.2d+95) then
tmp = ((-27.0d0) * k) * j
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 j, double k) {
double t_1 = -4.0 * (a * t);
double tmp;
if (a <= -2.6e+65) {
tmp = t_1;
} else if (a <= -1.15e-171) {
tmp = (-4.0 * i) * x;
} else if (a <= 1.2e+95) {
tmp = (-27.0 * k) * j;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j, k): t_1 = -4.0 * (a * t) tmp = 0 if a <= -2.6e+65: tmp = t_1 elif a <= -1.15e-171: tmp = (-4.0 * i) * x elif a <= 1.2e+95: tmp = (-27.0 * k) * j else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(-4.0 * Float64(a * t)) tmp = 0.0 if (a <= -2.6e+65) tmp = t_1; elseif (a <= -1.15e-171) tmp = Float64(Float64(-4.0 * i) * x); elseif (a <= 1.2e+95) tmp = Float64(Float64(-27.0 * k) * j); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k) t_1 = -4.0 * (a * t); tmp = 0.0; if (a <= -2.6e+65) tmp = t_1; elseif (a <= -1.15e-171) tmp = (-4.0 * i) * x; elseif (a <= 1.2e+95) tmp = (-27.0 * k) * j; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2.6e+65], t$95$1, If[LessEqual[a, -1.15e-171], N[(N[(-4.0 * i), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[a, 1.2e+95], N[(N[(-27.0 * k), $MachinePrecision] * j), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -4 \cdot \left(a \cdot t\right)\\
\mathbf{if}\;a \leq -2.6 \cdot 10^{+65}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -1.15 \cdot 10^{-171}:\\
\;\;\;\;\left(-4 \cdot i\right) \cdot x\\
\mathbf{elif}\;a \leq 1.2 \cdot 10^{+95}:\\
\;\;\;\;\left(-27 \cdot k\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.60000000000000003e65 or 1.2e95 < a Initial program 81.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6443.3
Applied rewrites43.3%
if -2.60000000000000003e65 < a < -1.14999999999999989e-171Initial program 87.1%
Taylor expanded in i around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f6423.7
Applied rewrites23.7%
if -1.14999999999999989e-171 < a < 1.2e95Initial program 87.5%
Taylor expanded in j around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6426.1
Applied rewrites26.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6426.1
Applied rewrites26.1%
(FPCore (x y z t a b c i j k) :precision binary64 (* c b))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
return c * b;
}
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, j, k)
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), intent (in) :: j
real(8), intent (in) :: k
code = c * b
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
return c * b;
}
def code(x, y, z, t, a, b, c, i, j, k): return c * b
function code(x, y, z, t, a, b, c, i, j, k) return Float64(c * b) end
function tmp = code(x, y, z, t, a, b, c, i, j, k) tmp = c * b; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := N[(c * b), $MachinePrecision]
\begin{array}{l}
\\
c \cdot b
\end{array}
Initial program 85.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6423.6
Applied rewrites23.6%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (+ (* a t) (* i x)) 4.0))
(t_2
(-
(- (* (* 18.0 t) (* (* x y) z)) t_1)
(- (* (* k j) 27.0) (* c b)))))
(if (< t -1.6210815397541398e-69)
t_2
(if (< t 165.68027943805222)
(+ (- (* (* 18.0 y) (* x (* z t))) t_1) (- (* c b) (* 27.0 (* k j))))
t_2))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = ((a * t) + (i * x)) * 4.0;
double t_2 = (((18.0 * t) * ((x * y) * z)) - t_1) - (((k * j) * 27.0) - (c * b));
double tmp;
if (t < -1.6210815397541398e-69) {
tmp = t_2;
} else if (t < 165.68027943805222) {
tmp = (((18.0 * y) * (x * (z * t))) - t_1) + ((c * b) - (27.0 * (k * j)));
} else {
tmp = t_2;
}
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, j, k)
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), intent (in) :: j
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ((a * t) + (i * x)) * 4.0d0
t_2 = (((18.0d0 * t) * ((x * y) * z)) - t_1) - (((k * j) * 27.0d0) - (c * b))
if (t < (-1.6210815397541398d-69)) then
tmp = t_2
else if (t < 165.68027943805222d0) then
tmp = (((18.0d0 * y) * (x * (z * t))) - t_1) + ((c * b) - (27.0d0 * (k * j)))
else
tmp = t_2
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 j, double k) {
double t_1 = ((a * t) + (i * x)) * 4.0;
double t_2 = (((18.0 * t) * ((x * y) * z)) - t_1) - (((k * j) * 27.0) - (c * b));
double tmp;
if (t < -1.6210815397541398e-69) {
tmp = t_2;
} else if (t < 165.68027943805222) {
tmp = (((18.0 * y) * (x * (z * t))) - t_1) + ((c * b) - (27.0 * (k * j)));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j, k): t_1 = ((a * t) + (i * x)) * 4.0 t_2 = (((18.0 * t) * ((x * y) * z)) - t_1) - (((k * j) * 27.0) - (c * b)) tmp = 0 if t < -1.6210815397541398e-69: tmp = t_2 elif t < 165.68027943805222: tmp = (((18.0 * y) * (x * (z * t))) - t_1) + ((c * b) - (27.0 * (k * j))) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(Float64(Float64(a * t) + Float64(i * x)) * 4.0) t_2 = Float64(Float64(Float64(Float64(18.0 * t) * Float64(Float64(x * y) * z)) - t_1) - Float64(Float64(Float64(k * j) * 27.0) - Float64(c * b))) tmp = 0.0 if (t < -1.6210815397541398e-69) tmp = t_2; elseif (t < 165.68027943805222) tmp = Float64(Float64(Float64(Float64(18.0 * y) * Float64(x * Float64(z * t))) - t_1) + Float64(Float64(c * b) - Float64(27.0 * Float64(k * j)))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k) t_1 = ((a * t) + (i * x)) * 4.0; t_2 = (((18.0 * t) * ((x * y) * z)) - t_1) - (((k * j) * 27.0) - (c * b)); tmp = 0.0; if (t < -1.6210815397541398e-69) tmp = t_2; elseif (t < 165.68027943805222) tmp = (((18.0 * y) * (x * (z * t))) - t_1) + ((c * b) - (27.0 * (k * j))); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(N[(a * t), $MachinePrecision] + N[(i * x), $MachinePrecision]), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(18.0 * t), $MachinePrecision] * N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] - N[(N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision] - N[(c * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -1.6210815397541398e-69], t$95$2, If[Less[t, 165.68027943805222], N[(N[(N[(N[(18.0 * y), $MachinePrecision] * N[(x * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] + N[(N[(c * b), $MachinePrecision] - N[(27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot t + i \cdot x\right) \cdot 4\\
t_2 := \left(\left(18 \cdot t\right) \cdot \left(\left(x \cdot y\right) \cdot z\right) - t\_1\right) - \left(\left(k \cdot j\right) \cdot 27 - c \cdot b\right)\\
\mathbf{if}\;t < -1.6210815397541398 \cdot 10^{-69}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t < 165.68027943805222:\\
\;\;\;\;\left(\left(18 \cdot y\right) \cdot \left(x \cdot \left(z \cdot t\right)\right) - t\_1\right) + \left(c \cdot b - 27 \cdot \left(k \cdot j\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2025091
(FPCore (x y z t a b c i j k)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, E"
:precision binary64
:alt
(! :herbie-platform default (if (< t -8105407698770699/5000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (- (* (* 18 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4)) (- (* (* k j) 27) (* c b))) (if (< t 8284013971902611/50000000000000) (+ (- (* (* 18 y) (* x (* z t))) (* (+ (* a t) (* i x)) 4)) (- (* c b) (* 27 (* k j)))) (- (- (* (* 18 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4)) (- (* (* k j) 27) (* c b))))))
(- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)))