
(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 25 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
(if (or (<= j -2.9e+83) (not (<= j 3.8e+60)))
(fma
(fma (- i) y (* c a))
j
(fma (fma (- x) a (* i b)) t (* (fma (- b) c (* y x)) z)))
(fma
(fma (- c) z (* i t))
b
(fma (fma (- t) x (* j c)) a (* (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 ((j <= -2.9e+83) || !(j <= 3.8e+60)) {
tmp = fma(fma(-i, y, (c * a)), j, fma(fma(-x, a, (i * b)), t, (fma(-b, c, (y * x)) * z)));
} else {
tmp = fma(fma(-c, z, (i * t)), b, fma(fma(-t, x, (j * c)), a, (fma(-i, j, (z * x)) * y)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((j <= -2.9e+83) || !(j <= 3.8e+60)) tmp = fma(fma(Float64(-i), y, Float64(c * a)), j, fma(fma(Float64(-x), a, Float64(i * b)), t, Float64(fma(Float64(-b), c, Float64(y * x)) * z))); else 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))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[j, -2.9e+83], N[Not[LessEqual[j, 3.8e+60]], $MachinePrecision]], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j + N[(N[((-x) * a + N[(i * b), $MachinePrecision]), $MachinePrecision] * t + N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;j \leq -2.9 \cdot 10^{+83} \lor \neg \left(j \leq 3.8 \cdot 10^{+60}\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, y, c \cdot a\right), j, \mathsf{fma}\left(\mathsf{fma}\left(-x, a, i \cdot b\right), t, \mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\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)\\
\end{array}
\end{array}
if j < -2.89999999999999999e83 or 3.80000000000000009e60 < j Initial program 79.0%
Taylor expanded in t around 0
Applied rewrites88.4%
if -2.89999999999999999e83 < j < 3.80000000000000009e60Initial program 71.2%
Taylor expanded in y around 0
Applied rewrites85.8%
Final simplification86.7%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (- i) y (* c a))))
(if (<= j -3.9e+197)
(* t_1 j)
(if (<= j 6e+230)
(fma
(fma (- c) z (* i t))
b
(fma (fma (- t) x (* j c)) a (* (fma (- i) j (* z x)) y)))
(fma t_1 j (* (* 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 = fma(-i, y, (c * a));
double tmp;
if (j <= -3.9e+197) {
tmp = t_1 * j;
} else if (j <= 6e+230) {
tmp = fma(fma(-c, z, (i * t)), b, fma(fma(-t, x, (j * c)), a, (fma(-i, j, (z * x)) * y)));
} else {
tmp = fma(t_1, j, ((z * y) * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(Float64(-i), y, Float64(c * a)) tmp = 0.0 if (j <= -3.9e+197) tmp = Float64(t_1 * j); elseif (j <= 6e+230) 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 = fma(t_1, j, Float64(Float64(z * y) * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[j, -3.9e+197], N[(t$95$1 * j), $MachinePrecision], If[LessEqual[j, 6e+230], 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[(t$95$1 * j + N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-i, y, c \cdot a\right)\\
\mathbf{if}\;j \leq -3.9 \cdot 10^{+197}:\\
\;\;\;\;t\_1 \cdot j\\
\mathbf{elif}\;j \leq 6 \cdot 10^{+230}:\\
\;\;\;\;\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(t\_1, j, \left(z \cdot y\right) \cdot x\right)\\
\end{array}
\end{array}
if j < -3.9e197Initial program 72.0%
Taylor expanded in j around inf
Applied rewrites83.2%
if -3.9e197 < j < 6.00000000000000017e230Initial program 74.2%
Taylor expanded in y around 0
Applied rewrites84.8%
if 6.00000000000000017e230 < j Initial program 70.0%
Taylor expanded in t around 0
Applied rewrites80.0%
Taylor expanded in y around inf
Applied rewrites100.0%
Final simplification85.3%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* j (- (* c a) (* y i)))))
(if (<= x -3.9e+85)
(* (fma (- t) a (* z y)) x)
(if (<= x -5.5e-195)
(fma (fma (- c) z (* i t)) b (* (* j c) a))
(if (<= x 3.8e-75)
(+ (* (* i t) b) t_1)
(if (<= x 6e+161)
(+ (* (* z x) y) t_1)
(* (* (fma y (/ z t) (- a)) t) x)))))))
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 tmp;
if (x <= -3.9e+85) {
tmp = fma(-t, a, (z * y)) * x;
} else if (x <= -5.5e-195) {
tmp = fma(fma(-c, z, (i * t)), b, ((j * c) * a));
} else if (x <= 3.8e-75) {
tmp = ((i * t) * b) + t_1;
} else if (x <= 6e+161) {
tmp = ((z * x) * y) + t_1;
} else {
tmp = (fma(y, (z / t), -a) * t) * x;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(j * Float64(Float64(c * a) - Float64(y * i))) tmp = 0.0 if (x <= -3.9e+85) tmp = Float64(fma(Float64(-t), a, Float64(z * y)) * x); elseif (x <= -5.5e-195) tmp = fma(fma(Float64(-c), z, Float64(i * t)), b, Float64(Float64(j * c) * a)); elseif (x <= 3.8e-75) tmp = Float64(Float64(Float64(i * t) * b) + t_1); elseif (x <= 6e+161) tmp = Float64(Float64(Float64(z * x) * y) + t_1); else tmp = Float64(Float64(fma(y, Float64(z / t), Float64(-a)) * t) * x); end return 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]}, If[LessEqual[x, -3.9e+85], N[(N[((-t) * a + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, -5.5e-195], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b + N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.8e-75], N[(N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[x, 6e+161], N[(N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(N[(y * N[(z / t), $MachinePrecision] + (-a)), $MachinePrecision] * t), $MachinePrecision] * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := j \cdot \left(c \cdot a - y \cdot i\right)\\
\mathbf{if}\;x \leq -3.9 \cdot 10^{+85}:\\
\;\;\;\;\mathsf{fma}\left(-t, a, z \cdot y\right) \cdot x\\
\mathbf{elif}\;x \leq -5.5 \cdot 10^{-195}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-c, z, i \cdot t\right), b, \left(j \cdot c\right) \cdot a\right)\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-75}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b + t\_1\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+161}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y + t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(y, \frac{z}{t}, -a\right) \cdot t\right) \cdot x\\
\end{array}
\end{array}
if x < -3.90000000000000033e85Initial program 62.0%
Taylor expanded in x around inf
Applied rewrites72.0%
if -3.90000000000000033e85 < x < -5.5000000000000003e-195Initial program 78.5%
Taylor expanded in y around 0
Applied rewrites80.1%
Taylor expanded in c around inf
Applied rewrites63.4%
if -5.5000000000000003e-195 < x < 3.79999999999999994e-75Initial program 72.0%
Taylor expanded in i around inf
Applied rewrites66.6%
if 3.79999999999999994e-75 < x < 6.00000000000000023e161Initial program 80.6%
Taylor expanded in y around inf
Applied rewrites63.7%
if 6.00000000000000023e161 < x Initial program 77.1%
Taylor expanded in x around inf
Applied rewrites86.9%
Taylor expanded in t around inf
Applied rewrites89.7%
Final simplification69.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- t) x (* j c)) a)) (t_2 (fma (- b) c (* y x))))
(if (<= a -4.3e+162)
t_1
(if (<= a 1.9e-72)
(fma (* (- j) y) i (fma t_2 z (* (* i t) b)))
(if (<= a 3.9e+77) (fma (fma (- i) y (* c a)) j (* t_2 z)) 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 t_2 = fma(-b, c, (y * x));
double tmp;
if (a <= -4.3e+162) {
tmp = t_1;
} else if (a <= 1.9e-72) {
tmp = fma((-j * y), i, fma(t_2, z, ((i * t) * b)));
} else if (a <= 3.9e+77) {
tmp = fma(fma(-i, y, (c * a)), j, (t_2 * z));
} 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) t_2 = fma(Float64(-b), c, Float64(y * x)) tmp = 0.0 if (a <= -4.3e+162) tmp = t_1; elseif (a <= 1.9e-72) tmp = fma(Float64(Float64(-j) * y), i, fma(t_2, z, Float64(Float64(i * t) * b))); elseif (a <= 3.9e+77) tmp = fma(fma(Float64(-i), y, Float64(c * a)), j, Float64(t_2 * z)); 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]}, Block[{t$95$2 = N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -4.3e+162], t$95$1, If[LessEqual[a, 1.9e-72], N[(N[((-j) * y), $MachinePrecision] * i + N[(t$95$2 * z + N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.9e+77], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j + N[(t$95$2 * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-t, x, j \cdot c\right) \cdot a\\
t_2 := \mathsf{fma}\left(-b, c, y \cdot x\right)\\
\mathbf{if}\;a \leq -4.3 \cdot 10^{+162}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.9 \cdot 10^{-72}:\\
\;\;\;\;\mathsf{fma}\left(\left(-j\right) \cdot y, i, \mathsf{fma}\left(t\_2, z, \left(i \cdot t\right) \cdot b\right)\right)\\
\mathbf{elif}\;a \leq 3.9 \cdot 10^{+77}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, y, c \cdot a\right), j, t\_2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -4.3000000000000002e162 or 3.8999999999999998e77 < a Initial program 55.1%
Taylor expanded in a around inf
Applied rewrites79.3%
if -4.3000000000000002e162 < a < 1.90000000000000001e-72Initial program 81.2%
Taylor expanded in t around 0
Applied rewrites82.3%
Taylor expanded in a around 0
Applied rewrites71.5%
if 1.90000000000000001e-72 < a < 3.8999999999999998e77Initial program 93.2%
Taylor expanded in t around 0
Applied rewrites78.1%
Final simplification74.8%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= x -3.9e+85)
(* (fma (- t) a (* z y)) x)
(if (<= x -5.5e-195)
(fma (fma (- c) z (* i t)) b (* (* j c) a))
(if (<= x 3.8e-75)
(+ (* (* i t) b) (* j (- (* c a) (* y i))))
(if (<= x 2.15e+160)
(fma (fma (- i) y (* c a)) j (* (* z y) x))
(* (* (fma y (/ z t) (- a)) t) x))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (x <= -3.9e+85) {
tmp = fma(-t, a, (z * y)) * x;
} else if (x <= -5.5e-195) {
tmp = fma(fma(-c, z, (i * t)), b, ((j * c) * a));
} else if (x <= 3.8e-75) {
tmp = ((i * t) * b) + (j * ((c * a) - (y * i)));
} else if (x <= 2.15e+160) {
tmp = fma(fma(-i, y, (c * a)), j, ((z * y) * x));
} else {
tmp = (fma(y, (z / t), -a) * t) * x;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -3.9e+85) tmp = Float64(fma(Float64(-t), a, Float64(z * y)) * x); elseif (x <= -5.5e-195) tmp = fma(fma(Float64(-c), z, Float64(i * t)), b, Float64(Float64(j * c) * a)); elseif (x <= 3.8e-75) tmp = Float64(Float64(Float64(i * t) * b) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))); elseif (x <= 2.15e+160) tmp = fma(fma(Float64(-i), y, Float64(c * a)), j, Float64(Float64(z * y) * x)); else tmp = Float64(Float64(fma(y, Float64(z / t), Float64(-a)) * t) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -3.9e+85], N[(N[((-t) * a + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, -5.5e-195], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b + N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.8e-75], N[(N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.15e+160], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j + N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * N[(z / t), $MachinePrecision] + (-a)), $MachinePrecision] * t), $MachinePrecision] * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{+85}:\\
\;\;\;\;\mathsf{fma}\left(-t, a, z \cdot y\right) \cdot x\\
\mathbf{elif}\;x \leq -5.5 \cdot 10^{-195}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-c, z, i \cdot t\right), b, \left(j \cdot c\right) \cdot a\right)\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-75}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b + j \cdot \left(c \cdot a - y \cdot i\right)\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{+160}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, y, c \cdot a\right), j, \left(z \cdot y\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(y, \frac{z}{t}, -a\right) \cdot t\right) \cdot x\\
\end{array}
\end{array}
if x < -3.90000000000000033e85Initial program 62.0%
Taylor expanded in x around inf
Applied rewrites72.0%
if -3.90000000000000033e85 < x < -5.5000000000000003e-195Initial program 78.5%
Taylor expanded in y around 0
Applied rewrites80.1%
Taylor expanded in c around inf
Applied rewrites63.4%
if -5.5000000000000003e-195 < x < 3.79999999999999994e-75Initial program 72.0%
Taylor expanded in i around inf
Applied rewrites66.6%
if 3.79999999999999994e-75 < x < 2.14999999999999994e160Initial program 80.6%
Taylor expanded in t around 0
Applied rewrites79.2%
Taylor expanded in y around inf
Applied rewrites62.0%
if 2.14999999999999994e160 < x Initial program 77.1%
Taylor expanded in x around inf
Applied rewrites86.9%
Taylor expanded in t around inf
Applied rewrites89.7%
Final simplification68.9%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (- b) c (* y x))))
(if (or (<= t -6.6e-42) (not (<= t 0.37)))
(fma t_1 z (* (fma (- a) x (* i b)) t))
(fma (fma (- i) y (* c a)) j (* t_1 z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-b, c, (y * x));
double tmp;
if ((t <= -6.6e-42) || !(t <= 0.37)) {
tmp = fma(t_1, z, (fma(-a, x, (i * b)) * t));
} else {
tmp = fma(fma(-i, y, (c * a)), j, (t_1 * z));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(Float64(-b), c, Float64(y * x)) tmp = 0.0 if ((t <= -6.6e-42) || !(t <= 0.37)) tmp = fma(t_1, z, Float64(fma(Float64(-a), x, Float64(i * b)) * t)); else tmp = fma(fma(Float64(-i), y, Float64(c * a)), j, Float64(t_1 * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t, -6.6e-42], N[Not[LessEqual[t, 0.37]], $MachinePrecision]], N[(t$95$1 * z + N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j + N[(t$95$1 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-b, c, y \cdot x\right)\\
\mathbf{if}\;t \leq -6.6 \cdot 10^{-42} \lor \neg \left(t \leq 0.37\right):\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, \mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, y, c \cdot a\right), j, t\_1 \cdot z\right)\\
\end{array}
\end{array}
if t < -6.6000000000000005e-42 or 0.37 < t Initial program 67.2%
Taylor expanded in t around 0
Applied rewrites77.4%
Taylor expanded in j around 0
Applied rewrites69.8%
if -6.6000000000000005e-42 < t < 0.37Initial program 81.4%
Taylor expanded in t around 0
Applied rewrites72.7%
Final simplification71.1%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= t -9.6e-19) (not (<= t 0.37))) (fma (fma (- b) c (* y x)) z (* (fma (- a) x (* i b)) t)) (+ (* (* z x) y) (* 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 ((t <= -9.6e-19) || !(t <= 0.37)) {
tmp = fma(fma(-b, c, (y * x)), z, (fma(-a, x, (i * b)) * t));
} else {
tmp = ((z * x) * y) + (j * ((c * a) - (y * i)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((t <= -9.6e-19) || !(t <= 0.37)) tmp = fma(fma(Float64(-b), c, Float64(y * x)), z, Float64(fma(Float64(-a), x, Float64(i * b)) * t)); else tmp = Float64(Float64(Float64(z * x) * y) + 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[t, -9.6e-19], N[Not[LessEqual[t, 0.37]], $MachinePrecision]], N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z + N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.6 \cdot 10^{-19} \lor \neg \left(t \leq 0.37\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-b, c, y \cdot x\right), z, \mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y + j \cdot \left(c \cdot a - y \cdot i\right)\\
\end{array}
\end{array}
if t < -9.60000000000000092e-19 or 0.37 < t Initial program 65.7%
Taylor expanded in t around 0
Applied rewrites78.9%
Taylor expanded in j around 0
Applied rewrites71.5%
if -9.60000000000000092e-19 < t < 0.37Initial program 81.9%
Taylor expanded in y around inf
Applied rewrites67.2%
Final simplification69.4%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (- a) (* t x))) (t_2 (* (fma (- b) c (* y x)) z)))
(if (<= z -1.7e+48)
t_2
(if (<= z -3.45e-28)
t_1
(if (<= z -4.6e-171)
(* (fma (- i) j (* z x)) y)
(if (<= z -9.5e-274)
t_1
(if (<= z 5.6e-27) (* (fma t b (* (- y) j)) i) 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 = -a * (t * x);
double t_2 = fma(-b, c, (y * x)) * z;
double tmp;
if (z <= -1.7e+48) {
tmp = t_2;
} else if (z <= -3.45e-28) {
tmp = t_1;
} else if (z <= -4.6e-171) {
tmp = fma(-i, j, (z * x)) * y;
} else if (z <= -9.5e-274) {
tmp = t_1;
} else if (z <= 5.6e-27) {
tmp = fma(t, b, (-y * j)) * i;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(-a) * Float64(t * x)) t_2 = Float64(fma(Float64(-b), c, Float64(y * x)) * z) tmp = 0.0 if (z <= -1.7e+48) tmp = t_2; elseif (z <= -3.45e-28) tmp = t_1; elseif (z <= -4.6e-171) tmp = Float64(fma(Float64(-i), j, Float64(z * x)) * y); elseif (z <= -9.5e-274) tmp = t_1; elseif (z <= 5.6e-27) tmp = Float64(fma(t, b, Float64(Float64(-y) * j)) * i); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1.7e+48], t$95$2, If[LessEqual[z, -3.45e-28], t$95$1, If[LessEqual[z, -4.6e-171], N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, -9.5e-274], t$95$1, If[LessEqual[z, 5.6e-27], N[(N[(t * b + N[((-y) * j), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-a\right) \cdot \left(t \cdot x\right)\\
t_2 := \mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{+48}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -3.45 \cdot 10^{-28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.6 \cdot 10^{-171}:\\
\;\;\;\;\mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\mathbf{elif}\;z \leq -9.5 \cdot 10^{-274}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{-27}:\\
\;\;\;\;\mathsf{fma}\left(t, b, \left(-y\right) \cdot j\right) \cdot i\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -1.7000000000000002e48 or 5.5999999999999999e-27 < z Initial program 68.8%
Taylor expanded in z around inf
Applied rewrites62.3%
if -1.7000000000000002e48 < z < -3.45000000000000001e-28 or -4.59999999999999956e-171 < z < -9.5000000000000009e-274Initial program 64.3%
Taylor expanded in x around inf
Applied rewrites59.3%
Taylor expanded in y around 0
Applied rewrites61.9%
if -3.45000000000000001e-28 < z < -4.59999999999999956e-171Initial program 86.1%
Taylor expanded in y around inf
Applied rewrites54.8%
if -9.5000000000000009e-274 < z < 5.5999999999999999e-27Initial program 81.3%
Taylor expanded in i around inf
Applied rewrites48.9%
Applied rewrites48.8%
Final simplification57.3%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= x -3.9e+85)
(* (fma (- t) a (* z y)) x)
(if (<= x 3.5e-75)
(fma (fma (- c) z (* i t)) b (* (* j c) a))
(if (<= x 2.15e+160)
(fma (fma (- i) y (* c a)) j (* (* z y) x))
(* (* (fma y (/ z t) (- a)) t) x)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (x <= -3.9e+85) {
tmp = fma(-t, a, (z * y)) * x;
} else if (x <= 3.5e-75) {
tmp = fma(fma(-c, z, (i * t)), b, ((j * c) * a));
} else if (x <= 2.15e+160) {
tmp = fma(fma(-i, y, (c * a)), j, ((z * y) * x));
} else {
tmp = (fma(y, (z / t), -a) * t) * x;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -3.9e+85) tmp = Float64(fma(Float64(-t), a, Float64(z * y)) * x); elseif (x <= 3.5e-75) tmp = fma(fma(Float64(-c), z, Float64(i * t)), b, Float64(Float64(j * c) * a)); elseif (x <= 2.15e+160) tmp = fma(fma(Float64(-i), y, Float64(c * a)), j, Float64(Float64(z * y) * x)); else tmp = Float64(Float64(fma(y, Float64(z / t), Float64(-a)) * t) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -3.9e+85], N[(N[((-t) * a + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 3.5e-75], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b + N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.15e+160], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j + N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * N[(z / t), $MachinePrecision] + (-a)), $MachinePrecision] * t), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{+85}:\\
\;\;\;\;\mathsf{fma}\left(-t, a, z \cdot y\right) \cdot x\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-75}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-c, z, i \cdot t\right), b, \left(j \cdot c\right) \cdot a\right)\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{+160}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, y, c \cdot a\right), j, \left(z \cdot y\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(y, \frac{z}{t}, -a\right) \cdot t\right) \cdot x\\
\end{array}
\end{array}
if x < -3.90000000000000033e85Initial program 62.0%
Taylor expanded in x around inf
Applied rewrites72.0%
if -3.90000000000000033e85 < x < 3.49999999999999985e-75Initial program 74.4%
Taylor expanded in y around 0
Applied rewrites84.5%
Taylor expanded in c around inf
Applied rewrites61.6%
if 3.49999999999999985e-75 < x < 2.14999999999999994e160Initial program 80.6%
Taylor expanded in t around 0
Applied rewrites79.2%
Taylor expanded in y around inf
Applied rewrites62.0%
if 2.14999999999999994e160 < x Initial program 77.1%
Taylor expanded in x around inf
Applied rewrites86.9%
Taylor expanded in t around inf
Applied rewrites89.7%
Final simplification66.9%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (- a) (* t x))))
(if (<= a -2.95e+246)
(* (* c a) j)
(if (<= a -4.3e-16)
t_1
(if (<= a 1.06e-291)
(* (* i b) t)
(if (<= a 2.1e+103)
(* (* z y) x)
(if (<= a 3.3e+256) t_1 (* (* j a) c))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = -a * (t * x);
double tmp;
if (a <= -2.95e+246) {
tmp = (c * a) * j;
} else if (a <= -4.3e-16) {
tmp = t_1;
} else if (a <= 1.06e-291) {
tmp = (i * b) * t;
} else if (a <= 2.1e+103) {
tmp = (z * y) * x;
} else if (a <= 3.3e+256) {
tmp = t_1;
} else {
tmp = (j * a) * c;
}
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) :: tmp
t_1 = -a * (t * x)
if (a <= (-2.95d+246)) then
tmp = (c * a) * j
else if (a <= (-4.3d-16)) then
tmp = t_1
else if (a <= 1.06d-291) then
tmp = (i * b) * t
else if (a <= 2.1d+103) then
tmp = (z * y) * x
else if (a <= 3.3d+256) then
tmp = t_1
else
tmp = (j * a) * c
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 = -a * (t * x);
double tmp;
if (a <= -2.95e+246) {
tmp = (c * a) * j;
} else if (a <= -4.3e-16) {
tmp = t_1;
} else if (a <= 1.06e-291) {
tmp = (i * b) * t;
} else if (a <= 2.1e+103) {
tmp = (z * y) * x;
} else if (a <= 3.3e+256) {
tmp = t_1;
} else {
tmp = (j * a) * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = -a * (t * x) tmp = 0 if a <= -2.95e+246: tmp = (c * a) * j elif a <= -4.3e-16: tmp = t_1 elif a <= 1.06e-291: tmp = (i * b) * t elif a <= 2.1e+103: tmp = (z * y) * x elif a <= 3.3e+256: tmp = t_1 else: tmp = (j * a) * c return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(-a) * Float64(t * x)) tmp = 0.0 if (a <= -2.95e+246) tmp = Float64(Float64(c * a) * j); elseif (a <= -4.3e-16) tmp = t_1; elseif (a <= 1.06e-291) tmp = Float64(Float64(i * b) * t); elseif (a <= 2.1e+103) tmp = Float64(Float64(z * y) * x); elseif (a <= 3.3e+256) tmp = t_1; else tmp = Float64(Float64(j * a) * c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = -a * (t * x); tmp = 0.0; if (a <= -2.95e+246) tmp = (c * a) * j; elseif (a <= -4.3e-16) tmp = t_1; elseif (a <= 1.06e-291) tmp = (i * b) * t; elseif (a <= 2.1e+103) tmp = (z * y) * x; elseif (a <= 3.3e+256) tmp = t_1; else tmp = (j * a) * c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2.95e+246], N[(N[(c * a), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[a, -4.3e-16], t$95$1, If[LessEqual[a, 1.06e-291], N[(N[(i * b), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[a, 2.1e+103], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[a, 3.3e+256], t$95$1, N[(N[(j * a), $MachinePrecision] * c), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{if}\;a \leq -2.95 \cdot 10^{+246}:\\
\;\;\;\;\left(c \cdot a\right) \cdot j\\
\mathbf{elif}\;a \leq -4.3 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.06 \cdot 10^{-291}:\\
\;\;\;\;\left(i \cdot b\right) \cdot t\\
\mathbf{elif}\;a \leq 2.1 \cdot 10^{+103}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{elif}\;a \leq 3.3 \cdot 10^{+256}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(j \cdot a\right) \cdot c\\
\end{array}
\end{array}
if a < -2.94999999999999988e246Initial program 60.9%
Taylor expanded in c around inf
Applied rewrites61.2%
Taylor expanded in z around 0
Applied rewrites61.1%
Applied rewrites65.9%
if -2.94999999999999988e246 < a < -4.2999999999999999e-16 or 2.1000000000000002e103 < a < 3.2999999999999999e256Initial program 59.4%
Taylor expanded in x around inf
Applied rewrites60.1%
Taylor expanded in y around 0
Applied rewrites45.4%
if -4.2999999999999999e-16 < a < 1.05999999999999992e-291Initial program 86.5%
Taylor expanded in t around inf
Applied rewrites40.9%
Taylor expanded in x around 0
Applied rewrites33.2%
if 1.05999999999999992e-291 < a < 2.1000000000000002e103Initial program 82.6%
Taylor expanded in x around inf
Applied rewrites34.5%
Taylor expanded in y around inf
Applied rewrites28.3%
if 3.2999999999999999e256 < a Initial program 69.6%
Taylor expanded in c around inf
Applied rewrites77.6%
Taylor expanded in z around 0
Applied rewrites77.6%
Final simplification40.4%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- b) c (* y x)) z)))
(if (<= z -1.7e+48)
t_1
(if (<= z -3.45e-28)
(* (- a) (* t x))
(if (<= z -8.6e-148)
(* (fma (- i) j (* z x)) y)
(if (<= z 5.6e-27) (* (fma (- i) y (* c a)) j) 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(-b, c, (y * x)) * z;
double tmp;
if (z <= -1.7e+48) {
tmp = t_1;
} else if (z <= -3.45e-28) {
tmp = -a * (t * x);
} else if (z <= -8.6e-148) {
tmp = fma(-i, j, (z * x)) * y;
} else if (z <= 5.6e-27) {
tmp = fma(-i, y, (c * a)) * j;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-b), c, Float64(y * x)) * z) tmp = 0.0 if (z <= -1.7e+48) tmp = t_1; elseif (z <= -3.45e-28) tmp = Float64(Float64(-a) * Float64(t * x)); elseif (z <= -8.6e-148) tmp = Float64(fma(Float64(-i), j, Float64(z * x)) * y); elseif (z <= 5.6e-27) tmp = Float64(fma(Float64(-i), y, Float64(c * a)) * j); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1.7e+48], t$95$1, If[LessEqual[z, -3.45e-28], N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -8.6e-148], N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 5.6e-27], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.45 \cdot 10^{-28}:\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{elif}\;z \leq -8.6 \cdot 10^{-148}:\\
\;\;\;\;\mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{-27}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.7000000000000002e48 or 5.5999999999999999e-27 < z Initial program 68.8%
Taylor expanded in z around inf
Applied rewrites62.3%
if -1.7000000000000002e48 < z < -3.45000000000000001e-28Initial program 64.6%
Taylor expanded in x around inf
Applied rewrites64.9%
Taylor expanded in y around 0
Applied rewrites65.0%
if -3.45000000000000001e-28 < z < -8.5999999999999997e-148Initial program 84.5%
Taylor expanded in y around inf
Applied rewrites57.2%
if -8.5999999999999997e-148 < z < 5.5999999999999999e-27Initial program 78.2%
Taylor expanded in j around inf
Applied rewrites52.2%
Final simplification57.9%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= x -3.9e+85)
(* (fma (- t) a (* z y)) x)
(if (<= x 2.3e-60)
(fma (fma (- c) z (* i t)) b (* (* j c) a))
(* (* (fma y (/ z t) (- a)) t) x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (x <= -3.9e+85) {
tmp = fma(-t, a, (z * y)) * x;
} else if (x <= 2.3e-60) {
tmp = fma(fma(-c, z, (i * t)), b, ((j * c) * a));
} else {
tmp = (fma(y, (z / t), -a) * t) * x;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -3.9e+85) tmp = Float64(fma(Float64(-t), a, Float64(z * y)) * x); elseif (x <= 2.3e-60) tmp = fma(fma(Float64(-c), z, Float64(i * t)), b, Float64(Float64(j * c) * a)); else tmp = Float64(Float64(fma(y, Float64(z / t), Float64(-a)) * t) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -3.9e+85], N[(N[((-t) * a + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 2.3e-60], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b + N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * N[(z / t), $MachinePrecision] + (-a)), $MachinePrecision] * t), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{+85}:\\
\;\;\;\;\mathsf{fma}\left(-t, a, z \cdot y\right) \cdot x\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-60}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-c, z, i \cdot t\right), b, \left(j \cdot c\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(y, \frac{z}{t}, -a\right) \cdot t\right) \cdot x\\
\end{array}
\end{array}
if x < -3.90000000000000033e85Initial program 62.0%
Taylor expanded in x around inf
Applied rewrites72.0%
if -3.90000000000000033e85 < x < 2.3000000000000001e-60Initial program 74.2%
Taylor expanded in y around 0
Applied rewrites84.8%
Taylor expanded in c around inf
Applied rewrites61.0%
if 2.3000000000000001e-60 < x Initial program 79.7%
Taylor expanded in x around inf
Applied rewrites68.2%
Taylor expanded in t around inf
Applied rewrites69.3%
Final simplification65.3%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= a -7.4e+248)
(* (* c a) j)
(if (<= a -2.7e+163)
(* (* (- a) t) x)
(if (<= a 3.1e+104)
(* (fma t b (* (- y) j)) i)
(if (<= a 3.3e+256) (* (- a) (* t x)) (* (* j a) c))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (a <= -7.4e+248) {
tmp = (c * a) * j;
} else if (a <= -2.7e+163) {
tmp = (-a * t) * x;
} else if (a <= 3.1e+104) {
tmp = fma(t, b, (-y * j)) * i;
} else if (a <= 3.3e+256) {
tmp = -a * (t * x);
} else {
tmp = (j * a) * c;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (a <= -7.4e+248) tmp = Float64(Float64(c * a) * j); elseif (a <= -2.7e+163) tmp = Float64(Float64(Float64(-a) * t) * x); elseif (a <= 3.1e+104) tmp = Float64(fma(t, b, Float64(Float64(-y) * j)) * i); elseif (a <= 3.3e+256) tmp = Float64(Float64(-a) * Float64(t * x)); else tmp = Float64(Float64(j * a) * c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[a, -7.4e+248], N[(N[(c * a), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[a, -2.7e+163], N[(N[((-a) * t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[a, 3.1e+104], N[(N[(t * b + N[((-y) * j), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[a, 3.3e+256], N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision], N[(N[(j * a), $MachinePrecision] * c), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.4 \cdot 10^{+248}:\\
\;\;\;\;\left(c \cdot a\right) \cdot j\\
\mathbf{elif}\;a \leq -2.7 \cdot 10^{+163}:\\
\;\;\;\;\left(\left(-a\right) \cdot t\right) \cdot x\\
\mathbf{elif}\;a \leq 3.1 \cdot 10^{+104}:\\
\;\;\;\;\mathsf{fma}\left(t, b, \left(-y\right) \cdot j\right) \cdot i\\
\mathbf{elif}\;a \leq 3.3 \cdot 10^{+256}:\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(j \cdot a\right) \cdot c\\
\end{array}
\end{array}
if a < -7.39999999999999961e248Initial program 63.6%
Taylor expanded in c around inf
Applied rewrites64.0%
Taylor expanded in z around 0
Applied rewrites63.9%
Applied rewrites69.0%
if -7.39999999999999961e248 < a < -2.69999999999999999e163Initial program 40.6%
Taylor expanded in x around inf
Applied rewrites74.4%
Taylor expanded in y around 0
Applied rewrites61.0%
if -2.69999999999999999e163 < a < 3.10000000000000017e104Initial program 82.9%
Taylor expanded in i around inf
Applied rewrites41.7%
Applied rewrites41.7%
if 3.10000000000000017e104 < a < 3.2999999999999999e256Initial program 47.2%
Taylor expanded in x around inf
Applied rewrites66.5%
Taylor expanded in y around 0
Applied rewrites59.7%
if 3.2999999999999999e256 < a Initial program 69.6%
Taylor expanded in c around inf
Applied rewrites77.6%
Taylor expanded in z around 0
Applied rewrites77.6%
Final simplification48.9%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (- a) (* t x))))
(if (<= z -3.1e+53)
(* (* z y) x)
(if (<= z 2.2e-262)
t_1
(if (<= z 2.35e-80)
(* (* (- j) y) i)
(if (<= z 7800000000.0) t_1 (* (* (- z) b) c)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = -a * (t * x);
double tmp;
if (z <= -3.1e+53) {
tmp = (z * y) * x;
} else if (z <= 2.2e-262) {
tmp = t_1;
} else if (z <= 2.35e-80) {
tmp = (-j * y) * i;
} else if (z <= 7800000000.0) {
tmp = t_1;
} else {
tmp = (-z * b) * c;
}
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) :: tmp
t_1 = -a * (t * x)
if (z <= (-3.1d+53)) then
tmp = (z * y) * x
else if (z <= 2.2d-262) then
tmp = t_1
else if (z <= 2.35d-80) then
tmp = (-j * y) * i
else if (z <= 7800000000.0d0) then
tmp = t_1
else
tmp = (-z * b) * c
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 = -a * (t * x);
double tmp;
if (z <= -3.1e+53) {
tmp = (z * y) * x;
} else if (z <= 2.2e-262) {
tmp = t_1;
} else if (z <= 2.35e-80) {
tmp = (-j * y) * i;
} else if (z <= 7800000000.0) {
tmp = t_1;
} else {
tmp = (-z * b) * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = -a * (t * x) tmp = 0 if z <= -3.1e+53: tmp = (z * y) * x elif z <= 2.2e-262: tmp = t_1 elif z <= 2.35e-80: tmp = (-j * y) * i elif z <= 7800000000.0: tmp = t_1 else: tmp = (-z * b) * c return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(-a) * Float64(t * x)) tmp = 0.0 if (z <= -3.1e+53) tmp = Float64(Float64(z * y) * x); elseif (z <= 2.2e-262) tmp = t_1; elseif (z <= 2.35e-80) tmp = Float64(Float64(Float64(-j) * y) * i); elseif (z <= 7800000000.0) tmp = t_1; else tmp = Float64(Float64(Float64(-z) * b) * c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = -a * (t * x); tmp = 0.0; if (z <= -3.1e+53) tmp = (z * y) * x; elseif (z <= 2.2e-262) tmp = t_1; elseif (z <= 2.35e-80) tmp = (-j * y) * i; elseif (z <= 7800000000.0) tmp = t_1; else tmp = (-z * b) * c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.1e+53], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 2.2e-262], t$95$1, If[LessEqual[z, 2.35e-80], N[(N[((-j) * y), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[z, 7800000000.0], t$95$1, N[(N[((-z) * b), $MachinePrecision] * c), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{if}\;z \leq -3.1 \cdot 10^{+53}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-262}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.35 \cdot 10^{-80}:\\
\;\;\;\;\left(\left(-j\right) \cdot y\right) \cdot i\\
\mathbf{elif}\;z \leq 7800000000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-z\right) \cdot b\right) \cdot c\\
\end{array}
\end{array}
if z < -3.10000000000000019e53Initial program 68.2%
Taylor expanded in x around inf
Applied rewrites57.0%
Taylor expanded in y around inf
Applied rewrites52.7%
if -3.10000000000000019e53 < z < 2.19999999999999989e-262 or 2.34999999999999986e-80 < z < 7.8e9Initial program 76.4%
Taylor expanded in x around inf
Applied rewrites50.6%
Taylor expanded in y around 0
Applied rewrites39.1%
if 2.19999999999999989e-262 < z < 2.34999999999999986e-80Initial program 81.5%
Taylor expanded in i around inf
Applied rewrites53.2%
Taylor expanded in y around inf
Applied rewrites38.5%
if 7.8e9 < z Initial program 66.1%
Taylor expanded in c around inf
Applied rewrites54.7%
Taylor expanded in z around inf
Applied rewrites45.5%
Final simplification42.7%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (- a) (* t x))))
(if (<= z -3.1e+53)
(* (* z y) x)
(if (<= z 2.2e-262)
t_1
(if (<= z 2.35e-80)
(* (* (- j) y) i)
(if (<= z 7800000000.0) t_1 (* (- b) (* c z))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = -a * (t * x);
double tmp;
if (z <= -3.1e+53) {
tmp = (z * y) * x;
} else if (z <= 2.2e-262) {
tmp = t_1;
} else if (z <= 2.35e-80) {
tmp = (-j * y) * i;
} else if (z <= 7800000000.0) {
tmp = t_1;
} else {
tmp = -b * (c * z);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, 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) :: tmp
t_1 = -a * (t * x)
if (z <= (-3.1d+53)) then
tmp = (z * y) * x
else if (z <= 2.2d-262) then
tmp = t_1
else if (z <= 2.35d-80) then
tmp = (-j * y) * i
else if (z <= 7800000000.0d0) then
tmp = t_1
else
tmp = -b * (c * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = -a * (t * x);
double tmp;
if (z <= -3.1e+53) {
tmp = (z * y) * x;
} else if (z <= 2.2e-262) {
tmp = t_1;
} else if (z <= 2.35e-80) {
tmp = (-j * y) * i;
} else if (z <= 7800000000.0) {
tmp = t_1;
} else {
tmp = -b * (c * z);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = -a * (t * x) tmp = 0 if z <= -3.1e+53: tmp = (z * y) * x elif z <= 2.2e-262: tmp = t_1 elif z <= 2.35e-80: tmp = (-j * y) * i elif z <= 7800000000.0: tmp = t_1 else: tmp = -b * (c * z) return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(-a) * Float64(t * x)) tmp = 0.0 if (z <= -3.1e+53) tmp = Float64(Float64(z * y) * x); elseif (z <= 2.2e-262) tmp = t_1; elseif (z <= 2.35e-80) tmp = Float64(Float64(Float64(-j) * y) * i); elseif (z <= 7800000000.0) tmp = t_1; else tmp = Float64(Float64(-b) * Float64(c * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = -a * (t * x); tmp = 0.0; if (z <= -3.1e+53) tmp = (z * y) * x; elseif (z <= 2.2e-262) tmp = t_1; elseif (z <= 2.35e-80) tmp = (-j * y) * i; elseif (z <= 7800000000.0) tmp = t_1; else tmp = -b * (c * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.1e+53], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 2.2e-262], t$95$1, If[LessEqual[z, 2.35e-80], N[(N[((-j) * y), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[z, 7800000000.0], t$95$1, N[((-b) * N[(c * z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{if}\;z \leq -3.1 \cdot 10^{+53}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-262}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.35 \cdot 10^{-80}:\\
\;\;\;\;\left(\left(-j\right) \cdot y\right) \cdot i\\
\mathbf{elif}\;z \leq 7800000000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(-b\right) \cdot \left(c \cdot z\right)\\
\end{array}
\end{array}
if z < -3.10000000000000019e53Initial program 68.2%
Taylor expanded in x around inf
Applied rewrites57.0%
Taylor expanded in y around inf
Applied rewrites52.7%
if -3.10000000000000019e53 < z < 2.19999999999999989e-262 or 2.34999999999999986e-80 < z < 7.8e9Initial program 76.4%
Taylor expanded in x around inf
Applied rewrites50.6%
Taylor expanded in y around 0
Applied rewrites39.1%
if 2.19999999999999989e-262 < z < 2.34999999999999986e-80Initial program 81.5%
Taylor expanded in i around inf
Applied rewrites53.2%
Taylor expanded in y around inf
Applied rewrites38.5%
if 7.8e9 < z Initial program 66.1%
Taylor expanded in c around inf
Applied rewrites54.7%
Taylor expanded in z around inf
Applied rewrites43.7%
Final simplification42.4%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= z -3.1e+53)
(* (* z y) x)
(if (<= z -3.6e-243)
(* (* (- a) t) x)
(if (<= z 1.7e-85)
(* (* i b) t)
(if (<= z 7800000000.0) (* (- a) (* t 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 (z <= -3.1e+53) {
tmp = (z * y) * x;
} else if (z <= -3.6e-243) {
tmp = (-a * t) * x;
} else if (z <= 1.7e-85) {
tmp = (i * b) * t;
} else if (z <= 7800000000.0) {
tmp = -a * (t * x);
} else {
tmp = -b * (c * z);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, 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 (z <= (-3.1d+53)) then
tmp = (z * y) * x
else if (z <= (-3.6d-243)) then
tmp = (-a * t) * x
else if (z <= 1.7d-85) then
tmp = (i * b) * t
else if (z <= 7800000000.0d0) then
tmp = -a * (t * x)
else
tmp = -b * (c * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (z <= -3.1e+53) {
tmp = (z * y) * x;
} else if (z <= -3.6e-243) {
tmp = (-a * t) * x;
} else if (z <= 1.7e-85) {
tmp = (i * b) * t;
} else if (z <= 7800000000.0) {
tmp = -a * (t * x);
} else {
tmp = -b * (c * z);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if z <= -3.1e+53: tmp = (z * y) * x elif z <= -3.6e-243: tmp = (-a * t) * x elif z <= 1.7e-85: tmp = (i * b) * t elif z <= 7800000000.0: tmp = -a * (t * x) else: tmp = -b * (c * z) return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (z <= -3.1e+53) tmp = Float64(Float64(z * y) * x); elseif (z <= -3.6e-243) tmp = Float64(Float64(Float64(-a) * t) * x); elseif (z <= 1.7e-85) tmp = Float64(Float64(i * b) * t); elseif (z <= 7800000000.0) tmp = Float64(Float64(-a) * Float64(t * x)); else tmp = Float64(Float64(-b) * Float64(c * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (z <= -3.1e+53) tmp = (z * y) * x; elseif (z <= -3.6e-243) tmp = (-a * t) * x; elseif (z <= 1.7e-85) tmp = (i * b) * t; elseif (z <= 7800000000.0) tmp = -a * (t * x); else tmp = -b * (c * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[z, -3.1e+53], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -3.6e-243], N[(N[((-a) * t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 1.7e-85], N[(N[(i * b), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 7800000000.0], N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision], N[((-b) * N[(c * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+53}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{-243}:\\
\;\;\;\;\left(\left(-a\right) \cdot t\right) \cdot x\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-85}:\\
\;\;\;\;\left(i \cdot b\right) \cdot t\\
\mathbf{elif}\;z \leq 7800000000:\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-b\right) \cdot \left(c \cdot z\right)\\
\end{array}
\end{array}
if z < -3.10000000000000019e53Initial program 68.2%
Taylor expanded in x around inf
Applied rewrites57.0%
Taylor expanded in y around inf
Applied rewrites52.7%
if -3.10000000000000019e53 < z < -3.6000000000000001e-243Initial program 73.8%
Taylor expanded in x around inf
Applied rewrites55.9%
Taylor expanded in y around 0
Applied rewrites43.8%
if -3.6000000000000001e-243 < z < 1.7e-85Initial program 81.2%
Taylor expanded in t around inf
Applied rewrites44.3%
Taylor expanded in x around 0
Applied rewrites31.7%
if 1.7e-85 < z < 7.8e9Initial program 81.3%
Taylor expanded in x around inf
Applied rewrites57.7%
Taylor expanded in y around 0
Applied rewrites38.1%
if 7.8e9 < z Initial program 66.1%
Taylor expanded in c around inf
Applied rewrites54.7%
Taylor expanded in z around inf
Applied rewrites43.7%
Final simplification41.7%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (- a) (* t x))))
(if (<= z -3.1e+53)
(* (* z y) x)
(if (<= z -6e-297)
t_1
(if (<= z 1.7e-85)
(* (* i b) t)
(if (<= z 7800000000.0) t_1 (* (- b) (* c z))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = -a * (t * x);
double tmp;
if (z <= -3.1e+53) {
tmp = (z * y) * x;
} else if (z <= -6e-297) {
tmp = t_1;
} else if (z <= 1.7e-85) {
tmp = (i * b) * t;
} else if (z <= 7800000000.0) {
tmp = t_1;
} else {
tmp = -b * (c * z);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, 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) :: tmp
t_1 = -a * (t * x)
if (z <= (-3.1d+53)) then
tmp = (z * y) * x
else if (z <= (-6d-297)) then
tmp = t_1
else if (z <= 1.7d-85) then
tmp = (i * b) * t
else if (z <= 7800000000.0d0) then
tmp = t_1
else
tmp = -b * (c * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = -a * (t * x);
double tmp;
if (z <= -3.1e+53) {
tmp = (z * y) * x;
} else if (z <= -6e-297) {
tmp = t_1;
} else if (z <= 1.7e-85) {
tmp = (i * b) * t;
} else if (z <= 7800000000.0) {
tmp = t_1;
} else {
tmp = -b * (c * z);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = -a * (t * x) tmp = 0 if z <= -3.1e+53: tmp = (z * y) * x elif z <= -6e-297: tmp = t_1 elif z <= 1.7e-85: tmp = (i * b) * t elif z <= 7800000000.0: tmp = t_1 else: tmp = -b * (c * z) return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(-a) * Float64(t * x)) tmp = 0.0 if (z <= -3.1e+53) tmp = Float64(Float64(z * y) * x); elseif (z <= -6e-297) tmp = t_1; elseif (z <= 1.7e-85) tmp = Float64(Float64(i * b) * t); elseif (z <= 7800000000.0) tmp = t_1; else tmp = Float64(Float64(-b) * Float64(c * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = -a * (t * x); tmp = 0.0; if (z <= -3.1e+53) tmp = (z * y) * x; elseif (z <= -6e-297) tmp = t_1; elseif (z <= 1.7e-85) tmp = (i * b) * t; elseif (z <= 7800000000.0) tmp = t_1; else tmp = -b * (c * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.1e+53], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -6e-297], t$95$1, If[LessEqual[z, 1.7e-85], N[(N[(i * b), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 7800000000.0], t$95$1, N[((-b) * N[(c * z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{if}\;z \leq -3.1 \cdot 10^{+53}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{elif}\;z \leq -6 \cdot 10^{-297}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-85}:\\
\;\;\;\;\left(i \cdot b\right) \cdot t\\
\mathbf{elif}\;z \leq 7800000000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(-b\right) \cdot \left(c \cdot z\right)\\
\end{array}
\end{array}
if z < -3.10000000000000019e53Initial program 68.2%
Taylor expanded in x around inf
Applied rewrites57.0%
Taylor expanded in y around inf
Applied rewrites52.7%
if -3.10000000000000019e53 < z < -5.9999999999999999e-297 or 1.7e-85 < z < 7.8e9Initial program 74.8%
Taylor expanded in x around inf
Applied rewrites52.7%
Taylor expanded in y around 0
Applied rewrites39.6%
if -5.9999999999999999e-297 < z < 1.7e-85Initial program 83.9%
Taylor expanded in t around inf
Applied rewrites45.5%
Taylor expanded in x around 0
Applied rewrites33.6%
if 7.8e9 < z Initial program 66.1%
Taylor expanded in c around inf
Applied rewrites54.7%
Taylor expanded in z around inf
Applied rewrites43.7%
Final simplification41.5%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- t) a (* z y)) x)))
(if (<= x -6.6e+79)
t_1
(if (<= x -1.18e-200)
(* (fma (- c) z (* i t)) b)
(if (<= x 1.8e-56) (* (fma (- i) y (* c a)) j) 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, a, (z * y)) * x;
double tmp;
if (x <= -6.6e+79) {
tmp = t_1;
} else if (x <= -1.18e-200) {
tmp = fma(-c, z, (i * t)) * b;
} else if (x <= 1.8e-56) {
tmp = fma(-i, y, (c * a)) * j;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-t), a, Float64(z * y)) * x) tmp = 0.0 if (x <= -6.6e+79) tmp = t_1; elseif (x <= -1.18e-200) tmp = Float64(fma(Float64(-c), z, Float64(i * t)) * b); elseif (x <= 1.8e-56) tmp = Float64(fma(Float64(-i), y, Float64(c * a)) * j); 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) * a + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -6.6e+79], t$95$1, If[LessEqual[x, -1.18e-200], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[x, 1.8e-56], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-t, a, z \cdot y\right) \cdot x\\
\mathbf{if}\;x \leq -6.6 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.18 \cdot 10^{-200}:\\
\;\;\;\;\mathsf{fma}\left(-c, z, i \cdot t\right) \cdot b\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-56}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.6000000000000003e79 or 1.79999999999999989e-56 < x Initial program 73.0%
Taylor expanded in x around inf
Applied rewrites69.9%
if -6.6000000000000003e79 < x < -1.17999999999999996e-200Initial program 79.3%
Taylor expanded in b around inf
Applied rewrites51.6%
if -1.17999999999999996e-200 < x < 1.79999999999999989e-56Initial program 71.8%
Taylor expanded in j around inf
Applied rewrites52.0%
Final simplification60.1%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- b) c (* y x)) z)))
(if (<= z -4.2e+48)
t_1
(if (<= z -1.6e-242)
(* (* (- a) t) x)
(if (<= z 5.6e-27) (* (fma t b (* (- y) j)) i) 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(-b, c, (y * x)) * z;
double tmp;
if (z <= -4.2e+48) {
tmp = t_1;
} else if (z <= -1.6e-242) {
tmp = (-a * t) * x;
} else if (z <= 5.6e-27) {
tmp = fma(t, b, (-y * j)) * i;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-b), c, Float64(y * x)) * z) tmp = 0.0 if (z <= -4.2e+48) tmp = t_1; elseif (z <= -1.6e-242) tmp = Float64(Float64(Float64(-a) * t) * x); elseif (z <= 5.6e-27) tmp = Float64(fma(t, b, Float64(Float64(-y) * j)) * i); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -4.2e+48], t$95$1, If[LessEqual[z, -1.6e-242], N[(N[((-a) * t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 5.6e-27], N[(N[(t * b + N[((-y) * j), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{if}\;z \leq -4.2 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{-242}:\\
\;\;\;\;\left(\left(-a\right) \cdot t\right) \cdot x\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{-27}:\\
\;\;\;\;\mathsf{fma}\left(t, b, \left(-y\right) \cdot j\right) \cdot i\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.1999999999999997e48 or 5.5999999999999999e-27 < z Initial program 68.8%
Taylor expanded in z around inf
Applied rewrites62.3%
if -4.1999999999999997e48 < z < -1.59999999999999999e-242Initial program 74.1%
Taylor expanded in x around inf
Applied rewrites56.8%
Taylor expanded in y around 0
Applied rewrites44.2%
if -1.59999999999999999e-242 < z < 5.5999999999999999e-27Initial program 80.9%
Taylor expanded in i around inf
Applied rewrites48.3%
Applied rewrites48.3%
Final simplification53.6%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= a -8e+140) (not (<= a 1.1e+69))) (* (fma (- t) x (* j c)) a) (* (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 <= -8e+140) || !(a <= 1.1e+69)) {
tmp = fma(-t, x, (j * c)) * a;
} else {
tmp = fma(-i, j, (z * x)) * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((a <= -8e+140) || !(a <= 1.1e+69)) tmp = Float64(fma(Float64(-t), x, Float64(j * c)) * a); else tmp = 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, -8e+140], N[Not[LessEqual[a, 1.1e+69]], $MachinePrecision]], N[(N[((-t) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8 \cdot 10^{+140} \lor \neg \left(a \leq 1.1 \cdot 10^{+69}\right):\\
\;\;\;\;\mathsf{fma}\left(-t, x, j \cdot c\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\end{array}
\end{array}
if a < -8.00000000000000047e140 or 1.1000000000000001e69 < a Initial program 55.5%
Taylor expanded in a around inf
Applied rewrites77.9%
if -8.00000000000000047e140 < a < 1.1000000000000001e69Initial program 83.3%
Taylor expanded in y around inf
Applied rewrites50.8%
Final simplification60.0%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= a -5.8e+80) (not (<= a 2e+226))) (* (* c a) j) (* (* 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+80) || !(a <= 2e+226)) {
tmp = (c * a) * j;
} else {
tmp = (y * x) * z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, 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 ((a <= (-5.8d+80)) .or. (.not. (a <= 2d+226))) then
tmp = (c * a) * j
else
tmp = (y * x) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((a <= -5.8e+80) || !(a <= 2e+226)) {
tmp = (c * a) * j;
} else {
tmp = (y * x) * z;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (a <= -5.8e+80) or not (a <= 2e+226): tmp = (c * a) * j else: tmp = (y * x) * z return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((a <= -5.8e+80) || !(a <= 2e+226)) tmp = Float64(Float64(c * a) * j); else tmp = Float64(Float64(y * x) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((a <= -5.8e+80) || ~((a <= 2e+226))) tmp = (c * a) * j; else tmp = (y * x) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[a, -5.8e+80], N[Not[LessEqual[a, 2e+226]], $MachinePrecision]], N[(N[(c * a), $MachinePrecision] * j), $MachinePrecision], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.8 \cdot 10^{+80} \lor \neg \left(a \leq 2 \cdot 10^{+226}\right):\\
\;\;\;\;\left(c \cdot a\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\end{array}
\end{array}
if a < -5.79999999999999971e80 or 1.99999999999999992e226 < a Initial program 59.4%
Taylor expanded in c around inf
Applied rewrites54.2%
Taylor expanded in z around 0
Applied rewrites47.1%
Applied rewrites49.8%
if -5.79999999999999971e80 < a < 1.99999999999999992e226Initial program 79.1%
Taylor expanded in z around inf
Applied rewrites41.6%
Taylor expanded in x around inf
Applied rewrites27.2%
Final simplification33.2%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= a -4.8e+23) (not (<= a 4.5e+128))) (* (* 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 ((a <= -4.8e+23) || !(a <= 4.5e+128)) {
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 ((a <= (-4.8d+23)) .or. (.not. (a <= 4.5d+128))) 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 ((a <= -4.8e+23) || !(a <= 4.5e+128)) {
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 (a <= -4.8e+23) or not (a <= 4.5e+128): 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 ((a <= -4.8e+23) || !(a <= 4.5e+128)) 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 ((a <= -4.8e+23) || ~((a <= 4.5e+128))) 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[Or[LessEqual[a, -4.8e+23], N[Not[LessEqual[a, 4.5e+128]], $MachinePrecision]], N[(N[(c * a), $MachinePrecision] * j), $MachinePrecision], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.8 \cdot 10^{+23} \lor \neg \left(a \leq 4.5 \cdot 10^{+128}\right):\\
\;\;\;\;\left(c \cdot a\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\end{array}
\end{array}
if a < -4.8e23 or 4.5000000000000001e128 < a Initial program 57.5%
Taylor expanded in c around inf
Applied rewrites45.4%
Taylor expanded in z around 0
Applied rewrites37.5%
Applied rewrites39.4%
if -4.8e23 < a < 4.5000000000000001e128Initial program 84.0%
Taylor expanded in i around inf
Applied rewrites42.9%
Taylor expanded in y around 0
Applied rewrites24.5%
Final simplification30.2%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= a -5.8e+80) (* (* c a) j) (if (<= a 2e+226) (* (* y x) z) (* (* j a) c))))
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+80) {
tmp = (c * a) * j;
} else if (a <= 2e+226) {
tmp = (y * x) * z;
} else {
tmp = (j * a) * c;
}
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 (a <= (-5.8d+80)) then
tmp = (c * a) * j
else if (a <= 2d+226) then
tmp = (y * x) * z
else
tmp = (j * a) * c
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 (a <= -5.8e+80) {
tmp = (c * a) * j;
} else if (a <= 2e+226) {
tmp = (y * x) * z;
} else {
tmp = (j * a) * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if a <= -5.8e+80: tmp = (c * a) * j elif a <= 2e+226: tmp = (y * x) * z else: tmp = (j * a) * c return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (a <= -5.8e+80) tmp = Float64(Float64(c * a) * j); elseif (a <= 2e+226) tmp = Float64(Float64(y * x) * z); else tmp = Float64(Float64(j * a) * c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (a <= -5.8e+80) tmp = (c * a) * j; elseif (a <= 2e+226) tmp = (y * x) * z; else tmp = (j * a) * c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[a, -5.8e+80], N[(N[(c * a), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[a, 2e+226], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision], N[(N[(j * a), $MachinePrecision] * c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.8 \cdot 10^{+80}:\\
\;\;\;\;\left(c \cdot a\right) \cdot j\\
\mathbf{elif}\;a \leq 2 \cdot 10^{+226}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(j \cdot a\right) \cdot c\\
\end{array}
\end{array}
if a < -5.79999999999999971e80Initial program 58.0%
Taylor expanded in c around inf
Applied rewrites50.3%
Taylor expanded in z around 0
Applied rewrites42.0%
Applied rewrites46.0%
if -5.79999999999999971e80 < a < 1.99999999999999992e226Initial program 79.1%
Taylor expanded in z around inf
Applied rewrites41.6%
Taylor expanded in x around inf
Applied rewrites27.2%
if 1.99999999999999992e226 < a Initial program 62.4%
Taylor expanded in c around inf
Applied rewrites62.8%
Taylor expanded in z around 0
Applied rewrites63.1%
Final simplification33.6%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= a -4.8e+23) (* (* c a) j) (if (<= a 4.5e+128) (* (* i t) b) (* (* j c) a))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (a <= -4.8e+23) {
tmp = (c * a) * j;
} else if (a <= 4.5e+128) {
tmp = (i * t) * b;
} else {
tmp = (j * c) * a;
}
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 (a <= (-4.8d+23)) then
tmp = (c * a) * j
else if (a <= 4.5d+128) then
tmp = (i * t) * b
else
tmp = (j * c) * a
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 (a <= -4.8e+23) {
tmp = (c * a) * j;
} else if (a <= 4.5e+128) {
tmp = (i * t) * b;
} else {
tmp = (j * c) * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if a <= -4.8e+23: tmp = (c * a) * j elif a <= 4.5e+128: tmp = (i * t) * b else: tmp = (j * c) * a return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (a <= -4.8e+23) tmp = Float64(Float64(c * a) * j); elseif (a <= 4.5e+128) tmp = Float64(Float64(i * t) * b); else tmp = Float64(Float64(j * c) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (a <= -4.8e+23) tmp = (c * a) * j; elseif (a <= 4.5e+128) tmp = (i * t) * b; else tmp = (j * c) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[a, -4.8e+23], N[(N[(c * a), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[a, 4.5e+128], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision], N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.8 \cdot 10^{+23}:\\
\;\;\;\;\left(c \cdot a\right) \cdot j\\
\mathbf{elif}\;a \leq 4.5 \cdot 10^{+128}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(j \cdot c\right) \cdot a\\
\end{array}
\end{array}
if a < -4.8e23Initial program 61.4%
Taylor expanded in c around inf
Applied rewrites48.6%
Taylor expanded in z around 0
Applied rewrites35.4%
Applied rewrites38.6%
if -4.8e23 < a < 4.5000000000000001e128Initial program 84.0%
Taylor expanded in i around inf
Applied rewrites42.9%
Taylor expanded in y around 0
Applied rewrites24.5%
if 4.5000000000000001e128 < a Initial program 51.6%
Taylor expanded in c around inf
Applied rewrites40.4%
Taylor expanded in z around 0
Applied rewrites40.6%
Final simplification30.2%
(FPCore (x y z t a b c i j) :precision binary64 (* (* i t) b))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return (i * t) * 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)
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 = (i * t) * 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) {
return (i * t) * b;
}
def code(x, y, z, t, a, b, c, i, j): return (i * t) * b
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(i * t) * b) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = (i * t) * b; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision]
\begin{array}{l}
\\
\left(i \cdot t\right) \cdot b
\end{array}
Initial program 73.9%
Taylor expanded in i around inf
Applied rewrites34.0%
Taylor expanded in y around 0
Applied rewrites18.5%
Final simplification18.5%
(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 2025018
(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)))))