
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i))); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i))); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)
\end{array}
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i))))
(* j (- (* c a) (* y i))))))
(if (<= t_1 INFINITY) t_1 (* (fma (- i) y (* c a)) j))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(-i, y, (c * a)) * j;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(fma(Float64(-i), y, Float64(c * a)) * j); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\end{array}
\end{array}
if (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) < +inf.0Initial program 89.6%
if +inf.0 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) Initial program 0.0%
Taylor expanded in j around inf
Applied rewrites54.3%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i))))))
(if (<= (+ t_1 (* j (- (* c a) (* y i)))) INFINITY)
(+ t_1 (* j (* c a)))
(* (fma (- i) y (* c a)) j))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)));
double tmp;
if ((t_1 + (j * ((c * a) - (y * i)))) <= ((double) INFINITY)) {
tmp = t_1 + (j * (c * a));
} else {
tmp = fma(-i, y, (c * a)) * j;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) tmp = 0.0 if (Float64(t_1 + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) <= Inf) tmp = Float64(t_1 + Float64(j * Float64(c * a))); else tmp = Float64(fma(Float64(-i), y, Float64(c * a)) * j); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = 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]}, If[LessEqual[N[(t$95$1 + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$1 + N[(j * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\\
\mathbf{if}\;t\_1 + j \cdot \left(c \cdot a - y \cdot i\right) \leq \infty:\\
\;\;\;\;t\_1 + j \cdot \left(c \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\end{array}
\end{array}
if (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) < +inf.0Initial program 89.6%
Taylor expanded in y around 0
Applied rewrites82.1%
if +inf.0 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) Initial program 0.0%
Taylor expanded in j around inf
Applied rewrites54.3%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (fma (- a) t (* z y)) x (* (* i t) b))))
(if (<= y -1.06e+203)
(* (fma (- i) j (* z x)) y)
(if (<= y -4.3e-204)
t_1
(if (<= y 8e-226)
(* (fma j a (* (- b) z)) c)
(if (or (<= y 1.45e-144) (not (<= y 5.6e-41)))
t_1
(* (* a (- (/ (* c j) x) 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 = fma(fma(-a, t, (z * y)), x, ((i * t) * b));
double tmp;
if (y <= -1.06e+203) {
tmp = fma(-i, j, (z * x)) * y;
} else if (y <= -4.3e-204) {
tmp = t_1;
} else if (y <= 8e-226) {
tmp = fma(j, a, (-b * z)) * c;
} else if ((y <= 1.45e-144) || !(y <= 5.6e-41)) {
tmp = t_1;
} else {
tmp = (a * (((c * j) / x) - t)) * x;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(fma(Float64(-a), t, Float64(z * y)), x, Float64(Float64(i * t) * b)) tmp = 0.0 if (y <= -1.06e+203) tmp = Float64(fma(Float64(-i), j, Float64(z * x)) * y); elseif (y <= -4.3e-204) tmp = t_1; elseif (y <= 8e-226) tmp = Float64(fma(j, a, Float64(Float64(-b) * z)) * c); elseif ((y <= 1.45e-144) || !(y <= 5.6e-41)) tmp = t_1; else tmp = Float64(Float64(a * Float64(Float64(Float64(c * j) / x) - t)) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.06e+203], N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, -4.3e-204], t$95$1, If[LessEqual[y, 8e-226], N[(N[(j * a + N[((-b) * z), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], If[Or[LessEqual[y, 1.45e-144], N[Not[LessEqual[y, 5.6e-41]], $MachinePrecision]], t$95$1, N[(N[(a * N[(N[(N[(c * j), $MachinePrecision] / x), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(-a, t, z \cdot y\right), x, \left(i \cdot t\right) \cdot b\right)\\
\mathbf{if}\;y \leq -1.06 \cdot 10^{+203}:\\
\;\;\;\;\mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\mathbf{elif}\;y \leq -4.3 \cdot 10^{-204}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-226}:\\
\;\;\;\;\mathsf{fma}\left(j, a, \left(-b\right) \cdot z\right) \cdot c\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-144} \lor \neg \left(y \leq 5.6 \cdot 10^{-41}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot \left(\frac{c \cdot j}{x} - t\right)\right) \cdot x\\
\end{array}
\end{array}
if y < -1.05999999999999994e203Initial program 68.3%
Taylor expanded in y around inf
Applied rewrites87.0%
if -1.05999999999999994e203 < y < -4.3000000000000003e-204 or 7.99999999999999937e-226 < y < 1.4500000000000001e-144 or 5.6000000000000003e-41 < y Initial program 73.7%
Taylor expanded in j around 0
Applied rewrites65.9%
Taylor expanded in z around 0
Applied rewrites65.1%
if -4.3000000000000003e-204 < y < 7.99999999999999937e-226Initial program 85.6%
Taylor expanded in c around inf
Applied rewrites67.3%
if 1.4500000000000001e-144 < y < 5.6000000000000003e-41Initial program 86.2%
Taylor expanded in x around inf
Applied rewrites82.4%
Taylor expanded in x around inf
Applied rewrites77.8%
Taylor expanded in a around inf
Applied rewrites78.2%
Final simplification69.2%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= i -5.8e+70) (not (<= i 1.7e+166))) (* (- i) (fma j y (* (- b) t))) (+ (- (* x (- (* y z) (* t a))) (* b (* c z))) (* 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 ((i <= -5.8e+70) || !(i <= 1.7e+166)) {
tmp = -i * fma(j, y, (-b * t));
} else {
tmp = ((x * ((y * z) - (t * a))) - (b * (c * z))) + (j * (c * a));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((i <= -5.8e+70) || !(i <= 1.7e+166)) tmp = Float64(Float64(-i) * fma(j, y, Float64(Float64(-b) * t))); else tmp = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(c * z))) + Float64(j * Float64(c * a))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[i, -5.8e+70], N[Not[LessEqual[i, 1.7e+166]], $MachinePrecision]], N[((-i) * N[(j * y + N[((-b) * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -5.8 \cdot 10^{+70} \lor \neg \left(i \leq 1.7 \cdot 10^{+166}\right):\\
\;\;\;\;\left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z\right)\right) + j \cdot \left(c \cdot a\right)\\
\end{array}
\end{array}
if i < -5.7999999999999997e70 or 1.7e166 < i Initial program 60.8%
Taylor expanded in i around -inf
Applied rewrites72.0%
if -5.7999999999999997e70 < i < 1.7e166Initial program 82.0%
Taylor expanded in y around 0
Applied rewrites77.7%
Taylor expanded in z around inf
Applied rewrites73.1%
Final simplification72.8%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= j -0.032) (not (<= j 2.75e-73))) (+ (* (- a) (* t x)) (* j (- (* c a) (* y i)))) (fma (fma z y (* (- t) a)) x (* (- b) (fma (- i) t (* 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 ((j <= -0.032) || !(j <= 2.75e-73)) {
tmp = (-a * (t * x)) + (j * ((c * a) - (y * i)));
} else {
tmp = fma(fma(z, y, (-t * a)), x, (-b * fma(-i, t, (c * z))));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((j <= -0.032) || !(j <= 2.75e-73)) tmp = Float64(Float64(Float64(-a) * Float64(t * x)) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))); else tmp = fma(fma(z, y, Float64(Float64(-t) * a)), x, Float64(Float64(-b) * fma(Float64(-i), t, Float64(c * z)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[j, -0.032], N[Not[LessEqual[j, 2.75e-73]], $MachinePrecision]], N[(N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * y + N[((-t) * a), $MachinePrecision]), $MachinePrecision] * x + N[((-b) * N[((-i) * t + N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;j \leq -0.032 \lor \neg \left(j \leq 2.75 \cdot 10^{-73}\right):\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, y, \left(-t\right) \cdot a\right), x, \left(-b\right) \cdot \mathsf{fma}\left(-i, t, c \cdot z\right)\right)\\
\end{array}
\end{array}
if j < -0.032000000000000001 or 2.75000000000000003e-73 < j Initial program 75.8%
Taylor expanded in a around inf
Applied rewrites70.9%
if -0.032000000000000001 < j < 2.75000000000000003e-73Initial program 76.2%
Taylor expanded in j around 0
Applied rewrites73.3%
Applied rewrites73.3%
Final simplification72.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* y x) z)))
(if (<= x -7.2e+254)
(* (- a) (* t x))
(if (<= x -3.7e+82)
t_1
(if (<= x 7.5e-264)
(* (- t) (* (- b) i))
(if (<= x 4.1e+14)
(* (* (- i) j) y)
(if (<= x 1.1e+125)
t_1
(if (<= x 1.55e+187) (* (- t) (* a x)) (* (* z x) y)))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (y * x) * z;
double tmp;
if (x <= -7.2e+254) {
tmp = -a * (t * x);
} else if (x <= -3.7e+82) {
tmp = t_1;
} else if (x <= 7.5e-264) {
tmp = -t * (-b * i);
} else if (x <= 4.1e+14) {
tmp = (-i * j) * y;
} else if (x <= 1.1e+125) {
tmp = t_1;
} else if (x <= 1.55e+187) {
tmp = -t * (a * x);
} else {
tmp = (z * x) * y;
}
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 = (y * x) * z
if (x <= (-7.2d+254)) then
tmp = -a * (t * x)
else if (x <= (-3.7d+82)) then
tmp = t_1
else if (x <= 7.5d-264) then
tmp = -t * (-b * i)
else if (x <= 4.1d+14) then
tmp = (-i * j) * y
else if (x <= 1.1d+125) then
tmp = t_1
else if (x <= 1.55d+187) then
tmp = -t * (a * x)
else
tmp = (z * x) * y
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 = (y * x) * z;
double tmp;
if (x <= -7.2e+254) {
tmp = -a * (t * x);
} else if (x <= -3.7e+82) {
tmp = t_1;
} else if (x <= 7.5e-264) {
tmp = -t * (-b * i);
} else if (x <= 4.1e+14) {
tmp = (-i * j) * y;
} else if (x <= 1.1e+125) {
tmp = t_1;
} else if (x <= 1.55e+187) {
tmp = -t * (a * x);
} else {
tmp = (z * x) * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (y * x) * z tmp = 0 if x <= -7.2e+254: tmp = -a * (t * x) elif x <= -3.7e+82: tmp = t_1 elif x <= 7.5e-264: tmp = -t * (-b * i) elif x <= 4.1e+14: tmp = (-i * j) * y elif x <= 1.1e+125: tmp = t_1 elif x <= 1.55e+187: tmp = -t * (a * x) else: tmp = (z * x) * y return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(y * x) * z) tmp = 0.0 if (x <= -7.2e+254) tmp = Float64(Float64(-a) * Float64(t * x)); elseif (x <= -3.7e+82) tmp = t_1; elseif (x <= 7.5e-264) tmp = Float64(Float64(-t) * Float64(Float64(-b) * i)); elseif (x <= 4.1e+14) tmp = Float64(Float64(Float64(-i) * j) * y); elseif (x <= 1.1e+125) tmp = t_1; elseif (x <= 1.55e+187) tmp = Float64(Float64(-t) * Float64(a * x)); else tmp = Float64(Float64(z * x) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (y * x) * z; tmp = 0.0; if (x <= -7.2e+254) tmp = -a * (t * x); elseif (x <= -3.7e+82) tmp = t_1; elseif (x <= 7.5e-264) tmp = -t * (-b * i); elseif (x <= 4.1e+14) tmp = (-i * j) * y; elseif (x <= 1.1e+125) tmp = t_1; elseif (x <= 1.55e+187) tmp = -t * (a * x); else tmp = (z * x) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[x, -7.2e+254], N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.7e+82], t$95$1, If[LessEqual[x, 7.5e-264], N[((-t) * N[((-b) * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.1e+14], N[(N[((-i) * j), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[x, 1.1e+125], t$95$1, If[LessEqual[x, 1.55e+187], N[((-t) * N[(a * x), $MachinePrecision]), $MachinePrecision], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y \cdot x\right) \cdot z\\
\mathbf{if}\;x \leq -7.2 \cdot 10^{+254}:\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{+82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-264}:\\
\;\;\;\;\left(-t\right) \cdot \left(\left(-b\right) \cdot i\right)\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{+14}:\\
\;\;\;\;\left(\left(-i\right) \cdot j\right) \cdot y\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+125}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{+187}:\\
\;\;\;\;\left(-t\right) \cdot \left(a \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\end{array}
\end{array}
if x < -7.19999999999999954e254Initial program 87.4%
Taylor expanded in t around -inf
Applied rewrites63.3%
Taylor expanded in x around inf
Applied rewrites66.3%
if -7.19999999999999954e254 < x < -3.7000000000000002e82 or 4.1e14 < x < 1.09999999999999995e125Initial program 81.7%
Taylor expanded in y around inf
Applied rewrites59.8%
Taylor expanded in x around inf
Applied rewrites52.6%
Applied rewrites56.1%
if -3.7000000000000002e82 < x < 7.5000000000000001e-264Initial program 71.8%
Taylor expanded in t around -inf
Applied rewrites45.4%
Taylor expanded in x around 0
Applied rewrites31.8%
if 7.5000000000000001e-264 < x < 4.1e14Initial program 76.3%
Taylor expanded in y around inf
Applied rewrites36.7%
Taylor expanded in x around 0
Applied rewrites33.5%
if 1.09999999999999995e125 < x < 1.55000000000000006e187Initial program 64.2%
Taylor expanded in t around -inf
Applied rewrites69.0%
Taylor expanded in x around inf
Applied rewrites69.0%
if 1.55000000000000006e187 < x Initial program 75.9%
Taylor expanded in y around inf
Applied rewrites64.1%
Taylor expanded in x around inf
Applied rewrites64.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* y x) z)))
(if (<= x -7.2e+254)
(* (- a) (* t x))
(if (<= x -3.7e+82)
t_1
(if (<= x 7.5e-264)
(* (* i t) b)
(if (<= x 4.1e+14)
(* (* (- i) j) y)
(if (<= x 1.1e+125)
t_1
(if (<= x 1.55e+187) (* (- t) (* a x)) (* (* z x) y)))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (y * x) * z;
double tmp;
if (x <= -7.2e+254) {
tmp = -a * (t * x);
} else if (x <= -3.7e+82) {
tmp = t_1;
} else if (x <= 7.5e-264) {
tmp = (i * t) * b;
} else if (x <= 4.1e+14) {
tmp = (-i * j) * y;
} else if (x <= 1.1e+125) {
tmp = t_1;
} else if (x <= 1.55e+187) {
tmp = -t * (a * x);
} else {
tmp = (z * x) * y;
}
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 = (y * x) * z
if (x <= (-7.2d+254)) then
tmp = -a * (t * x)
else if (x <= (-3.7d+82)) then
tmp = t_1
else if (x <= 7.5d-264) then
tmp = (i * t) * b
else if (x <= 4.1d+14) then
tmp = (-i * j) * y
else if (x <= 1.1d+125) then
tmp = t_1
else if (x <= 1.55d+187) then
tmp = -t * (a * x)
else
tmp = (z * x) * y
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 = (y * x) * z;
double tmp;
if (x <= -7.2e+254) {
tmp = -a * (t * x);
} else if (x <= -3.7e+82) {
tmp = t_1;
} else if (x <= 7.5e-264) {
tmp = (i * t) * b;
} else if (x <= 4.1e+14) {
tmp = (-i * j) * y;
} else if (x <= 1.1e+125) {
tmp = t_1;
} else if (x <= 1.55e+187) {
tmp = -t * (a * x);
} else {
tmp = (z * x) * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (y * x) * z tmp = 0 if x <= -7.2e+254: tmp = -a * (t * x) elif x <= -3.7e+82: tmp = t_1 elif x <= 7.5e-264: tmp = (i * t) * b elif x <= 4.1e+14: tmp = (-i * j) * y elif x <= 1.1e+125: tmp = t_1 elif x <= 1.55e+187: tmp = -t * (a * x) else: tmp = (z * x) * y return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(y * x) * z) tmp = 0.0 if (x <= -7.2e+254) tmp = Float64(Float64(-a) * Float64(t * x)); elseif (x <= -3.7e+82) tmp = t_1; elseif (x <= 7.5e-264) tmp = Float64(Float64(i * t) * b); elseif (x <= 4.1e+14) tmp = Float64(Float64(Float64(-i) * j) * y); elseif (x <= 1.1e+125) tmp = t_1; elseif (x <= 1.55e+187) tmp = Float64(Float64(-t) * Float64(a * x)); else tmp = Float64(Float64(z * x) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (y * x) * z; tmp = 0.0; if (x <= -7.2e+254) tmp = -a * (t * x); elseif (x <= -3.7e+82) tmp = t_1; elseif (x <= 7.5e-264) tmp = (i * t) * b; elseif (x <= 4.1e+14) tmp = (-i * j) * y; elseif (x <= 1.1e+125) tmp = t_1; elseif (x <= 1.55e+187) tmp = -t * (a * x); else tmp = (z * x) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[x, -7.2e+254], N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.7e+82], t$95$1, If[LessEqual[x, 7.5e-264], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[x, 4.1e+14], N[(N[((-i) * j), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[x, 1.1e+125], t$95$1, If[LessEqual[x, 1.55e+187], N[((-t) * N[(a * x), $MachinePrecision]), $MachinePrecision], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y \cdot x\right) \cdot z\\
\mathbf{if}\;x \leq -7.2 \cdot 10^{+254}:\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{+82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-264}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{+14}:\\
\;\;\;\;\left(\left(-i\right) \cdot j\right) \cdot y\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+125}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{+187}:\\
\;\;\;\;\left(-t\right) \cdot \left(a \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\end{array}
\end{array}
if x < -7.19999999999999954e254Initial program 87.4%
Taylor expanded in t around -inf
Applied rewrites63.3%
Taylor expanded in x around inf
Applied rewrites66.3%
if -7.19999999999999954e254 < x < -3.7000000000000002e82 or 4.1e14 < x < 1.09999999999999995e125Initial program 81.7%
Taylor expanded in y around inf
Applied rewrites59.8%
Taylor expanded in x around inf
Applied rewrites52.6%
Applied rewrites56.1%
if -3.7000000000000002e82 < x < 7.5000000000000001e-264Initial program 71.8%
Taylor expanded in b around inf
Applied rewrites42.6%
Taylor expanded in z around 0
Applied rewrites31.8%
if 7.5000000000000001e-264 < x < 4.1e14Initial program 76.3%
Taylor expanded in y around inf
Applied rewrites36.7%
Taylor expanded in x around 0
Applied rewrites33.5%
if 1.09999999999999995e125 < x < 1.55000000000000006e187Initial program 64.2%
Taylor expanded in t around -inf
Applied rewrites69.0%
Taylor expanded in x around inf
Applied rewrites69.0%
if 1.55000000000000006e187 < x Initial program 75.9%
Taylor expanded in y around inf
Applied rewrites64.1%
Taylor expanded in x around inf
Applied rewrites64.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- a) t (* z y)) x)))
(if (<= x -3.7e+82)
t_1
(if (<= x -1.26e-57)
(* (- t) (fma a x (* (- b) i)))
(if (<= x -1.65e-226)
(* (fma j a (* (- b) z)) c)
(if (<= x 4.1e-253)
(* (- i) (fma j y (* (- b) t)))
(if (<= x 9.5e-6) (* (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(-a, t, (z * y)) * x;
double tmp;
if (x <= -3.7e+82) {
tmp = t_1;
} else if (x <= -1.26e-57) {
tmp = -t * fma(a, x, (-b * i));
} else if (x <= -1.65e-226) {
tmp = fma(j, a, (-b * z)) * c;
} else if (x <= 4.1e-253) {
tmp = -i * fma(j, y, (-b * t));
} else if (x <= 9.5e-6) {
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(-a), t, Float64(z * y)) * x) tmp = 0.0 if (x <= -3.7e+82) tmp = t_1; elseif (x <= -1.26e-57) tmp = Float64(Float64(-t) * fma(a, x, Float64(Float64(-b) * i))); elseif (x <= -1.65e-226) tmp = Float64(fma(j, a, Float64(Float64(-b) * z)) * c); elseif (x <= 4.1e-253) tmp = Float64(Float64(-i) * fma(j, y, Float64(Float64(-b) * t))); elseif (x <= 9.5e-6) 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[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -3.7e+82], t$95$1, If[LessEqual[x, -1.26e-57], N[((-t) * N[(a * x + N[((-b) * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.65e-226], N[(N[(j * a + N[((-b) * z), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[x, 4.1e-253], N[((-i) * N[(j * y + N[((-b) * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.5e-6], 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(-a, t, z \cdot y\right) \cdot x\\
\mathbf{if}\;x \leq -3.7 \cdot 10^{+82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.26 \cdot 10^{-57}:\\
\;\;\;\;\left(-t\right) \cdot \mathsf{fma}\left(a, x, \left(-b\right) \cdot i\right)\\
\mathbf{elif}\;x \leq -1.65 \cdot 10^{-226}:\\
\;\;\;\;\mathsf{fma}\left(j, a, \left(-b\right) \cdot z\right) \cdot c\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-253}:\\
\;\;\;\;\left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right)\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.7000000000000002e82 or 9.5000000000000005e-6 < x Initial program 78.5%
Taylor expanded in x around inf
Applied rewrites72.5%
if -3.7000000000000002e82 < x < -1.26e-57Initial program 66.3%
Taylor expanded in t around -inf
Applied rewrites53.2%
if -1.26e-57 < x < -1.65e-226Initial program 80.4%
Taylor expanded in c around inf
Applied rewrites61.5%
if -1.65e-226 < x < 4.10000000000000002e-253Initial program 64.5%
Taylor expanded in i around -inf
Applied rewrites68.8%
if 4.10000000000000002e-253 < x < 9.5000000000000005e-6Initial program 79.2%
Taylor expanded in j around inf
Applied rewrites60.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- a) t (* z y)) x)))
(if (<= x -1.45e+106)
t_1
(if (<= x -2.35e+30)
(* (fma y x (* (- b) c)) z)
(if (<= x -7.6e-162)
(* (fma (- t) x (* j c)) a)
(if (<= x 3.5e-253)
(* (fma i t (* (- c) z)) b)
(if (<= x 9.5e-6) (* (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(-a, t, (z * y)) * x;
double tmp;
if (x <= -1.45e+106) {
tmp = t_1;
} else if (x <= -2.35e+30) {
tmp = fma(y, x, (-b * c)) * z;
} else if (x <= -7.6e-162) {
tmp = fma(-t, x, (j * c)) * a;
} else if (x <= 3.5e-253) {
tmp = fma(i, t, (-c * z)) * b;
} else if (x <= 9.5e-6) {
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(-a), t, Float64(z * y)) * x) tmp = 0.0 if (x <= -1.45e+106) tmp = t_1; elseif (x <= -2.35e+30) tmp = Float64(fma(y, x, Float64(Float64(-b) * c)) * z); elseif (x <= -7.6e-162) tmp = Float64(fma(Float64(-t), x, Float64(j * c)) * a); elseif (x <= 3.5e-253) tmp = Float64(fma(i, t, Float64(Float64(-c) * z)) * b); elseif (x <= 9.5e-6) 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[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -1.45e+106], t$95$1, If[LessEqual[x, -2.35e+30], N[(N[(y * x + N[((-b) * c), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[x, -7.6e-162], N[(N[((-t) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[x, 3.5e-253], N[(N[(i * t + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[x, 9.5e-6], 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(-a, t, z \cdot y\right) \cdot x\\
\mathbf{if}\;x \leq -1.45 \cdot 10^{+106}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.35 \cdot 10^{+30}:\\
\;\;\;\;\mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z\\
\mathbf{elif}\;x \leq -7.6 \cdot 10^{-162}:\\
\;\;\;\;\mathsf{fma}\left(-t, x, j \cdot c\right) \cdot a\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-253}:\\
\;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.4500000000000001e106 or 9.5000000000000005e-6 < x Initial program 81.0%
Taylor expanded in x around inf
Applied rewrites73.7%
if -1.4500000000000001e106 < x < -2.34999999999999995e30Initial program 62.9%
Taylor expanded in z around inf
Applied rewrites63.9%
if -2.34999999999999995e30 < x < -7.6000000000000001e-162Initial program 68.3%
Taylor expanded in a around inf
Applied rewrites52.3%
if -7.6000000000000001e-162 < x < 3.50000000000000022e-253Initial program 70.9%
Taylor expanded in b around inf
Applied rewrites65.3%
if 3.50000000000000022e-253 < x < 9.5000000000000005e-6Initial program 79.2%
Taylor expanded in j around inf
Applied rewrites60.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- i) y (* c a)) j)) (t_2 (* (fma (- a) t (* z y)) x)))
(if (<= x -1.6e+91)
t_2
(if (<= x -2.3e-55)
t_1
(if (<= x -4.6e-287)
(* (fma j a (* (- b) z)) c)
(if (<= x 3.5e-253)
(* (fma i t (* (- c) z)) b)
(if (<= x 9.5e-6) t_1 t_2)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-i, y, (c * a)) * j;
double t_2 = fma(-a, t, (z * y)) * x;
double tmp;
if (x <= -1.6e+91) {
tmp = t_2;
} else if (x <= -2.3e-55) {
tmp = t_1;
} else if (x <= -4.6e-287) {
tmp = fma(j, a, (-b * z)) * c;
} else if (x <= 3.5e-253) {
tmp = fma(i, t, (-c * z)) * b;
} else if (x <= 9.5e-6) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-i), y, Float64(c * a)) * j) t_2 = Float64(fma(Float64(-a), t, Float64(z * y)) * x) tmp = 0.0 if (x <= -1.6e+91) tmp = t_2; elseif (x <= -2.3e-55) tmp = t_1; elseif (x <= -4.6e-287) tmp = Float64(fma(j, a, Float64(Float64(-b) * z)) * c); elseif (x <= 3.5e-253) tmp = Float64(fma(i, t, Float64(Float64(-c) * z)) * b); elseif (x <= 9.5e-6) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -1.6e+91], t$95$2, If[LessEqual[x, -2.3e-55], t$95$1, If[LessEqual[x, -4.6e-287], N[(N[(j * a + N[((-b) * z), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[x, 3.5e-253], N[(N[(i * t + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[x, 9.5e-6], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
t_2 := \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\
\mathbf{if}\;x \leq -1.6 \cdot 10^{+91}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{-55}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -4.6 \cdot 10^{-287}:\\
\;\;\;\;\mathsf{fma}\left(j, a, \left(-b\right) \cdot z\right) \cdot c\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-253}:\\
\;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -1.59999999999999995e91 or 9.5000000000000005e-6 < x Initial program 80.6%
Taylor expanded in x around inf
Applied rewrites73.6%
if -1.59999999999999995e91 < x < -2.30000000000000011e-55 or 3.50000000000000022e-253 < x < 9.5000000000000005e-6Initial program 72.1%
Taylor expanded in j around inf
Applied rewrites54.3%
if -2.30000000000000011e-55 < x < -4.59999999999999972e-287Initial program 77.1%
Taylor expanded in c around inf
Applied rewrites55.1%
if -4.59999999999999972e-287 < x < 3.50000000000000022e-253Initial program 59.2%
Taylor expanded in b around inf
Applied rewrites91.8%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= t -5.6e+28) (not (<= t 1.15e+31))) (fma (fma (- a) t (* z y)) x (* (* i t) b)) (+ (* (* z y) x) (* 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 <= -5.6e+28) || !(t <= 1.15e+31)) {
tmp = fma(fma(-a, t, (z * y)), x, ((i * t) * b));
} else {
tmp = ((z * y) * x) + (j * ((c * a) - (y * i)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((t <= -5.6e+28) || !(t <= 1.15e+31)) tmp = fma(fma(Float64(-a), t, Float64(z * y)), x, Float64(Float64(i * t) * b)); else tmp = Float64(Float64(Float64(z * y) * x) + 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, -5.6e+28], N[Not[LessEqual[t, 1.15e+31]], $MachinePrecision]], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] * x), $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 -5.6 \cdot 10^{+28} \lor \neg \left(t \leq 1.15 \cdot 10^{+31}\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-a, t, z \cdot y\right), x, \left(i \cdot t\right) \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x + j \cdot \left(c \cdot a - y \cdot i\right)\\
\end{array}
\end{array}
if t < -5.6000000000000003e28 or 1.15e31 < t Initial program 70.0%
Taylor expanded in j around 0
Applied rewrites69.6%
Taylor expanded in z around 0
Applied rewrites70.3%
if -5.6000000000000003e28 < t < 1.15e31Initial program 80.9%
Taylor expanded in y around inf
Applied rewrites67.6%
Final simplification68.8%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= x -7.2e+254)
(* (- a) (* t x))
(if (<= x -3.7e+82)
(* (* y x) z)
(if (<= x 7.5e-264)
(* (* i t) b)
(if (<= x 4.1e+14) (* (* (- i) j) y) (* (* 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 (x <= -7.2e+254) {
tmp = -a * (t * x);
} else if (x <= -3.7e+82) {
tmp = (y * x) * z;
} else if (x <= 7.5e-264) {
tmp = (i * t) * b;
} else if (x <= 4.1e+14) {
tmp = (-i * j) * y;
} else {
tmp = (z * x) * y;
}
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 (x <= (-7.2d+254)) then
tmp = -a * (t * x)
else if (x <= (-3.7d+82)) then
tmp = (y * x) * z
else if (x <= 7.5d-264) then
tmp = (i * t) * b
else if (x <= 4.1d+14) then
tmp = (-i * j) * y
else
tmp = (z * x) * y
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 (x <= -7.2e+254) {
tmp = -a * (t * x);
} else if (x <= -3.7e+82) {
tmp = (y * x) * z;
} else if (x <= 7.5e-264) {
tmp = (i * t) * b;
} else if (x <= 4.1e+14) {
tmp = (-i * j) * y;
} else {
tmp = (z * x) * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if x <= -7.2e+254: tmp = -a * (t * x) elif x <= -3.7e+82: tmp = (y * x) * z elif x <= 7.5e-264: tmp = (i * t) * b elif x <= 4.1e+14: tmp = (-i * j) * y else: tmp = (z * x) * y return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -7.2e+254) tmp = Float64(Float64(-a) * Float64(t * x)); elseif (x <= -3.7e+82) tmp = Float64(Float64(y * x) * z); elseif (x <= 7.5e-264) tmp = Float64(Float64(i * t) * b); elseif (x <= 4.1e+14) tmp = Float64(Float64(Float64(-i) * j) * y); else tmp = Float64(Float64(z * x) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (x <= -7.2e+254) tmp = -a * (t * x); elseif (x <= -3.7e+82) tmp = (y * x) * z; elseif (x <= 7.5e-264) tmp = (i * t) * b; elseif (x <= 4.1e+14) tmp = (-i * j) * y; else tmp = (z * x) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -7.2e+254], N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.7e+82], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[x, 7.5e-264], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[x, 4.1e+14], N[(N[((-i) * j), $MachinePrecision] * y), $MachinePrecision], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+254}:\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{+82}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-264}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{+14}:\\
\;\;\;\;\left(\left(-i\right) \cdot j\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\end{array}
\end{array}
if x < -7.19999999999999954e254Initial program 87.4%
Taylor expanded in t around -inf
Applied rewrites63.3%
Taylor expanded in x around inf
Applied rewrites66.3%
if -7.19999999999999954e254 < x < -3.7000000000000002e82Initial program 76.6%
Taylor expanded in y around inf
Applied rewrites63.4%
Taylor expanded in x around inf
Applied rewrites52.4%
Applied rewrites58.0%
if -3.7000000000000002e82 < x < 7.5000000000000001e-264Initial program 71.8%
Taylor expanded in b around inf
Applied rewrites42.6%
Taylor expanded in z around 0
Applied rewrites31.8%
if 7.5000000000000001e-264 < x < 4.1e14Initial program 76.3%
Taylor expanded in y around inf
Applied rewrites36.7%
Taylor expanded in x around 0
Applied rewrites33.5%
if 4.1e14 < x Initial program 78.1%
Taylor expanded in y around inf
Applied rewrites52.8%
Taylor expanded in x around inf
Applied rewrites47.8%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= x -7.2e+254)
(* (- a) (* t x))
(if (<= x -3.7e+82)
(* (* y x) z)
(if (<= x 6.6e-236)
(* (* i t) b)
(if (<= x 5e+14) (* (- i) (* j y)) (* (* 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 (x <= -7.2e+254) {
tmp = -a * (t * x);
} else if (x <= -3.7e+82) {
tmp = (y * x) * z;
} else if (x <= 6.6e-236) {
tmp = (i * t) * b;
} else if (x <= 5e+14) {
tmp = -i * (j * y);
} else {
tmp = (z * x) * y;
}
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 (x <= (-7.2d+254)) then
tmp = -a * (t * x)
else if (x <= (-3.7d+82)) then
tmp = (y * x) * z
else if (x <= 6.6d-236) then
tmp = (i * t) * b
else if (x <= 5d+14) then
tmp = -i * (j * y)
else
tmp = (z * x) * y
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 (x <= -7.2e+254) {
tmp = -a * (t * x);
} else if (x <= -3.7e+82) {
tmp = (y * x) * z;
} else if (x <= 6.6e-236) {
tmp = (i * t) * b;
} else if (x <= 5e+14) {
tmp = -i * (j * y);
} else {
tmp = (z * x) * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if x <= -7.2e+254: tmp = -a * (t * x) elif x <= -3.7e+82: tmp = (y * x) * z elif x <= 6.6e-236: tmp = (i * t) * b elif x <= 5e+14: tmp = -i * (j * y) else: tmp = (z * x) * y return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -7.2e+254) tmp = Float64(Float64(-a) * Float64(t * x)); elseif (x <= -3.7e+82) tmp = Float64(Float64(y * x) * z); elseif (x <= 6.6e-236) tmp = Float64(Float64(i * t) * b); elseif (x <= 5e+14) tmp = Float64(Float64(-i) * Float64(j * y)); else tmp = Float64(Float64(z * x) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (x <= -7.2e+254) tmp = -a * (t * x); elseif (x <= -3.7e+82) tmp = (y * x) * z; elseif (x <= 6.6e-236) tmp = (i * t) * b; elseif (x <= 5e+14) tmp = -i * (j * y); else tmp = (z * x) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -7.2e+254], N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.7e+82], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[x, 6.6e-236], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[x, 5e+14], N[((-i) * N[(j * y), $MachinePrecision]), $MachinePrecision], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+254}:\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{+82}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{-236}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+14}:\\
\;\;\;\;\left(-i\right) \cdot \left(j \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\end{array}
\end{array}
if x < -7.19999999999999954e254Initial program 87.4%
Taylor expanded in t around -inf
Applied rewrites63.3%
Taylor expanded in x around inf
Applied rewrites66.3%
if -7.19999999999999954e254 < x < -3.7000000000000002e82Initial program 76.6%
Taylor expanded in y around inf
Applied rewrites63.4%
Taylor expanded in x around inf
Applied rewrites52.4%
Applied rewrites58.0%
if -3.7000000000000002e82 < x < 6.6000000000000002e-236Initial program 71.9%
Taylor expanded in b around inf
Applied rewrites42.8%
Taylor expanded in z around 0
Applied rewrites32.7%
if 6.6000000000000002e-236 < x < 5e14Initial program 76.7%
Taylor expanded in y around inf
Applied rewrites35.7%
Taylor expanded in x around 0
Applied rewrites30.7%
if 5e14 < x Initial program 78.1%
Taylor expanded in y around inf
Applied rewrites52.8%
Taylor expanded in x around inf
Applied rewrites47.8%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= y -1.9e+199)
(* (* (- i) j) y)
(if (<= y -2.7e+20)
(* (fma i t (* (- c) z)) b)
(if (<= y 1.95e+123) (* (fma j a (* (- b) z)) c) (* (* y x) z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (y <= -1.9e+199) {
tmp = (-i * j) * y;
} else if (y <= -2.7e+20) {
tmp = fma(i, t, (-c * z)) * b;
} else if (y <= 1.95e+123) {
tmp = fma(j, a, (-b * z)) * c;
} else {
tmp = (y * x) * z;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (y <= -1.9e+199) tmp = Float64(Float64(Float64(-i) * j) * y); elseif (y <= -2.7e+20) tmp = Float64(fma(i, t, Float64(Float64(-c) * z)) * b); elseif (y <= 1.95e+123) tmp = Float64(fma(j, a, Float64(Float64(-b) * z)) * c); else tmp = Float64(Float64(y * x) * z); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[y, -1.9e+199], N[(N[((-i) * j), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, -2.7e+20], N[(N[(i * t + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[y, 1.95e+123], N[(N[(j * a + N[((-b) * z), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{+199}:\\
\;\;\;\;\left(\left(-i\right) \cdot j\right) \cdot y\\
\mathbf{elif}\;y \leq -2.7 \cdot 10^{+20}:\\
\;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+123}:\\
\;\;\;\;\mathsf{fma}\left(j, a, \left(-b\right) \cdot z\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\end{array}
\end{array}
if y < -1.9e199Initial program 70.2%
Taylor expanded in y around inf
Applied rewrites84.9%
Taylor expanded in x around 0
Applied rewrites52.4%
if -1.9e199 < y < -2.7e20Initial program 88.0%
Taylor expanded in b around inf
Applied rewrites48.8%
if -2.7e20 < y < 1.94999999999999996e123Initial program 77.2%
Taylor expanded in c around inf
Applied rewrites49.6%
if 1.94999999999999996e123 < y Initial program 64.2%
Taylor expanded in y around inf
Applied rewrites70.3%
Taylor expanded in x around inf
Applied rewrites56.1%
Applied rewrites59.0%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= x -7.2e+254)
(* (- a) (* t x))
(if (<= x -3.2e+99)
(* (* y x) z)
(if (<= x 3.4e+71) (* (fma i t (* (- c) z)) b) (* (* 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 (x <= -7.2e+254) {
tmp = -a * (t * x);
} else if (x <= -3.2e+99) {
tmp = (y * x) * z;
} else if (x <= 3.4e+71) {
tmp = fma(i, t, (-c * z)) * b;
} else {
tmp = (z * x) * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -7.2e+254) tmp = Float64(Float64(-a) * Float64(t * x)); elseif (x <= -3.2e+99) tmp = Float64(Float64(y * x) * z); elseif (x <= 3.4e+71) tmp = Float64(fma(i, t, Float64(Float64(-c) * z)) * b); else tmp = Float64(Float64(z * x) * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -7.2e+254], N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.2e+99], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[x, 3.4e+71], N[(N[(i * t + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+254}:\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{+99}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{+71}:\\
\;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\end{array}
\end{array}
if x < -7.19999999999999954e254Initial program 87.4%
Taylor expanded in t around -inf
Applied rewrites63.3%
Taylor expanded in x around inf
Applied rewrites66.3%
if -7.19999999999999954e254 < x < -3.19999999999999999e99Initial program 86.6%
Taylor expanded in y around inf
Applied rewrites65.0%
Taylor expanded in x around inf
Applied rewrites55.8%
Applied rewrites62.2%
if -3.19999999999999999e99 < x < 3.3999999999999998e71Initial program 73.5%
Taylor expanded in b around inf
Applied rewrites39.3%
if 3.3999999999999998e71 < x Initial program 73.8%
Taylor expanded in y around inf
Applied rewrites55.1%
Taylor expanded in x around inf
Applied rewrites51.0%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= y -2.05e-24) (not (<= y 1.7e-36))) (* (fma (- i) j (* z x)) y) (* (fma j a (* (- b) z)) c)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((y <= -2.05e-24) || !(y <= 1.7e-36)) {
tmp = fma(-i, j, (z * x)) * y;
} else {
tmp = fma(j, a, (-b * z)) * c;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((y <= -2.05e-24) || !(y <= 1.7e-36)) tmp = Float64(fma(Float64(-i), j, Float64(z * x)) * y); else tmp = Float64(fma(j, a, Float64(Float64(-b) * z)) * c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[y, -2.05e-24], N[Not[LessEqual[y, 1.7e-36]], $MachinePrecision]], N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[(j * a + N[((-b) * z), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{-24} \lor \neg \left(y \leq 1.7 \cdot 10^{-36}\right):\\
\;\;\;\;\mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(j, a, \left(-b\right) \cdot z\right) \cdot c\\
\end{array}
\end{array}
if y < -2.05000000000000007e-24 or 1.7000000000000001e-36 < y Initial program 73.4%
Taylor expanded in y around inf
Applied rewrites61.9%
if -2.05000000000000007e-24 < y < 1.7000000000000001e-36Initial program 79.2%
Taylor expanded in c around inf
Applied rewrites56.5%
Final simplification59.5%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= x -4.9e+89) (not (<= x 35000000000000.0))) (* (fma (- a) t (* z y)) x) (* (fma j a (* (- b) z)) c)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((x <= -4.9e+89) || !(x <= 35000000000000.0)) {
tmp = fma(-a, t, (z * y)) * x;
} else {
tmp = fma(j, a, (-b * z)) * c;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((x <= -4.9e+89) || !(x <= 35000000000000.0)) tmp = Float64(fma(Float64(-a), t, Float64(z * y)) * x); else tmp = Float64(fma(j, a, Float64(Float64(-b) * z)) * c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[x, -4.9e+89], N[Not[LessEqual[x, 35000000000000.0]], $MachinePrecision]], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(j * a + N[((-b) * z), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.9 \cdot 10^{+89} \lor \neg \left(x \leq 35000000000000\right):\\
\;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(j, a, \left(-b\right) \cdot z\right) \cdot c\\
\end{array}
\end{array}
if x < -4.89999999999999996e89 or 3.5e13 < x Initial program 81.2%
Taylor expanded in x around inf
Applied rewrites74.9%
if -4.89999999999999996e89 < x < 3.5e13Initial program 72.2%
Taylor expanded in c around inf
Applied rewrites45.8%
Final simplification58.0%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= x -1.35e+42) (not (<= x 1.35e-5))) (* (fma y x (* (- b) c)) z) (* (fma j a (* (- b) z)) c)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((x <= -1.35e+42) || !(x <= 1.35e-5)) {
tmp = fma(y, x, (-b * c)) * z;
} else {
tmp = fma(j, a, (-b * z)) * c;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((x <= -1.35e+42) || !(x <= 1.35e-5)) tmp = Float64(fma(y, x, Float64(Float64(-b) * c)) * z); else tmp = Float64(fma(j, a, Float64(Float64(-b) * z)) * c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[x, -1.35e+42], N[Not[LessEqual[x, 1.35e-5]], $MachinePrecision]], N[(N[(y * x + N[((-b) * c), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[(j * a + N[((-b) * z), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+42} \lor \neg \left(x \leq 1.35 \cdot 10^{-5}\right):\\
\;\;\;\;\mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(j, a, \left(-b\right) \cdot z\right) \cdot c\\
\end{array}
\end{array}
if x < -1.35e42 or 1.3499999999999999e-5 < x Initial program 78.3%
Taylor expanded in z around inf
Applied rewrites59.7%
if -1.35e42 < x < 1.3499999999999999e-5Initial program 74.0%
Taylor expanded in c around inf
Applied rewrites45.6%
Final simplification52.2%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= x -7.2e+254)
(* (- a) (* t x))
(if (<= x -3.7e+82)
(* (* y x) z)
(if (<= x 1.95e-84) (* (* i t) b) (* (* z y) x)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (x <= -7.2e+254) {
tmp = -a * (t * x);
} else if (x <= -3.7e+82) {
tmp = (y * x) * z;
} else if (x <= 1.95e-84) {
tmp = (i * t) * b;
} else {
tmp = (z * y) * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, 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 (x <= (-7.2d+254)) then
tmp = -a * (t * x)
else if (x <= (-3.7d+82)) then
tmp = (y * x) * z
else if (x <= 1.95d-84) then
tmp = (i * t) * b
else
tmp = (z * y) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (x <= -7.2e+254) {
tmp = -a * (t * x);
} else if (x <= -3.7e+82) {
tmp = (y * x) * z;
} else if (x <= 1.95e-84) {
tmp = (i * t) * b;
} else {
tmp = (z * y) * x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if x <= -7.2e+254: tmp = -a * (t * x) elif x <= -3.7e+82: tmp = (y * x) * z elif x <= 1.95e-84: tmp = (i * t) * b else: tmp = (z * y) * x return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -7.2e+254) tmp = Float64(Float64(-a) * Float64(t * x)); elseif (x <= -3.7e+82) tmp = Float64(Float64(y * x) * z); elseif (x <= 1.95e-84) tmp = Float64(Float64(i * t) * b); else tmp = Float64(Float64(z * y) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (x <= -7.2e+254) tmp = -a * (t * x); elseif (x <= -3.7e+82) tmp = (y * x) * z; elseif (x <= 1.95e-84) tmp = (i * t) * b; else tmp = (z * y) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -7.2e+254], N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.7e+82], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[x, 1.95e-84], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+254}:\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right)\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{+82}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{-84}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\end{array}
\end{array}
if x < -7.19999999999999954e254Initial program 87.4%
Taylor expanded in t around -inf
Applied rewrites63.3%
Taylor expanded in x around inf
Applied rewrites66.3%
if -7.19999999999999954e254 < x < -3.7000000000000002e82Initial program 76.6%
Taylor expanded in y around inf
Applied rewrites63.4%
Taylor expanded in x around inf
Applied rewrites52.4%
Applied rewrites58.0%
if -3.7000000000000002e82 < x < 1.95000000000000011e-84Initial program 74.5%
Taylor expanded in b around inf
Applied rewrites40.2%
Taylor expanded in z around 0
Applied rewrites29.7%
if 1.95000000000000011e-84 < x Initial program 75.7%
Taylor expanded in y around inf
Applied rewrites48.1%
Taylor expanded in x around inf
Applied rewrites38.7%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= x -1.48e+82) (* (* z x) y) (if (<= x 1.95e-84) (* (* i t) b) (* (* z y) x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (x <= -1.48e+82) {
tmp = (z * x) * y;
} else if (x <= 1.95e-84) {
tmp = (i * t) * b;
} else {
tmp = (z * y) * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, 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 (x <= (-1.48d+82)) then
tmp = (z * x) * y
else if (x <= 1.95d-84) then
tmp = (i * t) * b
else
tmp = (z * y) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (x <= -1.48e+82) {
tmp = (z * x) * y;
} else if (x <= 1.95e-84) {
tmp = (i * t) * b;
} else {
tmp = (z * y) * x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if x <= -1.48e+82: tmp = (z * x) * y elif x <= 1.95e-84: tmp = (i * t) * b else: tmp = (z * y) * x return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -1.48e+82) tmp = Float64(Float64(z * x) * y); elseif (x <= 1.95e-84) tmp = Float64(Float64(i * t) * b); else tmp = Float64(Float64(z * y) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (x <= -1.48e+82) tmp = (z * x) * y; elseif (x <= 1.95e-84) tmp = (i * t) * b; else tmp = (z * y) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -1.48e+82], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[x, 1.95e-84], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.48 \cdot 10^{+82}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{-84}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\end{array}
\end{array}
if x < -1.48e82Initial program 80.1%
Taylor expanded in y around inf
Applied rewrites59.4%
Taylor expanded in x around inf
Applied rewrites50.0%
if -1.48e82 < x < 1.95000000000000011e-84Initial program 74.5%
Taylor expanded in b around inf
Applied rewrites40.2%
Taylor expanded in z around 0
Applied rewrites29.7%
if 1.95000000000000011e-84 < x Initial program 75.7%
Taylor expanded in y around inf
Applied rewrites48.1%
Taylor expanded in x around inf
Applied rewrites38.7%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= x -3.7e+82) (* (* y x) z) (if (<= x 1.95e-84) (* (* i t) b) (* (* z y) x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (x <= -3.7e+82) {
tmp = (y * x) * z;
} else if (x <= 1.95e-84) {
tmp = (i * t) * b;
} else {
tmp = (z * y) * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, 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 (x <= (-3.7d+82)) then
tmp = (y * x) * z
else if (x <= 1.95d-84) then
tmp = (i * t) * b
else
tmp = (z * y) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (x <= -3.7e+82) {
tmp = (y * x) * z;
} else if (x <= 1.95e-84) {
tmp = (i * t) * b;
} else {
tmp = (z * y) * x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if x <= -3.7e+82: tmp = (y * x) * z elif x <= 1.95e-84: tmp = (i * t) * b else: tmp = (z * y) * x return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -3.7e+82) tmp = Float64(Float64(y * x) * z); elseif (x <= 1.95e-84) tmp = Float64(Float64(i * t) * b); else tmp = Float64(Float64(z * y) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (x <= -3.7e+82) tmp = (y * x) * z; elseif (x <= 1.95e-84) tmp = (i * t) * b; else tmp = (z * y) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -3.7e+82], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[x, 1.95e-84], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{+82}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{-84}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\end{array}
\end{array}
if x < -3.7000000000000002e82Initial program 80.1%
Taylor expanded in y around inf
Applied rewrites59.4%
Taylor expanded in x around inf
Applied rewrites44.2%
Applied rewrites48.0%
if -3.7000000000000002e82 < x < 1.95000000000000011e-84Initial program 74.5%
Taylor expanded in b around inf
Applied rewrites40.2%
Taylor expanded in z around 0
Applied rewrites29.7%
if 1.95000000000000011e-84 < x Initial program 75.7%
Taylor expanded in y around inf
Applied rewrites48.1%
Taylor expanded in x around inf
Applied rewrites38.7%
(FPCore (x y z t a b c i j) :precision binary64 (* (* y x) z))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return (y * x) * z;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, 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 = (y * x) * z
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 (y * x) * z;
}
def code(x, y, z, t, a, b, c, i, j): return (y * x) * z
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(y * x) * z) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = (y * x) * z; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision]
\begin{array}{l}
\\
\left(y \cdot x\right) \cdot z
\end{array}
Initial program 76.0%
Taylor expanded in y around inf
Applied rewrites43.5%
Taylor expanded in x around inf
Applied rewrites25.0%
Applied rewrites25.4%
(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 2025026
(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)))))