
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * 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, j)
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
code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i))); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * 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, j)
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
code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i))); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)
\end{array}
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i))))
(* j (- (* c a) (* y i))))))
(if (<= t_1 INFINITY) t_1 (* (fma (- t) a (* z y)) x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(-t, a, (z * y)) * x;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(fma(Float64(-t), a, Float64(z * y)) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[((-t) * a + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-t, a, z \cdot y\right) \cdot x\\
\end{array}
\end{array}
if (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) < +inf.0Initial program 91.1%
if +inf.0 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) Initial program 0.0%
Taylor expanded in x around inf
Applied rewrites55.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- i) j (* z x)) y))
(t_2 (fma (* i t) b (fma (fma (- t) x (* j c)) a t_1))))
(if (<= a -2.3e-116)
t_2
(if (<= a -1.12e-281)
(fma (fma (- t) a (* z y)) x (* (fma (- y) j (* b t)) i))
(if (<= a 2.1e-66) (fma (fma (- c) z (* i t)) b t_1) t_2)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-i, j, (z * x)) * y;
double t_2 = fma((i * t), b, fma(fma(-t, x, (j * c)), a, t_1));
double tmp;
if (a <= -2.3e-116) {
tmp = t_2;
} else if (a <= -1.12e-281) {
tmp = fma(fma(-t, a, (z * y)), x, (fma(-y, j, (b * t)) * i));
} else if (a <= 2.1e-66) {
tmp = fma(fma(-c, z, (i * t)), b, t_1);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-i), j, Float64(z * x)) * y) t_2 = fma(Float64(i * t), b, fma(fma(Float64(-t), x, Float64(j * c)), a, t_1)) tmp = 0.0 if (a <= -2.3e-116) tmp = t_2; elseif (a <= -1.12e-281) tmp = fma(fma(Float64(-t), a, Float64(z * y)), x, Float64(fma(Float64(-y), j, Float64(b * t)) * i)); elseif (a <= 2.1e-66) tmp = fma(fma(Float64(-c), z, Float64(i * t)), b, t_1); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(i * t), $MachinePrecision] * b + N[(N[((-t) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * a + t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2.3e-116], t$95$2, If[LessEqual[a, -1.12e-281], N[(N[((-t) * a + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[(N[((-y) * j + N[(b * t), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.1e-66], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b + t$95$1), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
t_2 := \mathsf{fma}\left(i \cdot t, b, \mathsf{fma}\left(\mathsf{fma}\left(-t, x, j \cdot c\right), a, t\_1\right)\right)\\
\mathbf{if}\;a \leq -2.3 \cdot 10^{-116}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \leq -1.12 \cdot 10^{-281}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-t, a, z \cdot y\right), x, \mathsf{fma}\left(-y, j, b \cdot t\right) \cdot i\right)\\
\mathbf{elif}\;a \leq 2.1 \cdot 10^{-66}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-c, z, i \cdot t\right), b, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if a < -2.30000000000000002e-116 or 2.1e-66 < a Initial program 69.6%
Taylor expanded in y around 0
Applied rewrites83.5%
Taylor expanded in z around 0
Applied rewrites80.2%
if -2.30000000000000002e-116 < a < -1.12e-281Initial program 84.5%
Taylor expanded in c around 0
Applied rewrites85.4%
if -1.12e-281 < a < 2.1e-66Initial program 80.3%
Taylor expanded in a around 0
Applied rewrites78.2%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= i 1.45e+226)
(fma
(fma (- c) z (* i t))
b
(fma (fma (- t) x (* j c)) a (* (fma (- i) j (* z x)) y)))
(* (fma (- y) j (* b t)) i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (i <= 1.45e+226) {
tmp = fma(fma(-c, z, (i * t)), b, fma(fma(-t, x, (j * c)), a, (fma(-i, j, (z * x)) * y)));
} else {
tmp = fma(-y, j, (b * t)) * i;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (i <= 1.45e+226) tmp = fma(fma(Float64(-c), z, Float64(i * t)), b, fma(fma(Float64(-t), x, Float64(j * c)), a, Float64(fma(Float64(-i), j, Float64(z * x)) * y))); else tmp = Float64(fma(Float64(-y), j, Float64(b * t)) * i); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[i, 1.45e+226], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b + N[(N[((-t) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * a + N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-y) * j + N[(b * t), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.45 \cdot 10^{+226}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-c, z, i \cdot t\right), b, \mathsf{fma}\left(\mathsf{fma}\left(-t, x, j \cdot c\right), a, \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, j, b \cdot t\right) \cdot i\\
\end{array}
\end{array}
if i < 1.44999999999999987e226Initial program 75.2%
Taylor expanded in y around 0
Applied rewrites80.8%
if 1.44999999999999987e226 < i Initial program 62.7%
Taylor expanded in i around inf
Applied rewrites95.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (- t) a (* z y)))
(t_2 (fma (- c) z (* i t)))
(t_3 (* (fma (- y) j (* b t)) i)))
(if (<= i -2.3e+249)
(* t_2 b)
(if (<= i -1.1e-24)
(fma t_1 x t_3)
(if (<= i 170000000000.0)
(fma t_1 x (* (fma (- z) b (* j a)) c))
(if (<= i 3e+208) (fma t_2 b (* (fma (- i) j (* z x)) y)) t_3))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-t, a, (z * y));
double t_2 = fma(-c, z, (i * t));
double t_3 = fma(-y, j, (b * t)) * i;
double tmp;
if (i <= -2.3e+249) {
tmp = t_2 * b;
} else if (i <= -1.1e-24) {
tmp = fma(t_1, x, t_3);
} else if (i <= 170000000000.0) {
tmp = fma(t_1, x, (fma(-z, b, (j * a)) * c));
} else if (i <= 3e+208) {
tmp = fma(t_2, b, (fma(-i, j, (z * x)) * y));
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(Float64(-t), a, Float64(z * y)) t_2 = fma(Float64(-c), z, Float64(i * t)) t_3 = Float64(fma(Float64(-y), j, Float64(b * t)) * i) tmp = 0.0 if (i <= -2.3e+249) tmp = Float64(t_2 * b); elseif (i <= -1.1e-24) tmp = fma(t_1, x, t_3); elseif (i <= 170000000000.0) tmp = fma(t_1, x, Float64(fma(Float64(-z), b, Float64(j * a)) * c)); elseif (i <= 3e+208) tmp = fma(t_2, b, Float64(fma(Float64(-i), j, Float64(z * x)) * y)); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-t) * a + N[(z * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[((-y) * j + N[(b * t), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[i, -2.3e+249], N[(t$95$2 * b), $MachinePrecision], If[LessEqual[i, -1.1e-24], N[(t$95$1 * x + t$95$3), $MachinePrecision], If[LessEqual[i, 170000000000.0], N[(t$95$1 * x + N[(N[((-z) * b + N[(j * a), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3e+208], N[(t$95$2 * b + N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-t, a, z \cdot y\right)\\
t_2 := \mathsf{fma}\left(-c, z, i \cdot t\right)\\
t_3 := \mathsf{fma}\left(-y, j, b \cdot t\right) \cdot i\\
\mathbf{if}\;i \leq -2.3 \cdot 10^{+249}:\\
\;\;\;\;t\_2 \cdot b\\
\mathbf{elif}\;i \leq -1.1 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, x, t\_3\right)\\
\mathbf{elif}\;i \leq 170000000000:\\
\;\;\;\;\mathsf{fma}\left(t\_1, x, \mathsf{fma}\left(-z, b, j \cdot a\right) \cdot c\right)\\
\mathbf{elif}\;i \leq 3 \cdot 10^{+208}:\\
\;\;\;\;\mathsf{fma}\left(t\_2, b, \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if i < -2.2999999999999998e249Initial program 44.4%
Taylor expanded in b around inf
Applied rewrites77.8%
if -2.2999999999999998e249 < i < -1.10000000000000001e-24Initial program 80.5%
Taylor expanded in c around 0
Applied rewrites82.3%
if -1.10000000000000001e-24 < i < 1.7e11Initial program 77.1%
Taylor expanded in i around 0
Applied rewrites74.9%
if 1.7e11 < i < 2.99999999999999995e208Initial program 67.5%
Taylor expanded in a around 0
Applied rewrites77.0%
if 2.99999999999999995e208 < i Initial program 64.5%
Taylor expanded in i around inf
Applied rewrites86.8%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= x -1.85e-156) (not (<= x 4.5e-112))) (fma (fma (- t) a (* z y)) x (* (fma (- y) j (* b t)) i)) (+ (* (* (- z) b) c) (* j (- (* c a) (* y i))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((x <= -1.85e-156) || !(x <= 4.5e-112)) {
tmp = fma(fma(-t, a, (z * y)), x, (fma(-y, j, (b * t)) * i));
} else {
tmp = ((-z * b) * c) + (j * ((c * a) - (y * i)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((x <= -1.85e-156) || !(x <= 4.5e-112)) tmp = fma(fma(Float64(-t), a, Float64(z * y)), x, Float64(fma(Float64(-y), j, Float64(b * t)) * i)); else tmp = Float64(Float64(Float64(Float64(-z) * b) * c) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[x, -1.85e-156], N[Not[LessEqual[x, 4.5e-112]], $MachinePrecision]], N[(N[((-t) * a + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[(N[((-y) * j + N[(b * t), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-z) * b), $MachinePrecision] * c), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{-156} \lor \neg \left(x \leq 4.5 \cdot 10^{-112}\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-t, a, z \cdot y\right), x, \mathsf{fma}\left(-y, j, b \cdot t\right) \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-z\right) \cdot b\right) \cdot c + j \cdot \left(c \cdot a - y \cdot i\right)\\
\end{array}
\end{array}
if x < -1.85e-156 or 4.50000000000000012e-112 < x Initial program 77.2%
Taylor expanded in c around 0
Applied rewrites75.3%
if -1.85e-156 < x < 4.50000000000000012e-112Initial program 65.9%
Taylor expanded in c around inf
Applied rewrites66.3%
Final simplification72.8%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= a -3.1e-70) (not (<= a 7000000.0))) (fma (fma (- t) a (* z y)) x (* (* j a) c)) (fma (fma (- c) z (* i t)) b (* (fma (- i) j (* z x)) y))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((a <= -3.1e-70) || !(a <= 7000000.0)) {
tmp = fma(fma(-t, a, (z * y)), x, ((j * a) * c));
} else {
tmp = fma(fma(-c, z, (i * t)), b, (fma(-i, j, (z * x)) * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((a <= -3.1e-70) || !(a <= 7000000.0)) tmp = fma(fma(Float64(-t), a, Float64(z * y)), x, Float64(Float64(j * a) * c)); else tmp = fma(fma(Float64(-c), z, Float64(i * t)), b, Float64(fma(Float64(-i), j, Float64(z * x)) * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[a, -3.1e-70], N[Not[LessEqual[a, 7000000.0]], $MachinePrecision]], N[(N[((-t) * a + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[(N[(j * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b + N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.1 \cdot 10^{-70} \lor \neg \left(a \leq 7000000\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-t, a, z \cdot y\right), x, \left(j \cdot a\right) \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-c, z, i \cdot t\right), b, \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\right)\\
\end{array}
\end{array}
if a < -3.1e-70 or 7e6 < a Initial program 66.7%
Taylor expanded in i around 0
Applied rewrites72.6%
Taylor expanded in z around 0
Applied rewrites69.8%
if -3.1e-70 < a < 7e6Initial program 82.8%
Taylor expanded in a around 0
Applied rewrites75.3%
Final simplification72.3%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= i -1.95e+249)
(* (fma (- c) z (* i t)) b)
(if (<= i -2.1e-25)
(fma (* i t) b (* (fma (- j) i (* z x)) y))
(if (<= i -1.1e-249)
(* (fma (- t) x (* j c)) a)
(if (<= i 9.5e-286)
(* (fma (- b) c (* y x)) z)
(if (<= i 250000.0)
(* (fma z y (* (- t) a)) x)
(* (fma (- y) j (* b t)) i)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (i <= -1.95e+249) {
tmp = fma(-c, z, (i * t)) * b;
} else if (i <= -2.1e-25) {
tmp = fma((i * t), b, (fma(-j, i, (z * x)) * y));
} else if (i <= -1.1e-249) {
tmp = fma(-t, x, (j * c)) * a;
} else if (i <= 9.5e-286) {
tmp = fma(-b, c, (y * x)) * z;
} else if (i <= 250000.0) {
tmp = fma(z, y, (-t * a)) * x;
} else {
tmp = fma(-y, j, (b * t)) * i;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (i <= -1.95e+249) tmp = Float64(fma(Float64(-c), z, Float64(i * t)) * b); elseif (i <= -2.1e-25) tmp = fma(Float64(i * t), b, Float64(fma(Float64(-j), i, Float64(z * x)) * y)); elseif (i <= -1.1e-249) tmp = Float64(fma(Float64(-t), x, Float64(j * c)) * a); elseif (i <= 9.5e-286) tmp = Float64(fma(Float64(-b), c, Float64(y * x)) * z); elseif (i <= 250000.0) tmp = Float64(fma(z, y, Float64(Float64(-t) * a)) * x); else tmp = Float64(fma(Float64(-y), j, Float64(b * t)) * i); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[i, -1.95e+249], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[i, -2.1e-25], N[(N[(i * t), $MachinePrecision] * b + N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, -1.1e-249], N[(N[((-t) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[i, 9.5e-286], N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[i, 250000.0], N[(N[(z * y + N[((-t) * a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[((-y) * j + N[(b * t), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.95 \cdot 10^{+249}:\\
\;\;\;\;\mathsf{fma}\left(-c, z, i \cdot t\right) \cdot b\\
\mathbf{elif}\;i \leq -2.1 \cdot 10^{-25}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot t, b, \mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\right)\\
\mathbf{elif}\;i \leq -1.1 \cdot 10^{-249}:\\
\;\;\;\;\mathsf{fma}\left(-t, x, j \cdot c\right) \cdot a\\
\mathbf{elif}\;i \leq 9.5 \cdot 10^{-286}:\\
\;\;\;\;\mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{elif}\;i \leq 250000:\\
\;\;\;\;\mathsf{fma}\left(z, y, \left(-t\right) \cdot a\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, j, b \cdot t\right) \cdot i\\
\end{array}
\end{array}
if i < -1.9499999999999998e249Initial program 44.4%
Taylor expanded in b around inf
Applied rewrites77.8%
if -1.9499999999999998e249 < i < -2.10000000000000002e-25Initial program 80.5%
Taylor expanded in y around 0
Applied rewrites75.5%
Taylor expanded in z around 0
Applied rewrites77.6%
Taylor expanded in y around inf
Applied rewrites70.5%
if -2.10000000000000002e-25 < i < -1.1e-249Initial program 74.7%
Taylor expanded in a around inf
Applied rewrites58.1%
if -1.1e-249 < i < 9.5000000000000004e-286Initial program 73.3%
Taylor expanded in z around inf
Applied rewrites73.7%
if 9.5000000000000004e-286 < i < 2.5e5Initial program 81.1%
Taylor expanded in x around inf
Applied rewrites64.8%
Applied rewrites64.8%
if 2.5e5 < i Initial program 66.8%
Taylor expanded in i around inf
Applied rewrites70.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- t) x (* j c)) a)))
(if (<= a -1.9e+169)
t_1
(if (<= a -3.2e+52)
(* (fma z y (* (- t) a)) x)
(if (<= a -1.7e-262)
(* (fma (- i) j (* z x)) y)
(if (<= a 3.5e-169)
(* (fma (- b) c (* y x)) z)
(if (<= a 1400000.0) (* (fma (- c) z (* i t)) b) t_1)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-t, x, (j * c)) * a;
double tmp;
if (a <= -1.9e+169) {
tmp = t_1;
} else if (a <= -3.2e+52) {
tmp = fma(z, y, (-t * a)) * x;
} else if (a <= -1.7e-262) {
tmp = fma(-i, j, (z * x)) * y;
} else if (a <= 3.5e-169) {
tmp = fma(-b, c, (y * x)) * z;
} else if (a <= 1400000.0) {
tmp = fma(-c, z, (i * t)) * b;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-t), x, Float64(j * c)) * a) tmp = 0.0 if (a <= -1.9e+169) tmp = t_1; elseif (a <= -3.2e+52) tmp = Float64(fma(z, y, Float64(Float64(-t) * a)) * x); elseif (a <= -1.7e-262) tmp = Float64(fma(Float64(-i), j, Float64(z * x)) * y); elseif (a <= 3.5e-169) tmp = Float64(fma(Float64(-b), c, Float64(y * x)) * z); elseif (a <= 1400000.0) tmp = Float64(fma(Float64(-c), z, Float64(i * t)) * b); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-t) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -1.9e+169], t$95$1, If[LessEqual[a, -3.2e+52], N[(N[(z * y + N[((-t) * a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[a, -1.7e-262], N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[a, 3.5e-169], N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[a, 1400000.0], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-t, x, j \cdot c\right) \cdot a\\
\mathbf{if}\;a \leq -1.9 \cdot 10^{+169}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -3.2 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(z, y, \left(-t\right) \cdot a\right) \cdot x\\
\mathbf{elif}\;a \leq -1.7 \cdot 10^{-262}:\\
\;\;\;\;\mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\mathbf{elif}\;a \leq 3.5 \cdot 10^{-169}:\\
\;\;\;\;\mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{elif}\;a \leq 1400000:\\
\;\;\;\;\mathsf{fma}\left(-c, z, i \cdot t\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.89999999999999996e169 or 1.4e6 < a Initial program 66.0%
Taylor expanded in a around inf
Applied rewrites63.6%
if -1.89999999999999996e169 < a < -3.2e52Initial program 65.6%
Taylor expanded in x around inf
Applied rewrites62.4%
Applied rewrites66.3%
if -3.2e52 < a < -1.69999999999999995e-262Initial program 79.1%
Taylor expanded in y around inf
Applied rewrites60.4%
if -1.69999999999999995e-262 < a < 3.5000000000000003e-169Initial program 83.0%
Taylor expanded in z around inf
Applied rewrites72.6%
if 3.5000000000000003e-169 < a < 1.4e6Initial program 81.9%
Taylor expanded in b around inf
Applied rewrites55.3%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= a -1.36e-70) (not (<= a 120000.0))) (fma (fma (- t) a (* z y)) x (* (* j a) c)) (fma (fma (- c) z (* i t)) b (* (* (- j) y) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((a <= -1.36e-70) || !(a <= 120000.0)) {
tmp = fma(fma(-t, a, (z * y)), x, ((j * a) * c));
} else {
tmp = fma(fma(-c, z, (i * t)), b, ((-j * y) * i));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((a <= -1.36e-70) || !(a <= 120000.0)) tmp = fma(fma(Float64(-t), a, Float64(z * y)), x, Float64(Float64(j * a) * c)); else tmp = fma(fma(Float64(-c), z, Float64(i * t)), b, Float64(Float64(Float64(-j) * y) * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[a, -1.36e-70], N[Not[LessEqual[a, 120000.0]], $MachinePrecision]], N[(N[((-t) * a + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[(N[(j * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b + N[(N[((-j) * y), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.36 \cdot 10^{-70} \lor \neg \left(a \leq 120000\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-t, a, z \cdot y\right), x, \left(j \cdot a\right) \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-c, z, i \cdot t\right), b, \left(\left(-j\right) \cdot y\right) \cdot i\right)\\
\end{array}
\end{array}
if a < -1.36000000000000001e-70 or 1.2e5 < a Initial program 66.7%
Taylor expanded in i around 0
Applied rewrites72.6%
Taylor expanded in z around 0
Applied rewrites69.8%
if -1.36000000000000001e-70 < a < 1.2e5Initial program 82.8%
Taylor expanded in y around 0
Applied rewrites72.9%
Taylor expanded in i around inf
Applied rewrites68.7%
Final simplification69.3%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= a -7e-71) (not (<= a 80000.0))) (fma (fma (- t) a (* z y)) x (* (* j a) c)) (fma (fma (- c) z (* i t)) b (* (* (- i) y) j))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((a <= -7e-71) || !(a <= 80000.0)) {
tmp = fma(fma(-t, a, (z * y)), x, ((j * a) * c));
} else {
tmp = fma(fma(-c, z, (i * t)), b, ((-i * y) * j));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((a <= -7e-71) || !(a <= 80000.0)) tmp = fma(fma(Float64(-t), a, Float64(z * y)), x, Float64(Float64(j * a) * c)); else tmp = fma(fma(Float64(-c), z, Float64(i * t)), b, Float64(Float64(Float64(-i) * y) * j)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[a, -7e-71], N[Not[LessEqual[a, 80000.0]], $MachinePrecision]], N[(N[((-t) * a + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[(N[(j * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b + N[(N[((-i) * y), $MachinePrecision] * j), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7 \cdot 10^{-71} \lor \neg \left(a \leq 80000\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-t, a, z \cdot y\right), x, \left(j \cdot a\right) \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-c, z, i \cdot t\right), b, \left(\left(-i\right) \cdot y\right) \cdot j\right)\\
\end{array}
\end{array}
if a < -6.9999999999999998e-71 or 8e4 < a Initial program 66.7%
Taylor expanded in i around 0
Applied rewrites72.6%
Taylor expanded in z around 0
Applied rewrites69.8%
if -6.9999999999999998e-71 < a < 8e4Initial program 82.8%
Taylor expanded in y around 0
Applied rewrites72.9%
Taylor expanded in i around inf
Applied rewrites68.7%
Applied rewrites67.2%
Final simplification68.6%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= i -7e-25)
(fma (* i t) b (* (* z y) x))
(if (<= i -1.1e-249)
(* (fma (- t) x (* j c)) a)
(if (<= i 9.5e-286)
(* (fma (- b) c (* y x)) z)
(if (<= i 250000.0)
(* (fma z y (* (- t) a)) x)
(* (fma (- y) j (* b t)) i))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (i <= -7e-25) {
tmp = fma((i * t), b, ((z * y) * x));
} else if (i <= -1.1e-249) {
tmp = fma(-t, x, (j * c)) * a;
} else if (i <= 9.5e-286) {
tmp = fma(-b, c, (y * x)) * z;
} else if (i <= 250000.0) {
tmp = fma(z, y, (-t * a)) * x;
} else {
tmp = fma(-y, j, (b * t)) * i;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (i <= -7e-25) tmp = fma(Float64(i * t), b, Float64(Float64(z * y) * x)); elseif (i <= -1.1e-249) tmp = Float64(fma(Float64(-t), x, Float64(j * c)) * a); elseif (i <= 9.5e-286) tmp = Float64(fma(Float64(-b), c, Float64(y * x)) * z); elseif (i <= 250000.0) tmp = Float64(fma(z, y, Float64(Float64(-t) * a)) * x); else tmp = Float64(fma(Float64(-y), j, Float64(b * t)) * i); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[i, -7e-25], N[(N[(i * t), $MachinePrecision] * b + N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, -1.1e-249], N[(N[((-t) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[i, 9.5e-286], N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[i, 250000.0], N[(N[(z * y + N[((-t) * a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[((-y) * j + N[(b * t), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -7 \cdot 10^{-25}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot t, b, \left(z \cdot y\right) \cdot x\right)\\
\mathbf{elif}\;i \leq -1.1 \cdot 10^{-249}:\\
\;\;\;\;\mathsf{fma}\left(-t, x, j \cdot c\right) \cdot a\\
\mathbf{elif}\;i \leq 9.5 \cdot 10^{-286}:\\
\;\;\;\;\mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{elif}\;i \leq 250000:\\
\;\;\;\;\mathsf{fma}\left(z, y, \left(-t\right) \cdot a\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, j, b \cdot t\right) \cdot i\\
\end{array}
\end{array}
if i < -7.0000000000000004e-25Initial program 75.5%
Taylor expanded in y around 0
Applied rewrites71.2%
Taylor expanded in z around 0
Applied rewrites70.0%
Taylor expanded in z around inf
Applied rewrites57.9%
if -7.0000000000000004e-25 < i < -1.1e-249Initial program 74.7%
Taylor expanded in a around inf
Applied rewrites58.1%
if -1.1e-249 < i < 9.5000000000000004e-286Initial program 73.3%
Taylor expanded in z around inf
Applied rewrites73.7%
if 9.5000000000000004e-286 < i < 2.5e5Initial program 81.1%
Taylor expanded in x around inf
Applied rewrites64.8%
Applied rewrites64.8%
if 2.5e5 < i Initial program 66.8%
Taylor expanded in i around inf
Applied rewrites70.0%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= i -7e-25)
(* (fma (- c) z (* i t)) b)
(if (<= i -1.1e-249)
(* (fma (- t) x (* j c)) a)
(if (<= i 9.5e-286)
(* (fma (- b) c (* y x)) z)
(if (<= i 250000.0)
(* (fma z y (* (- t) a)) x)
(* (fma (- y) j (* b t)) i))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (i <= -7e-25) {
tmp = fma(-c, z, (i * t)) * b;
} else if (i <= -1.1e-249) {
tmp = fma(-t, x, (j * c)) * a;
} else if (i <= 9.5e-286) {
tmp = fma(-b, c, (y * x)) * z;
} else if (i <= 250000.0) {
tmp = fma(z, y, (-t * a)) * x;
} else {
tmp = fma(-y, j, (b * t)) * i;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (i <= -7e-25) tmp = Float64(fma(Float64(-c), z, Float64(i * t)) * b); elseif (i <= -1.1e-249) tmp = Float64(fma(Float64(-t), x, Float64(j * c)) * a); elseif (i <= 9.5e-286) tmp = Float64(fma(Float64(-b), c, Float64(y * x)) * z); elseif (i <= 250000.0) tmp = Float64(fma(z, y, Float64(Float64(-t) * a)) * x); else tmp = Float64(fma(Float64(-y), j, Float64(b * t)) * i); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[i, -7e-25], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[i, -1.1e-249], N[(N[((-t) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[i, 9.5e-286], N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[i, 250000.0], N[(N[(z * y + N[((-t) * a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[((-y) * j + N[(b * t), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -7 \cdot 10^{-25}:\\
\;\;\;\;\mathsf{fma}\left(-c, z, i \cdot t\right) \cdot b\\
\mathbf{elif}\;i \leq -1.1 \cdot 10^{-249}:\\
\;\;\;\;\mathsf{fma}\left(-t, x, j \cdot c\right) \cdot a\\
\mathbf{elif}\;i \leq 9.5 \cdot 10^{-286}:\\
\;\;\;\;\mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{elif}\;i \leq 250000:\\
\;\;\;\;\mathsf{fma}\left(z, y, \left(-t\right) \cdot a\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, j, b \cdot t\right) \cdot i\\
\end{array}
\end{array}
if i < -7.0000000000000004e-25Initial program 75.5%
Taylor expanded in b around inf
Applied rewrites54.6%
if -7.0000000000000004e-25 < i < -1.1e-249Initial program 74.7%
Taylor expanded in a around inf
Applied rewrites58.1%
if -1.1e-249 < i < 9.5000000000000004e-286Initial program 73.3%
Taylor expanded in z around inf
Applied rewrites73.7%
if 9.5000000000000004e-286 < i < 2.5e5Initial program 81.1%
Taylor expanded in x around inf
Applied rewrites64.8%
Applied rewrites64.8%
if 2.5e5 < i Initial program 66.8%
Taylor expanded in i around inf
Applied rewrites70.0%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= a -1.3e-70) (not (<= a 1.9e-65))) (fma (fma (- t) a (* z y)) x (* (* j a) c)) (fma (fma (- c) z (* i t)) b (* (* z y) x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((a <= -1.3e-70) || !(a <= 1.9e-65)) {
tmp = fma(fma(-t, a, (z * y)), x, ((j * a) * c));
} else {
tmp = fma(fma(-c, z, (i * t)), b, ((z * y) * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((a <= -1.3e-70) || !(a <= 1.9e-65)) tmp = fma(fma(Float64(-t), a, Float64(z * y)), x, Float64(Float64(j * a) * c)); else tmp = fma(fma(Float64(-c), z, Float64(i * t)), b, Float64(Float64(z * y) * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[a, -1.3e-70], N[Not[LessEqual[a, 1.9e-65]], $MachinePrecision]], N[(N[((-t) * a + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[(N[(j * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b + N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.3 \cdot 10^{-70} \lor \neg \left(a \leq 1.9 \cdot 10^{-65}\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-t, a, z \cdot y\right), x, \left(j \cdot a\right) \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-c, z, i \cdot t\right), b, \left(z \cdot y\right) \cdot x\right)\\
\end{array}
\end{array}
if a < -1.30000000000000001e-70 or 1.9000000000000001e-65 < a Initial program 68.7%
Taylor expanded in i around 0
Applied rewrites70.8%
Taylor expanded in z around 0
Applied rewrites67.7%
if -1.30000000000000001e-70 < a < 1.9000000000000001e-65Initial program 82.2%
Taylor expanded in y around 0
Applied rewrites69.9%
Taylor expanded in z around inf
Applied rewrites66.2%
Final simplification67.1%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= y -5.5e+80) (not (<= y 1e+70))) (* (fma (- i) j (* z x)) y) (* (fma (- x) a (* i b)) t)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((y <= -5.5e+80) || !(y <= 1e+70)) {
tmp = fma(-i, j, (z * x)) * y;
} else {
tmp = fma(-x, a, (i * b)) * t;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((y <= -5.5e+80) || !(y <= 1e+70)) tmp = Float64(fma(Float64(-i), j, Float64(z * x)) * y); else tmp = Float64(fma(Float64(-x), a, Float64(i * b)) * t); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[y, -5.5e+80], N[Not[LessEqual[y, 1e+70]], $MachinePrecision]], N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[((-x) * a + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+80} \lor \neg \left(y \leq 10^{+70}\right):\\
\;\;\;\;\mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-x, a, i \cdot b\right) \cdot t\\
\end{array}
\end{array}
if y < -5.49999999999999967e80 or 1.00000000000000007e70 < y Initial program 62.4%
Taylor expanded in y around inf
Applied rewrites75.5%
if -5.49999999999999967e80 < y < 1.00000000000000007e70Initial program 80.9%
Taylor expanded in t around inf
Applied rewrites50.4%
Final simplification59.7%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= y -1.4e+81) (not (<= y 2e+50))) (* (fma (- i) j (* z x)) y) (* (fma (- c) z (* i t)) b)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((y <= -1.4e+81) || !(y <= 2e+50)) {
tmp = fma(-i, j, (z * x)) * y;
} else {
tmp = fma(-c, z, (i * t)) * b;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((y <= -1.4e+81) || !(y <= 2e+50)) tmp = Float64(fma(Float64(-i), j, Float64(z * x)) * y); else tmp = Float64(fma(Float64(-c), z, Float64(i * t)) * b); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[y, -1.4e+81], N[Not[LessEqual[y, 2e+50]], $MachinePrecision]], N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+81} \lor \neg \left(y \leq 2 \cdot 10^{+50}\right):\\
\;\;\;\;\mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-c, z, i \cdot t\right) \cdot b\\
\end{array}
\end{array}
if y < -1.39999999999999997e81 or 2.0000000000000002e50 < y Initial program 64.3%
Taylor expanded in y around inf
Applied rewrites72.8%
if -1.39999999999999997e81 < y < 2.0000000000000002e50Initial program 80.3%
Taylor expanded in b around inf
Applied rewrites45.9%
Final simplification56.4%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= x -9.5e-111) (not (<= x 4.4e+74))) (* (fma z y (* (- t) a)) x) (* (fma (- c) z (* i t)) b)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((x <= -9.5e-111) || !(x <= 4.4e+74)) {
tmp = fma(z, y, (-t * a)) * x;
} else {
tmp = fma(-c, z, (i * t)) * b;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((x <= -9.5e-111) || !(x <= 4.4e+74)) tmp = Float64(fma(z, y, Float64(Float64(-t) * a)) * x); else tmp = Float64(fma(Float64(-c), z, Float64(i * t)) * b); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[x, -9.5e-111], N[Not[LessEqual[x, 4.4e+74]], $MachinePrecision]], N[(N[(z * y + N[((-t) * a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-111} \lor \neg \left(x \leq 4.4 \cdot 10^{+74}\right):\\
\;\;\;\;\mathsf{fma}\left(z, y, \left(-t\right) \cdot a\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-c, z, i \cdot t\right) \cdot b\\
\end{array}
\end{array}
if x < -9.4999999999999995e-111 or 4.4000000000000002e74 < x Initial program 75.1%
Taylor expanded in x around inf
Applied rewrites62.9%
Applied rewrites62.9%
if -9.4999999999999995e-111 < x < 4.4000000000000002e74Initial program 72.9%
Taylor expanded in b around inf
Applied rewrites45.1%
Final simplification54.5%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= a -5.8e-18) (not (<= a 3.4e-66))) (* (fma z y (* (- t) a)) x) (* (fma (- b) c (* y x)) z)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((a <= -5.8e-18) || !(a <= 3.4e-66)) {
tmp = fma(z, y, (-t * a)) * x;
} else {
tmp = fma(-b, c, (y * x)) * z;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((a <= -5.8e-18) || !(a <= 3.4e-66)) tmp = Float64(fma(z, y, Float64(Float64(-t) * a)) * x); else tmp = Float64(fma(Float64(-b), c, Float64(y * x)) * z); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[a, -5.8e-18], N[Not[LessEqual[a, 3.4e-66]], $MachinePrecision]], N[(N[(z * y + N[((-t) * a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.8 \cdot 10^{-18} \lor \neg \left(a \leq 3.4 \cdot 10^{-66}\right):\\
\;\;\;\;\mathsf{fma}\left(z, y, \left(-t\right) \cdot a\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\end{array}
\end{array}
if a < -5.8e-18 or 3.39999999999999997e-66 < a Initial program 68.5%
Taylor expanded in x around inf
Applied rewrites52.1%
Applied rewrites51.4%
if -5.8e-18 < a < 3.39999999999999997e-66Initial program 82.0%
Taylor expanded in z around inf
Applied rewrites53.3%
Final simplification52.2%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= x -5.6e-151) (not (<= x 1.25e-98))) (* (fma z y (* (- t) a)) x) (* (- b) (* c z))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((x <= -5.6e-151) || !(x <= 1.25e-98)) {
tmp = fma(z, y, (-t * a)) * x;
} else {
tmp = -b * (c * z);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((x <= -5.6e-151) || !(x <= 1.25e-98)) tmp = Float64(fma(z, y, Float64(Float64(-t) * a)) * x); else tmp = Float64(Float64(-b) * Float64(c * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[x, -5.6e-151], N[Not[LessEqual[x, 1.25e-98]], $MachinePrecision]], N[(N[(z * y + N[((-t) * a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[((-b) * N[(c * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{-151} \lor \neg \left(x \leq 1.25 \cdot 10^{-98}\right):\\
\;\;\;\;\mathsf{fma}\left(z, y, \left(-t\right) \cdot a\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(-b\right) \cdot \left(c \cdot z\right)\\
\end{array}
\end{array}
if x < -5.6000000000000002e-151 or 1.25000000000000005e-98 < x Initial program 77.7%
Taylor expanded in x around inf
Applied rewrites55.4%
Applied rewrites55.4%
if -5.6000000000000002e-151 < x < 1.25000000000000005e-98Initial program 65.5%
Taylor expanded in i around 0
Applied rewrites49.6%
Taylor expanded in j around inf
Applied rewrites25.2%
Taylor expanded in b around inf
Applied rewrites30.1%
Final simplification47.8%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= y -1.25e+90) (not (<= y 1.8e+181))) (* (* y x) z) (* (* b t) i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((y <= -1.25e+90) || !(y <= 1.8e+181)) {
tmp = (y * x) * z;
} else {
tmp = (b * t) * i;
}
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)
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) :: tmp
if ((y <= (-1.25d+90)) .or. (.not. (y <= 1.8d+181))) then
tmp = (y * x) * z
else
tmp = (b * t) * i
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 tmp;
if ((y <= -1.25e+90) || !(y <= 1.8e+181)) {
tmp = (y * x) * z;
} else {
tmp = (b * t) * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (y <= -1.25e+90) or not (y <= 1.8e+181): tmp = (y * x) * z else: tmp = (b * t) * i return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((y <= -1.25e+90) || !(y <= 1.8e+181)) tmp = Float64(Float64(y * x) * z); else tmp = Float64(Float64(b * t) * i); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((y <= -1.25e+90) || ~((y <= 1.8e+181))) tmp = (y * x) * z; else tmp = (b * t) * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[y, -1.25e+90], N[Not[LessEqual[y, 1.8e+181]], $MachinePrecision]], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision], N[(N[(b * t), $MachinePrecision] * i), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+90} \lor \neg \left(y \leq 1.8 \cdot 10^{+181}\right):\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot t\right) \cdot i\\
\end{array}
\end{array}
if y < -1.2500000000000001e90 or 1.79999999999999992e181 < y Initial program 61.9%
Taylor expanded in z around inf
Applied rewrites65.4%
Taylor expanded in x around inf
Applied rewrites61.7%
if -1.2500000000000001e90 < y < 1.79999999999999992e181Initial program 78.6%
Taylor expanded in t around inf
Applied rewrites47.8%
Taylor expanded in x around 0
Applied rewrites27.0%
Applied rewrites28.8%
Final simplification37.8%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= t -4e+61) (* (* b t) i) (if (<= t 5e+60) (* (* j c) a) (* (* i t) b))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (t <= -4e+61) {
tmp = (b * t) * i;
} else if (t <= 5e+60) {
tmp = (j * c) * a;
} else {
tmp = (i * t) * 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)
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) :: tmp
if (t <= (-4d+61)) then
tmp = (b * t) * i
else if (t <= 5d+60) then
tmp = (j * c) * a
else
tmp = (i * t) * 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 tmp;
if (t <= -4e+61) {
tmp = (b * t) * i;
} else if (t <= 5e+60) {
tmp = (j * c) * a;
} else {
tmp = (i * t) * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if t <= -4e+61: tmp = (b * t) * i elif t <= 5e+60: tmp = (j * c) * a else: tmp = (i * t) * b return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (t <= -4e+61) tmp = Float64(Float64(b * t) * i); elseif (t <= 5e+60) tmp = Float64(Float64(j * c) * a); else tmp = Float64(Float64(i * t) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (t <= -4e+61) tmp = (b * t) * i; elseif (t <= 5e+60) tmp = (j * c) * a; else tmp = (i * t) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[t, -4e+61], N[(N[(b * t), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[t, 5e+60], N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+61}:\\
\;\;\;\;\left(b \cdot t\right) \cdot i\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+60}:\\
\;\;\;\;\left(j \cdot c\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\end{array}
\end{array}
if t < -3.9999999999999998e61Initial program 66.7%
Taylor expanded in t around inf
Applied rewrites72.0%
Taylor expanded in x around 0
Applied rewrites41.9%
Applied rewrites48.1%
if -3.9999999999999998e61 < t < 4.99999999999999975e60Initial program 80.5%
Taylor expanded in i around 0
Applied rewrites70.6%
Taylor expanded in j around inf
Applied rewrites25.7%
if 4.99999999999999975e60 < t Initial program 63.0%
Taylor expanded in t around inf
Applied rewrites66.9%
Taylor expanded in x around 0
Applied rewrites38.2%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= t -4e+61) (* (* b t) i) (if (<= t 5e+60) (* (* c a) j) (* (* i t) b))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (t <= -4e+61) {
tmp = (b * t) * i;
} else if (t <= 5e+60) {
tmp = (c * a) * j;
} else {
tmp = (i * t) * 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)
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) :: tmp
if (t <= (-4d+61)) then
tmp = (b * t) * i
else if (t <= 5d+60) then
tmp = (c * a) * j
else
tmp = (i * t) * 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 tmp;
if (t <= -4e+61) {
tmp = (b * t) * i;
} else if (t <= 5e+60) {
tmp = (c * a) * j;
} else {
tmp = (i * t) * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if t <= -4e+61: tmp = (b * t) * i elif t <= 5e+60: tmp = (c * a) * j else: tmp = (i * t) * b return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (t <= -4e+61) tmp = Float64(Float64(b * t) * i); elseif (t <= 5e+60) tmp = Float64(Float64(c * a) * j); else tmp = Float64(Float64(i * t) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (t <= -4e+61) tmp = (b * t) * i; elseif (t <= 5e+60) tmp = (c * a) * j; else tmp = (i * t) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[t, -4e+61], N[(N[(b * t), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[t, 5e+60], N[(N[(c * a), $MachinePrecision] * j), $MachinePrecision], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+61}:\\
\;\;\;\;\left(b \cdot t\right) \cdot i\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+60}:\\
\;\;\;\;\left(c \cdot a\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\end{array}
\end{array}
if t < -3.9999999999999998e61Initial program 66.7%
Taylor expanded in t around inf
Applied rewrites72.0%
Taylor expanded in x around 0
Applied rewrites41.9%
Applied rewrites48.1%
if -3.9999999999999998e61 < t < 4.99999999999999975e60Initial program 80.5%
Taylor expanded in i around 0
Applied rewrites70.6%
Taylor expanded in j around inf
Applied rewrites25.7%
Applied rewrites25.2%
if 4.99999999999999975e60 < t Initial program 63.0%
Taylor expanded in t around inf
Applied rewrites66.9%
Taylor expanded in x around 0
Applied rewrites38.2%
(FPCore (x y z t a b c i j) :precision binary64 (* (* b t) i))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return (b * t) * 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, j)
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
code = (b * t) * i
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return (b * t) * i;
}
def code(x, y, z, t, a, b, c, i, j): return (b * t) * i
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(b * t) * i) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = (b * t) * i; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(b * t), $MachinePrecision] * i), $MachinePrecision]
\begin{array}{l}
\\
\left(b \cdot t\right) \cdot i
\end{array}
Initial program 74.0%
Taylor expanded in t around inf
Applied rewrites39.9%
Taylor expanded in x around 0
Applied rewrites22.1%
Applied rewrites23.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* j (- (* c a) (* y i))))
(t_2
(+
(-
(* x (- (* y z) (* t a)))
(/
(* b (- (pow (* c z) 2.0) (pow (* t i) 2.0)))
(+ (* c z) (* t i))))
t_1)))
(if (< x -1.469694296777705e-64)
t_2
(if (< x 3.2113527362226803e-147)
(- (* (- (* b i) (* x a)) t) (- (* z (* c b)) t_1))
t_2))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = j * ((c * a) - (y * i));
double t_2 = ((x * ((y * z) - (t * a))) - ((b * (pow((c * z), 2.0) - pow((t * i), 2.0))) / ((c * z) + (t * i)))) + t_1;
double tmp;
if (x < -1.469694296777705e-64) {
tmp = t_2;
} else if (x < 3.2113527362226803e-147) {
tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1);
} 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)
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = j * ((c * a) - (y * i))
t_2 = ((x * ((y * z) - (t * a))) - ((b * (((c * z) ** 2.0d0) - ((t * i) ** 2.0d0))) / ((c * z) + (t * i)))) + t_1
if (x < (-1.469694296777705d-64)) then
tmp = t_2
else if (x < 3.2113527362226803d-147) then
tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1)
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 t_1 = j * ((c * a) - (y * i));
double t_2 = ((x * ((y * z) - (t * a))) - ((b * (Math.pow((c * z), 2.0) - Math.pow((t * i), 2.0))) / ((c * z) + (t * i)))) + t_1;
double tmp;
if (x < -1.469694296777705e-64) {
tmp = t_2;
} else if (x < 3.2113527362226803e-147) {
tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = j * ((c * a) - (y * i)) t_2 = ((x * ((y * z) - (t * a))) - ((b * (math.pow((c * z), 2.0) - math.pow((t * i), 2.0))) / ((c * z) + (t * i)))) + t_1 tmp = 0 if x < -1.469694296777705e-64: tmp = t_2 elif x < 3.2113527362226803e-147: tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(j * Float64(Float64(c * a) - Float64(y * i))) t_2 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(Float64(b * Float64((Float64(c * z) ^ 2.0) - (Float64(t * i) ^ 2.0))) / Float64(Float64(c * z) + Float64(t * i)))) + t_1) tmp = 0.0 if (x < -1.469694296777705e-64) tmp = t_2; elseif (x < 3.2113527362226803e-147) tmp = Float64(Float64(Float64(Float64(b * i) - Float64(x * a)) * t) - Float64(Float64(z * Float64(c * b)) - t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = j * ((c * a) - (y * i)); t_2 = ((x * ((y * z) - (t * a))) - ((b * (((c * z) ^ 2.0) - ((t * i) ^ 2.0))) / ((c * z) + (t * i)))) + t_1; tmp = 0.0; if (x < -1.469694296777705e-64) tmp = t_2; elseif (x < 3.2113527362226803e-147) tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(b * N[(N[Power[N[(c * z), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[(t * i), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(c * z), $MachinePrecision] + N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[Less[x, -1.469694296777705e-64], t$95$2, If[Less[x, 3.2113527362226803e-147], N[(N[(N[(N[(b * i), $MachinePrecision] - N[(x * a), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] - N[(N[(z * N[(c * b), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := j \cdot \left(c \cdot a - y \cdot i\right)\\
t_2 := \left(x \cdot \left(y \cdot z - t \cdot a\right) - \frac{b \cdot \left({\left(c \cdot z\right)}^{2} - {\left(t \cdot i\right)}^{2}\right)}{c \cdot z + t \cdot i}\right) + t\_1\\
\mathbf{if}\;x < -1.469694296777705 \cdot 10^{-64}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x < 3.2113527362226803 \cdot 10^{-147}:\\
\;\;\;\;\left(b \cdot i - x \cdot a\right) \cdot t - \left(z \cdot \left(c \cdot b\right) - t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2025022
(FPCore (x y z t a b c i j)
:name "Data.Colour.Matrix:determinant from colour-2.3.3, A"
:precision binary64
:alt
(! :herbie-platform default (if (< x -293938859355541/2000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i)))) (if (< x 32113527362226803/10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (- (* b i) (* x a)) t) (- (* z (* c b)) (* j (- (* c a) (* y i))))) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i)))))))
(+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))