
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))
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) - (i * a)))) + (j * ((c * t) - (i * y)));
}
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) - (i * a)))) + (j * ((c * t) - (i * y)))
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) - (i * a)))) + (j * ((c * t) - (i * y)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)))
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(i * a)))) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y))); 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[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 30 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))
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) - (i * a)))) + (j * ((c * t) - (i * y)));
}
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) - (i * a)))) + (j * ((c * t) - (i * y)))
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) - (i * a)))) + (j * ((c * t) - (i * y)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)))
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(i * a)))) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y))); 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[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\end{array}
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= z -2.3e+145)
(* (fma (- b) c (* y x)) z)
(if (or (<= z -1.2e-17) (not (<= z 8e+116)))
(*
(-
(fma
y
x
(/ (fma (fma (- x) t (* i b)) a (* (fma (- i) y (* c t)) j)) z))
(* c b))
z)
(fma
(fma (- c) z (* i a))
b
(fma (fma (- a) x (* j c)) t (* (fma (- j) i (* 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 (z <= -2.3e+145) {
tmp = fma(-b, c, (y * x)) * z;
} else if ((z <= -1.2e-17) || !(z <= 8e+116)) {
tmp = (fma(y, x, (fma(fma(-x, t, (i * b)), a, (fma(-i, y, (c * t)) * j)) / z)) - (c * b)) * z;
} else {
tmp = fma(fma(-c, z, (i * a)), b, fma(fma(-a, x, (j * c)), t, (fma(-j, i, (z * x)) * y)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (z <= -2.3e+145) tmp = Float64(fma(Float64(-b), c, Float64(y * x)) * z); elseif ((z <= -1.2e-17) || !(z <= 8e+116)) tmp = Float64(Float64(fma(y, x, Float64(fma(fma(Float64(-x), t, Float64(i * b)), a, Float64(fma(Float64(-i), y, Float64(c * t)) * j)) / z)) - Float64(c * b)) * z); else tmp = fma(fma(Float64(-c), z, Float64(i * a)), b, fma(fma(Float64(-a), x, Float64(j * c)), t, Float64(fma(Float64(-j), i, Float64(z * x)) * y))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[z, -2.3e+145], N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[Or[LessEqual[z, -1.2e-17], N[Not[LessEqual[z, 8e+116]], $MachinePrecision]], N[(N[(N[(y * x + N[(N[(N[((-x) * t + N[(i * b), $MachinePrecision]), $MachinePrecision] * a + N[(N[((-i) * y + N[(c * t), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] - N[(c * b), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[((-c) * z + N[(i * a), $MachinePrecision]), $MachinePrecision] * b + N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t + N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+145}:\\
\;\;\;\;\mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-17} \lor \neg \left(z \leq 8 \cdot 10^{+116}\right):\\
\;\;\;\;\left(\mathsf{fma}\left(y, x, \frac{\mathsf{fma}\left(\mathsf{fma}\left(-x, t, i \cdot b\right), a, \mathsf{fma}\left(-i, y, c \cdot t\right) \cdot j\right)}{z}\right) - c \cdot b\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-c, z, i \cdot a\right), b, \mathsf{fma}\left(\mathsf{fma}\left(-a, x, j \cdot c\right), t, \mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\right)\right)\\
\end{array}
\end{array}
if z < -2.3e145Initial program 61.2%
Taylor expanded in z around inf
Applied rewrites87.4%
if -2.3e145 < z < -1.19999999999999993e-17 or 8.00000000000000012e116 < z Initial program 75.5%
Taylor expanded in z around inf
Applied rewrites87.7%
if -1.19999999999999993e-17 < z < 8.00000000000000012e116Initial program 74.8%
Taylor expanded in y around 0
Applied rewrites90.7%
Final simplification89.6%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= z -2.5e+119)
(* (fma (- b) c (* y x)) z)
(if (<= z -1.2e-17)
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a))))
(* j (- (* c t) (* i y))))
(fma
(fma (- c) z (* i a))
b
(fma (fma (- a) x (* j c)) t (* (fma (- j) i (* 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 (z <= -2.5e+119) {
tmp = fma(-b, c, (y * x)) * z;
} else if (z <= -1.2e-17) {
tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)));
} else {
tmp = fma(fma(-c, z, (i * a)), b, fma(fma(-a, x, (j * c)), t, (fma(-j, i, (z * x)) * y)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (z <= -2.5e+119) tmp = Float64(fma(Float64(-b), c, Float64(y * x)) * z); elseif (z <= -1.2e-17) tmp = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(i * a)))) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))); else tmp = fma(fma(Float64(-c), z, Float64(i * a)), b, fma(fma(Float64(-a), x, Float64(j * c)), t, Float64(fma(Float64(-j), i, Float64(z * x)) * y))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[z, -2.5e+119], N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, -1.2e-17], N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-c) * z + N[(i * a), $MachinePrecision]), $MachinePrecision] * b + N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t + N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+119}:\\
\;\;\;\;\mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-17}:\\
\;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-c, z, i \cdot a\right), b, \mathsf{fma}\left(\mathsf{fma}\left(-a, x, j \cdot c\right), t, \mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\right)\right)\\
\end{array}
\end{array}
if z < -2.5e119Initial program 60.2%
Taylor expanded in z around inf
Applied rewrites80.9%
if -2.5e119 < z < -1.19999999999999993e-17Initial program 91.2%
if -1.19999999999999993e-17 < z Initial program 74.0%
Taylor expanded in y around 0
Applied rewrites87.3%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= z -9.6e+142)
(* (fma (- b) c (* y x)) z)
(fma
(fma (- c) z (* i a))
b
(fma (fma (- a) x (* j c)) t (* (fma (- j) i (* 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 (z <= -9.6e+142) {
tmp = fma(-b, c, (y * x)) * z;
} else {
tmp = fma(fma(-c, z, (i * a)), b, fma(fma(-a, x, (j * c)), t, (fma(-j, i, (z * x)) * y)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (z <= -9.6e+142) tmp = Float64(fma(Float64(-b), c, Float64(y * x)) * z); else tmp = fma(fma(Float64(-c), z, Float64(i * a)), b, fma(fma(Float64(-a), x, Float64(j * c)), t, Float64(fma(Float64(-j), i, Float64(z * x)) * y))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[z, -9.6e+142], N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[((-c) * z + N[(i * a), $MachinePrecision]), $MachinePrecision] * b + N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t + N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.6 \cdot 10^{+142}:\\
\;\;\;\;\mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-c, z, i \cdot a\right), b, \mathsf{fma}\left(\mathsf{fma}\left(-a, x, j \cdot c\right), t, \mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\right)\right)\\
\end{array}
\end{array}
if z < -9.5999999999999996e142Initial program 61.2%
Taylor expanded in z around inf
Applied rewrites87.4%
if -9.5999999999999996e142 < z Initial program 75.0%
Taylor expanded in y around 0
Applied rewrites84.6%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- b) c (* y x)) z)))
(if (<= z -2.35e+132)
t_1
(if (<= z -9.5e-100)
(* (fma (- x) t (* i b)) a)
(if (<= z -5.7e-142)
(* (* (fma (- i) (/ j z) x) y) z)
(if (<= z 7.2e-186)
(* (- t) (fma (- c) j (* a x)))
(if (<= z 2.15e-79)
(* (* (- j (/ (* b a) y)) (- i)) y)
(if (<= z 9600000000.0)
(fma (* (- a) t) x (* (* z y) x))
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 <= -2.35e+132) {
tmp = t_1;
} else if (z <= -9.5e-100) {
tmp = fma(-x, t, (i * b)) * a;
} else if (z <= -5.7e-142) {
tmp = (fma(-i, (j / z), x) * y) * z;
} else if (z <= 7.2e-186) {
tmp = -t * fma(-c, j, (a * x));
} else if (z <= 2.15e-79) {
tmp = ((j - ((b * a) / y)) * -i) * y;
} else if (z <= 9600000000.0) {
tmp = fma((-a * t), x, ((z * y) * x));
} 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 <= -2.35e+132) tmp = t_1; elseif (z <= -9.5e-100) tmp = Float64(fma(Float64(-x), t, Float64(i * b)) * a); elseif (z <= -5.7e-142) tmp = Float64(Float64(fma(Float64(-i), Float64(j / z), x) * y) * z); elseif (z <= 7.2e-186) tmp = Float64(Float64(-t) * fma(Float64(-c), j, Float64(a * x))); elseif (z <= 2.15e-79) tmp = Float64(Float64(Float64(j - Float64(Float64(b * a) / y)) * Float64(-i)) * y); elseif (z <= 9600000000.0) tmp = fma(Float64(Float64(-a) * t), x, Float64(Float64(z * y) * x)); 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, -2.35e+132], t$95$1, If[LessEqual[z, -9.5e-100], N[(N[((-x) * t + N[(i * b), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[z, -5.7e-142], N[(N[(N[((-i) * N[(j / z), $MachinePrecision] + x), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 7.2e-186], N[((-t) * N[((-c) * j + N[(a * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.15e-79], N[(N[(N[(j - N[(N[(b * a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] * (-i)), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 9600000000.0], N[(N[((-a) * t), $MachinePrecision] * x + N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]), $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 -2.35 \cdot 10^{+132}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -9.5 \cdot 10^{-100}:\\
\;\;\;\;\mathsf{fma}\left(-x, t, i \cdot b\right) \cdot a\\
\mathbf{elif}\;z \leq -5.7 \cdot 10^{-142}:\\
\;\;\;\;\left(\mathsf{fma}\left(-i, \frac{j}{z}, x\right) \cdot y\right) \cdot z\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-186}:\\
\;\;\;\;\left(-t\right) \cdot \mathsf{fma}\left(-c, j, a \cdot x\right)\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{-79}:\\
\;\;\;\;\left(\left(j - \frac{b \cdot a}{y}\right) \cdot \left(-i\right)\right) \cdot y\\
\mathbf{elif}\;z \leq 9600000000:\\
\;\;\;\;\mathsf{fma}\left(\left(-a\right) \cdot t, x, \left(z \cdot y\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.35e132 or 9.6e9 < z Initial program 68.4%
Taylor expanded in z around inf
Applied rewrites71.0%
if -2.35e132 < z < -9.4999999999999992e-100Initial program 80.9%
Taylor expanded in a around inf
Applied rewrites62.3%
if -9.4999999999999992e-100 < z < -5.69999999999999995e-142Initial program 91.6%
Taylor expanded in z around inf
Applied rewrites65.8%
Taylor expanded in y around inf
Applied rewrites73.1%
if -5.69999999999999995e-142 < z < 7.1999999999999997e-186Initial program 72.5%
Taylor expanded in y around 0
Applied rewrites92.9%
Taylor expanded in t around -inf
Applied rewrites63.0%
if 7.1999999999999997e-186 < z < 2.14999999999999991e-79Initial program 68.8%
Taylor expanded in y around 0
Applied rewrites80.1%
Taylor expanded in y around inf
Applied rewrites63.5%
Taylor expanded in i around -inf
Applied rewrites67.9%
if 2.14999999999999991e-79 < z < 9.6e9Initial program 78.5%
Taylor expanded in x around inf
Applied rewrites61.6%
Applied rewrites61.6%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- b) c (* y x)) z)))
(if (<= z -2.35e+132)
t_1
(if (<= z -9.5e-100)
(* (fma (- x) t (* i b)) a)
(if (<= z -5.7e-142)
(* (* (fma (- i) (/ j z) x) y) z)
(if (<= z 3.35e-186)
(* (- t) (fma (- c) j (* a x)))
(if (<= z 2.15e-79)
(* (fma (- y) j (* b a)) i)
(if (<= z 9600000000.0)
(fma (* (- a) t) x (* (* z y) x))
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 <= -2.35e+132) {
tmp = t_1;
} else if (z <= -9.5e-100) {
tmp = fma(-x, t, (i * b)) * a;
} else if (z <= -5.7e-142) {
tmp = (fma(-i, (j / z), x) * y) * z;
} else if (z <= 3.35e-186) {
tmp = -t * fma(-c, j, (a * x));
} else if (z <= 2.15e-79) {
tmp = fma(-y, j, (b * a)) * i;
} else if (z <= 9600000000.0) {
tmp = fma((-a * t), x, ((z * y) * x));
} 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 <= -2.35e+132) tmp = t_1; elseif (z <= -9.5e-100) tmp = Float64(fma(Float64(-x), t, Float64(i * b)) * a); elseif (z <= -5.7e-142) tmp = Float64(Float64(fma(Float64(-i), Float64(j / z), x) * y) * z); elseif (z <= 3.35e-186) tmp = Float64(Float64(-t) * fma(Float64(-c), j, Float64(a * x))); elseif (z <= 2.15e-79) tmp = Float64(fma(Float64(-y), j, Float64(b * a)) * i); elseif (z <= 9600000000.0) tmp = fma(Float64(Float64(-a) * t), x, Float64(Float64(z * y) * x)); 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, -2.35e+132], t$95$1, If[LessEqual[z, -9.5e-100], N[(N[((-x) * t + N[(i * b), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[z, -5.7e-142], N[(N[(N[((-i) * N[(j / z), $MachinePrecision] + x), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 3.35e-186], N[((-t) * N[((-c) * j + N[(a * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.15e-79], N[(N[((-y) * j + N[(b * a), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[z, 9600000000.0], N[(N[((-a) * t), $MachinePrecision] * x + N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]), $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 -2.35 \cdot 10^{+132}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -9.5 \cdot 10^{-100}:\\
\;\;\;\;\mathsf{fma}\left(-x, t, i \cdot b\right) \cdot a\\
\mathbf{elif}\;z \leq -5.7 \cdot 10^{-142}:\\
\;\;\;\;\left(\mathsf{fma}\left(-i, \frac{j}{z}, x\right) \cdot y\right) \cdot z\\
\mathbf{elif}\;z \leq 3.35 \cdot 10^{-186}:\\
\;\;\;\;\left(-t\right) \cdot \mathsf{fma}\left(-c, j, a \cdot x\right)\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{-79}:\\
\;\;\;\;\mathsf{fma}\left(-y, j, b \cdot a\right) \cdot i\\
\mathbf{elif}\;z \leq 9600000000:\\
\;\;\;\;\mathsf{fma}\left(\left(-a\right) \cdot t, x, \left(z \cdot y\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.35e132 or 9.6e9 < z Initial program 68.4%
Taylor expanded in z around inf
Applied rewrites71.0%
if -2.35e132 < z < -9.4999999999999992e-100Initial program 80.9%
Taylor expanded in a around inf
Applied rewrites62.3%
if -9.4999999999999992e-100 < z < -5.69999999999999995e-142Initial program 91.6%
Taylor expanded in z around inf
Applied rewrites65.8%
Taylor expanded in y around inf
Applied rewrites73.1%
if -5.69999999999999995e-142 < z < 3.35000000000000017e-186Initial program 72.5%
Taylor expanded in y around 0
Applied rewrites92.9%
Taylor expanded in t around -inf
Applied rewrites63.0%
if 3.35000000000000017e-186 < z < 2.14999999999999991e-79Initial program 68.8%
Taylor expanded in i around inf
Applied rewrites65.0%
if 2.14999999999999991e-79 < z < 9.6e9Initial program 78.5%
Taylor expanded in x around inf
Applied rewrites61.6%
Applied rewrites61.6%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- a) t (* z y)) x)) (t_2 (* (fma (- b) c (* y x)) z)))
(if (<= z -2.35e+132)
t_2
(if (<= z -2.8e-85)
(* (fma (- x) t (* i b)) a)
(if (<= z -7.5e-137)
t_1
(if (<= z 3.35e-186)
(* (fma (- a) x (* j c)) t)
(if (<= z 2.15e-79)
(* (fma (- y) j (* b a)) i)
(if (<= z 9600000000.0) 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(-a, t, (z * y)) * x;
double t_2 = fma(-b, c, (y * x)) * z;
double tmp;
if (z <= -2.35e+132) {
tmp = t_2;
} else if (z <= -2.8e-85) {
tmp = fma(-x, t, (i * b)) * a;
} else if (z <= -7.5e-137) {
tmp = t_1;
} else if (z <= 3.35e-186) {
tmp = fma(-a, x, (j * c)) * t;
} else if (z <= 2.15e-79) {
tmp = fma(-y, j, (b * a)) * i;
} else if (z <= 9600000000.0) {
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(-a), t, Float64(z * y)) * x) t_2 = Float64(fma(Float64(-b), c, Float64(y * x)) * z) tmp = 0.0 if (z <= -2.35e+132) tmp = t_2; elseif (z <= -2.8e-85) tmp = Float64(fma(Float64(-x), t, Float64(i * b)) * a); elseif (z <= -7.5e-137) tmp = t_1; elseif (z <= 3.35e-186) tmp = Float64(fma(Float64(-a), x, Float64(j * c)) * t); elseif (z <= 2.15e-79) tmp = Float64(fma(Float64(-y), j, Float64(b * a)) * i); elseif (z <= 9600000000.0) 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[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -2.35e+132], t$95$2, If[LessEqual[z, -2.8e-85], N[(N[((-x) * t + N[(i * b), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[z, -7.5e-137], t$95$1, If[LessEqual[z, 3.35e-186], N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 2.15e-79], N[(N[((-y) * j + N[(b * a), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[z, 9600000000.0], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\
t_2 := \mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{if}\;z \leq -2.35 \cdot 10^{+132}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-85}:\\
\;\;\;\;\mathsf{fma}\left(-x, t, i \cdot b\right) \cdot a\\
\mathbf{elif}\;z \leq -7.5 \cdot 10^{-137}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.35 \cdot 10^{-186}:\\
\;\;\;\;\mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{-79}:\\
\;\;\;\;\mathsf{fma}\left(-y, j, b \cdot a\right) \cdot i\\
\mathbf{elif}\;z \leq 9600000000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -2.35e132 or 9.6e9 < z Initial program 68.4%
Taylor expanded in z around inf
Applied rewrites71.0%
if -2.35e132 < z < -2.80000000000000017e-85Initial program 79.0%
Taylor expanded in a around inf
Applied rewrites64.3%
if -2.80000000000000017e-85 < z < -7.4999999999999995e-137 or 2.14999999999999991e-79 < z < 9.6e9Initial program 86.1%
Taylor expanded in x around inf
Applied rewrites63.6%
if -7.4999999999999995e-137 < z < 3.35000000000000017e-186Initial program 72.0%
Taylor expanded in t around inf
Applied rewrites61.1%
if 3.35000000000000017e-186 < z < 2.14999999999999991e-79Initial program 68.8%
Taylor expanded in i around inf
Applied rewrites65.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* j (- (* c t) (* i y)))))
(if (<= c -1.56e+29)
(+ (* (- a) (* t x)) t_1)
(if (<= c 1.85e-12)
(fma (fma (- a) t (* z y)) x (* (fma (- y) j (* b a)) i))
(if (<= c 1.5e+146)
(+ (* (* (- c) z) b) t_1)
(* (fma (- z) b (* j t)) c))))))
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 * t) - (i * y));
double tmp;
if (c <= -1.56e+29) {
tmp = (-a * (t * x)) + t_1;
} else if (c <= 1.85e-12) {
tmp = fma(fma(-a, t, (z * y)), x, (fma(-y, j, (b * a)) * i));
} else if (c <= 1.5e+146) {
tmp = ((-c * z) * b) + t_1;
} else {
tmp = fma(-z, b, (j * t)) * c;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(j * Float64(Float64(c * t) - Float64(i * y))) tmp = 0.0 if (c <= -1.56e+29) tmp = Float64(Float64(Float64(-a) * Float64(t * x)) + t_1); elseif (c <= 1.85e-12) tmp = fma(fma(Float64(-a), t, Float64(z * y)), x, Float64(fma(Float64(-y), j, Float64(b * a)) * i)); elseif (c <= 1.5e+146) tmp = Float64(Float64(Float64(Float64(-c) * z) * b) + t_1); else tmp = Float64(fma(Float64(-z), b, Float64(j * t)) * c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -1.56e+29], N[(N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[c, 1.85e-12], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[(N[((-y) * j + N[(b * a), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.5e+146], N[(N[(N[((-c) * z), $MachinePrecision] * b), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[((-z) * b + N[(j * t), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := j \cdot \left(c \cdot t - i \cdot y\right)\\
\mathbf{if}\;c \leq -1.56 \cdot 10^{+29}:\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right) + t\_1\\
\mathbf{elif}\;c \leq 1.85 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-a, t, z \cdot y\right), x, \mathsf{fma}\left(-y, j, b \cdot a\right) \cdot i\right)\\
\mathbf{elif}\;c \leq 1.5 \cdot 10^{+146}:\\
\;\;\;\;\left(\left(-c\right) \cdot z\right) \cdot b + t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, b, j \cdot t\right) \cdot c\\
\end{array}
\end{array}
if c < -1.5599999999999999e29Initial program 69.9%
Taylor expanded in t around inf
Applied rewrites62.1%
if -1.5599999999999999e29 < c < 1.84999999999999999e-12Initial program 80.9%
Taylor expanded in c around 0
Applied rewrites76.2%
if 1.84999999999999999e-12 < c < 1.50000000000000001e146Initial program 75.8%
Taylor expanded in c around inf
Applied rewrites70.0%
if 1.50000000000000001e146 < c Initial program 51.1%
Taylor expanded in c around inf
Applied rewrites78.8%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= t -4e+62)
(* (fma (- a) x (* j c)) t)
(if (<= t -1.75e-41)
(* (fma (- x) t (* i b)) a)
(if (<= t -3e-104)
(* (fma (- z) b (* j t)) c)
(if (<= t 7.2e-280)
(* (fma z x (* (- j) i)) y)
(if (<= t 1.08e-94)
(* (fma (- c) z (* i a)) b)
(* (- t) (fma (- c) j (* a x)))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (t <= -4e+62) {
tmp = fma(-a, x, (j * c)) * t;
} else if (t <= -1.75e-41) {
tmp = fma(-x, t, (i * b)) * a;
} else if (t <= -3e-104) {
tmp = fma(-z, b, (j * t)) * c;
} else if (t <= 7.2e-280) {
tmp = fma(z, x, (-j * i)) * y;
} else if (t <= 1.08e-94) {
tmp = fma(-c, z, (i * a)) * b;
} else {
tmp = -t * fma(-c, j, (a * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (t <= -4e+62) tmp = Float64(fma(Float64(-a), x, Float64(j * c)) * t); elseif (t <= -1.75e-41) tmp = Float64(fma(Float64(-x), t, Float64(i * b)) * a); elseif (t <= -3e-104) tmp = Float64(fma(Float64(-z), b, Float64(j * t)) * c); elseif (t <= 7.2e-280) tmp = Float64(fma(z, x, Float64(Float64(-j) * i)) * y); elseif (t <= 1.08e-94) tmp = Float64(fma(Float64(-c), z, Float64(i * a)) * b); else tmp = Float64(Float64(-t) * fma(Float64(-c), j, Float64(a * x))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[t, -4e+62], N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t, -1.75e-41], N[(N[((-x) * t + N[(i * b), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[t, -3e-104], N[(N[((-z) * b + N[(j * t), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[t, 7.2e-280], N[(N[(z * x + N[((-j) * i), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t, 1.08e-94], N[(N[((-c) * z + N[(i * a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], N[((-t) * N[((-c) * j + N[(a * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+62}:\\
\;\;\;\;\mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\\
\mathbf{elif}\;t \leq -1.75 \cdot 10^{-41}:\\
\;\;\;\;\mathsf{fma}\left(-x, t, i \cdot b\right) \cdot a\\
\mathbf{elif}\;t \leq -3 \cdot 10^{-104}:\\
\;\;\;\;\mathsf{fma}\left(-z, b, j \cdot t\right) \cdot c\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{-280}:\\
\;\;\;\;\mathsf{fma}\left(z, x, \left(-j\right) \cdot i\right) \cdot y\\
\mathbf{elif}\;t \leq 1.08 \cdot 10^{-94}:\\
\;\;\;\;\mathsf{fma}\left(-c, z, i \cdot a\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) \cdot \mathsf{fma}\left(-c, j, a \cdot x\right)\\
\end{array}
\end{array}
if t < -4.00000000000000014e62Initial program 62.2%
Taylor expanded in t around inf
Applied rewrites62.5%
if -4.00000000000000014e62 < t < -1.75e-41Initial program 68.3%
Taylor expanded in a around inf
Applied rewrites68.5%
if -1.75e-41 < t < -3.0000000000000002e-104Initial program 67.2%
Taylor expanded in c around inf
Applied rewrites75.1%
if -3.0000000000000002e-104 < t < 7.19999999999999989e-280Initial program 79.5%
Taylor expanded in y around inf
Applied rewrites65.6%
Applied rewrites67.7%
if 7.19999999999999989e-280 < t < 1.08e-94Initial program 85.7%
Taylor expanded in b around inf
Applied rewrites62.2%
if 1.08e-94 < t Initial program 73.1%
Taylor expanded in y around 0
Applied rewrites87.5%
Taylor expanded in t around -inf
Applied rewrites62.3%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* (- t) a) x)))
(if (<= z -1.8e+143)
(* (* z x) y)
(if (<= z -2.6e+110)
(* b (* (- c) z))
(if (<= z -3.2e-243)
t_1
(if (<= z 3.7e-171)
(* (* j t) c)
(if (<= z 1.5e-62)
(* (* (- i) y) j)
(if (<= z 9600000000.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 = (-t * a) * x;
double tmp;
if (z <= -1.8e+143) {
tmp = (z * x) * y;
} else if (z <= -2.6e+110) {
tmp = b * (-c * z);
} else if (z <= -3.2e-243) {
tmp = t_1;
} else if (z <= 3.7e-171) {
tmp = (j * t) * c;
} else if (z <= 1.5e-62) {
tmp = (-i * y) * j;
} else if (z <= 9600000000.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 = (-t * a) * x
if (z <= (-1.8d+143)) then
tmp = (z * x) * y
else if (z <= (-2.6d+110)) then
tmp = b * (-c * z)
else if (z <= (-3.2d-243)) then
tmp = t_1
else if (z <= 3.7d-171) then
tmp = (j * t) * c
else if (z <= 1.5d-62) then
tmp = (-i * y) * j
else if (z <= 9600000000.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 = (-t * a) * x;
double tmp;
if (z <= -1.8e+143) {
tmp = (z * x) * y;
} else if (z <= -2.6e+110) {
tmp = b * (-c * z);
} else if (z <= -3.2e-243) {
tmp = t_1;
} else if (z <= 3.7e-171) {
tmp = (j * t) * c;
} else if (z <= 1.5e-62) {
tmp = (-i * y) * j;
} else if (z <= 9600000000.0) {
tmp = t_1;
} else {
tmp = (-z * b) * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (-t * a) * x tmp = 0 if z <= -1.8e+143: tmp = (z * x) * y elif z <= -2.6e+110: tmp = b * (-c * z) elif z <= -3.2e-243: tmp = t_1 elif z <= 3.7e-171: tmp = (j * t) * c elif z <= 1.5e-62: tmp = (-i * y) * j elif z <= 9600000000.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(Float64(-t) * a) * x) tmp = 0.0 if (z <= -1.8e+143) tmp = Float64(Float64(z * x) * y); elseif (z <= -2.6e+110) tmp = Float64(b * Float64(Float64(-c) * z)); elseif (z <= -3.2e-243) tmp = t_1; elseif (z <= 3.7e-171) tmp = Float64(Float64(j * t) * c); elseif (z <= 1.5e-62) tmp = Float64(Float64(Float64(-i) * y) * j); elseif (z <= 9600000000.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 = (-t * a) * x; tmp = 0.0; if (z <= -1.8e+143) tmp = (z * x) * y; elseif (z <= -2.6e+110) tmp = b * (-c * z); elseif (z <= -3.2e-243) tmp = t_1; elseif (z <= 3.7e-171) tmp = (j * t) * c; elseif (z <= 1.5e-62) tmp = (-i * y) * j; elseif (z <= 9600000000.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[(N[((-t) * a), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -1.8e+143], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, -2.6e+110], N[(b * N[((-c) * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3.2e-243], t$95$1, If[LessEqual[z, 3.7e-171], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[z, 1.5e-62], N[(N[((-i) * y), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[z, 9600000000.0], t$95$1, N[(N[((-z) * b), $MachinePrecision] * c), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(-t\right) \cdot a\right) \cdot x\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{+143}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{+110}:\\
\;\;\;\;b \cdot \left(\left(-c\right) \cdot z\right)\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{-243}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-171}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-62}:\\
\;\;\;\;\left(\left(-i\right) \cdot y\right) \cdot j\\
\mathbf{elif}\;z \leq 9600000000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-z\right) \cdot b\right) \cdot c\\
\end{array}
\end{array}
if z < -1.8e143Initial program 61.2%
Taylor expanded in y around inf
Applied rewrites74.8%
Taylor expanded in x around inf
Applied rewrites71.6%
if -1.8e143 < z < -2.6e110Initial program 60.9%
Taylor expanded in c around inf
Applied rewrites61.8%
Applied rewrites51.8%
Taylor expanded in z around inf
Applied rewrites53.4%
if -2.6e110 < z < -3.1999999999999998e-243 or 1.5000000000000001e-62 < z < 9.6e9Initial program 84.0%
Taylor expanded in x around inf
Applied rewrites54.8%
Taylor expanded in y around 0
Applied rewrites42.5%
if -3.1999999999999998e-243 < z < 3.70000000000000012e-171Initial program 65.7%
Taylor expanded in c around inf
Applied rewrites43.4%
Taylor expanded in z around 0
Applied rewrites38.3%
if 3.70000000000000012e-171 < z < 1.5000000000000001e-62Initial program 71.5%
Taylor expanded in j around inf
Applied rewrites55.1%
Taylor expanded in y around inf
Applied rewrites44.8%
if 9.6e9 < z Initial program 72.0%
Taylor expanded in c around inf
Applied rewrites58.7%
Taylor expanded in z around inf
Applied rewrites47.3%
Final simplification47.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* b (* (- c) z))) (t_2 (* (* (- t) a) x)))
(if (<= z -1.8e+143)
(* (* z x) y)
(if (<= z -2.6e+110)
t_1
(if (<= z -3.2e-243)
t_2
(if (<= z 3.7e-171)
(* (* j t) c)
(if (<= z 1.5e-62)
(* (* (- i) y) j)
(if (<= z 9600000000.0) t_2 t_1))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = b * (-c * z);
double t_2 = (-t * a) * x;
double tmp;
if (z <= -1.8e+143) {
tmp = (z * x) * y;
} else if (z <= -2.6e+110) {
tmp = t_1;
} else if (z <= -3.2e-243) {
tmp = t_2;
} else if (z <= 3.7e-171) {
tmp = (j * t) * c;
} else if (z <= 1.5e-62) {
tmp = (-i * y) * j;
} else if (z <= 9600000000.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
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 = b * (-c * z)
t_2 = (-t * a) * x
if (z <= (-1.8d+143)) then
tmp = (z * x) * y
else if (z <= (-2.6d+110)) then
tmp = t_1
else if (z <= (-3.2d-243)) then
tmp = t_2
else if (z <= 3.7d-171) then
tmp = (j * t) * c
else if (z <= 1.5d-62) then
tmp = (-i * y) * j
else if (z <= 9600000000.0d0) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = b * (-c * z);
double t_2 = (-t * a) * x;
double tmp;
if (z <= -1.8e+143) {
tmp = (z * x) * y;
} else if (z <= -2.6e+110) {
tmp = t_1;
} else if (z <= -3.2e-243) {
tmp = t_2;
} else if (z <= 3.7e-171) {
tmp = (j * t) * c;
} else if (z <= 1.5e-62) {
tmp = (-i * y) * j;
} else if (z <= 9600000000.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = b * (-c * z) t_2 = (-t * a) * x tmp = 0 if z <= -1.8e+143: tmp = (z * x) * y elif z <= -2.6e+110: tmp = t_1 elif z <= -3.2e-243: tmp = t_2 elif z <= 3.7e-171: tmp = (j * t) * c elif z <= 1.5e-62: tmp = (-i * y) * j elif z <= 9600000000.0: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(b * Float64(Float64(-c) * z)) t_2 = Float64(Float64(Float64(-t) * a) * x) tmp = 0.0 if (z <= -1.8e+143) tmp = Float64(Float64(z * x) * y); elseif (z <= -2.6e+110) tmp = t_1; elseif (z <= -3.2e-243) tmp = t_2; elseif (z <= 3.7e-171) tmp = Float64(Float64(j * t) * c); elseif (z <= 1.5e-62) tmp = Float64(Float64(Float64(-i) * y) * j); elseif (z <= 9600000000.0) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = b * (-c * z); t_2 = (-t * a) * x; tmp = 0.0; if (z <= -1.8e+143) tmp = (z * x) * y; elseif (z <= -2.6e+110) tmp = t_1; elseif (z <= -3.2e-243) tmp = t_2; elseif (z <= 3.7e-171) tmp = (j * t) * c; elseif (z <= 1.5e-62) tmp = (-i * y) * j; elseif (z <= 9600000000.0) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(b * N[((-c) * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-t) * a), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -1.8e+143], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, -2.6e+110], t$95$1, If[LessEqual[z, -3.2e-243], t$95$2, If[LessEqual[z, 3.7e-171], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[z, 1.5e-62], N[(N[((-i) * y), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[z, 9600000000.0], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \left(\left(-c\right) \cdot z\right)\\
t_2 := \left(\left(-t\right) \cdot a\right) \cdot x\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{+143}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{+110}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{-243}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-171}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-62}:\\
\;\;\;\;\left(\left(-i\right) \cdot y\right) \cdot j\\
\mathbf{elif}\;z \leq 9600000000:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.8e143Initial program 61.2%
Taylor expanded in y around inf
Applied rewrites74.8%
Taylor expanded in x around inf
Applied rewrites71.6%
if -1.8e143 < z < -2.6e110 or 9.6e9 < z Initial program 70.2%
Taylor expanded in c around inf
Applied rewrites59.2%
Applied rewrites57.6%
Taylor expanded in z around inf
Applied rewrites43.9%
if -2.6e110 < z < -3.1999999999999998e-243 or 1.5000000000000001e-62 < z < 9.6e9Initial program 84.0%
Taylor expanded in x around inf
Applied rewrites54.8%
Taylor expanded in y around 0
Applied rewrites42.5%
if -3.1999999999999998e-243 < z < 3.70000000000000012e-171Initial program 65.7%
Taylor expanded in c around inf
Applied rewrites43.4%
Taylor expanded in z around 0
Applied rewrites38.3%
if 3.70000000000000012e-171 < z < 1.5000000000000001e-62Initial program 71.5%
Taylor expanded in j around inf
Applied rewrites55.1%
Taylor expanded in y around inf
Applied rewrites44.8%
Final simplification46.1%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* b (* (- c) z))) (t_2 (* (* (- t) a) x)))
(if (<= z -1.8e+143)
(* (* z x) y)
(if (<= z -2.6e+110)
t_1
(if (<= z -3.2e-243)
t_2
(if (<= z 8.2e-159)
(* (* j t) c)
(if (<= z 2.05e-79)
(* (* (- j) y) i)
(if (<= z 9600000000.0) t_2 t_1))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = b * (-c * z);
double t_2 = (-t * a) * x;
double tmp;
if (z <= -1.8e+143) {
tmp = (z * x) * y;
} else if (z <= -2.6e+110) {
tmp = t_1;
} else if (z <= -3.2e-243) {
tmp = t_2;
} else if (z <= 8.2e-159) {
tmp = (j * t) * c;
} else if (z <= 2.05e-79) {
tmp = (-j * y) * i;
} else if (z <= 9600000000.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
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 = b * (-c * z)
t_2 = (-t * a) * x
if (z <= (-1.8d+143)) then
tmp = (z * x) * y
else if (z <= (-2.6d+110)) then
tmp = t_1
else if (z <= (-3.2d-243)) then
tmp = t_2
else if (z <= 8.2d-159) then
tmp = (j * t) * c
else if (z <= 2.05d-79) then
tmp = (-j * y) * i
else if (z <= 9600000000.0d0) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = b * (-c * z);
double t_2 = (-t * a) * x;
double tmp;
if (z <= -1.8e+143) {
tmp = (z * x) * y;
} else if (z <= -2.6e+110) {
tmp = t_1;
} else if (z <= -3.2e-243) {
tmp = t_2;
} else if (z <= 8.2e-159) {
tmp = (j * t) * c;
} else if (z <= 2.05e-79) {
tmp = (-j * y) * i;
} else if (z <= 9600000000.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = b * (-c * z) t_2 = (-t * a) * x tmp = 0 if z <= -1.8e+143: tmp = (z * x) * y elif z <= -2.6e+110: tmp = t_1 elif z <= -3.2e-243: tmp = t_2 elif z <= 8.2e-159: tmp = (j * t) * c elif z <= 2.05e-79: tmp = (-j * y) * i elif z <= 9600000000.0: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(b * Float64(Float64(-c) * z)) t_2 = Float64(Float64(Float64(-t) * a) * x) tmp = 0.0 if (z <= -1.8e+143) tmp = Float64(Float64(z * x) * y); elseif (z <= -2.6e+110) tmp = t_1; elseif (z <= -3.2e-243) tmp = t_2; elseif (z <= 8.2e-159) tmp = Float64(Float64(j * t) * c); elseif (z <= 2.05e-79) tmp = Float64(Float64(Float64(-j) * y) * i); elseif (z <= 9600000000.0) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = b * (-c * z); t_2 = (-t * a) * x; tmp = 0.0; if (z <= -1.8e+143) tmp = (z * x) * y; elseif (z <= -2.6e+110) tmp = t_1; elseif (z <= -3.2e-243) tmp = t_2; elseif (z <= 8.2e-159) tmp = (j * t) * c; elseif (z <= 2.05e-79) tmp = (-j * y) * i; elseif (z <= 9600000000.0) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(b * N[((-c) * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-t) * a), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -1.8e+143], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, -2.6e+110], t$95$1, If[LessEqual[z, -3.2e-243], t$95$2, If[LessEqual[z, 8.2e-159], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[z, 2.05e-79], N[(N[((-j) * y), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[z, 9600000000.0], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \left(\left(-c\right) \cdot z\right)\\
t_2 := \left(\left(-t\right) \cdot a\right) \cdot x\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{+143}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{+110}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{-243}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-159}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{-79}:\\
\;\;\;\;\left(\left(-j\right) \cdot y\right) \cdot i\\
\mathbf{elif}\;z \leq 9600000000:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.8e143Initial program 61.2%
Taylor expanded in y around inf
Applied rewrites74.8%
Taylor expanded in x around inf
Applied rewrites71.6%
if -1.8e143 < z < -2.6e110 or 9.6e9 < z Initial program 70.2%
Taylor expanded in c around inf
Applied rewrites59.2%
Applied rewrites57.6%
Taylor expanded in z around inf
Applied rewrites43.9%
if -2.6e110 < z < -3.1999999999999998e-243 or 2.04999999999999997e-79 < z < 9.6e9Initial program 83.0%
Taylor expanded in x around inf
Applied rewrites54.7%
Taylor expanded in y around 0
Applied rewrites41.2%
if -3.1999999999999998e-243 < z < 8.20000000000000029e-159Initial program 67.4%
Taylor expanded in c around inf
Applied rewrites40.9%
Taylor expanded in z around 0
Applied rewrites36.3%
if 8.20000000000000029e-159 < z < 2.04999999999999997e-79Initial program 70.7%
Taylor expanded in j around inf
Applied rewrites54.5%
Taylor expanded in y around inf
Applied rewrites47.6%
Final simplification45.4%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- a) x (* j c)) t)))
(if (<= t -4e+62)
t_1
(if (<= t -1.75e-41)
(* (fma (- x) t (* i b)) a)
(if (<= t -3e-104)
(* (fma (- z) b (* j t)) c)
(if (<= t 7.2e-280)
(* (fma z x (* (- j) i)) y)
(if (<= t 1.08e-94) (* (fma (- c) z (* i a)) b) t_1)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-a, x, (j * c)) * t;
double tmp;
if (t <= -4e+62) {
tmp = t_1;
} else if (t <= -1.75e-41) {
tmp = fma(-x, t, (i * b)) * a;
} else if (t <= -3e-104) {
tmp = fma(-z, b, (j * t)) * c;
} else if (t <= 7.2e-280) {
tmp = fma(z, x, (-j * i)) * y;
} else if (t <= 1.08e-94) {
tmp = fma(-c, z, (i * a)) * b;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-a), x, Float64(j * c)) * t) tmp = 0.0 if (t <= -4e+62) tmp = t_1; elseif (t <= -1.75e-41) tmp = Float64(fma(Float64(-x), t, Float64(i * b)) * a); elseif (t <= -3e-104) tmp = Float64(fma(Float64(-z), b, Float64(j * t)) * c); elseif (t <= 7.2e-280) tmp = Float64(fma(z, x, Float64(Float64(-j) * i)) * y); elseif (t <= 1.08e-94) tmp = Float64(fma(Float64(-c), z, Float64(i * a)) * b); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -4e+62], t$95$1, If[LessEqual[t, -1.75e-41], N[(N[((-x) * t + N[(i * b), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[t, -3e-104], N[(N[((-z) * b + N[(j * t), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[t, 7.2e-280], N[(N[(z * x + N[((-j) * i), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t, 1.08e-94], N[(N[((-c) * z + N[(i * a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\\
\mathbf{if}\;t \leq -4 \cdot 10^{+62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.75 \cdot 10^{-41}:\\
\;\;\;\;\mathsf{fma}\left(-x, t, i \cdot b\right) \cdot a\\
\mathbf{elif}\;t \leq -3 \cdot 10^{-104}:\\
\;\;\;\;\mathsf{fma}\left(-z, b, j \cdot t\right) \cdot c\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{-280}:\\
\;\;\;\;\mathsf{fma}\left(z, x, \left(-j\right) \cdot i\right) \cdot y\\
\mathbf{elif}\;t \leq 1.08 \cdot 10^{-94}:\\
\;\;\;\;\mathsf{fma}\left(-c, z, i \cdot a\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.00000000000000014e62 or 1.08e-94 < t Initial program 68.7%
Taylor expanded in t around inf
Applied rewrites62.4%
if -4.00000000000000014e62 < t < -1.75e-41Initial program 68.3%
Taylor expanded in a around inf
Applied rewrites68.5%
if -1.75e-41 < t < -3.0000000000000002e-104Initial program 67.2%
Taylor expanded in c around inf
Applied rewrites75.1%
if -3.0000000000000002e-104 < t < 7.19999999999999989e-280Initial program 79.5%
Taylor expanded in y around inf
Applied rewrites65.6%
Applied rewrites67.7%
if 7.19999999999999989e-280 < t < 1.08e-94Initial program 85.7%
Taylor expanded in b around inf
Applied rewrites62.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- c) z (* i a)) b)) (t_2 (* (fma (- a) x (* j c)) t)))
(if (<= t -4e+62)
t_2
(if (<= t -7.5e-41)
(* (fma (- x) t (* i b)) a)
(if (<= t -1.8e-105)
t_1
(if (<= t 7.2e-280)
(* (fma z x (* (- j) i)) y)
(if (<= t 1.08e-94) 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(-c, z, (i * a)) * b;
double t_2 = fma(-a, x, (j * c)) * t;
double tmp;
if (t <= -4e+62) {
tmp = t_2;
} else if (t <= -7.5e-41) {
tmp = fma(-x, t, (i * b)) * a;
} else if (t <= -1.8e-105) {
tmp = t_1;
} else if (t <= 7.2e-280) {
tmp = fma(z, x, (-j * i)) * y;
} else if (t <= 1.08e-94) {
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(-c), z, Float64(i * a)) * b) t_2 = Float64(fma(Float64(-a), x, Float64(j * c)) * t) tmp = 0.0 if (t <= -4e+62) tmp = t_2; elseif (t <= -7.5e-41) tmp = Float64(fma(Float64(-x), t, Float64(i * b)) * a); elseif (t <= -1.8e-105) tmp = t_1; elseif (t <= 7.2e-280) tmp = Float64(fma(z, x, Float64(Float64(-j) * i)) * y); elseif (t <= 1.08e-94) 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[((-c) * z + N[(i * a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -4e+62], t$95$2, If[LessEqual[t, -7.5e-41], N[(N[((-x) * t + N[(i * b), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[t, -1.8e-105], t$95$1, If[LessEqual[t, 7.2e-280], N[(N[(z * x + N[((-j) * i), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t, 1.08e-94], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-c, z, i \cdot a\right) \cdot b\\
t_2 := \mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\\
\mathbf{if}\;t \leq -4 \cdot 10^{+62}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -7.5 \cdot 10^{-41}:\\
\;\;\;\;\mathsf{fma}\left(-x, t, i \cdot b\right) \cdot a\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-105}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{-280}:\\
\;\;\;\;\mathsf{fma}\left(z, x, \left(-j\right) \cdot i\right) \cdot y\\
\mathbf{elif}\;t \leq 1.08 \cdot 10^{-94}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -4.00000000000000014e62 or 1.08e-94 < t Initial program 68.7%
Taylor expanded in t around inf
Applied rewrites62.4%
if -4.00000000000000014e62 < t < -7.50000000000000049e-41Initial program 68.3%
Taylor expanded in a around inf
Applied rewrites68.5%
if -7.50000000000000049e-41 < t < -1.79999999999999982e-105 or 7.19999999999999989e-280 < t < 1.08e-94Initial program 81.5%
Taylor expanded in b around inf
Applied rewrites63.2%
if -1.79999999999999982e-105 < t < 7.19999999999999989e-280Initial program 79.5%
Taylor expanded in y around inf
Applied rewrites65.6%
Applied rewrites67.7%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- a) t (* z y)) x)) (t_2 (* (fma (- b) c (* y x)) z)))
(if (<= z -3.5e+111)
t_2
(if (<= z -7.5e-137)
t_1
(if (<= z 1.5e-158)
(* (fma (- a) x (* j c)) t)
(if (<= z 1e-62)
(* (fma z x (* (- j) i)) y)
(if (<= z 9600000000.0) 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(-a, t, (z * y)) * x;
double t_2 = fma(-b, c, (y * x)) * z;
double tmp;
if (z <= -3.5e+111) {
tmp = t_2;
} else if (z <= -7.5e-137) {
tmp = t_1;
} else if (z <= 1.5e-158) {
tmp = fma(-a, x, (j * c)) * t;
} else if (z <= 1e-62) {
tmp = fma(z, x, (-j * i)) * y;
} else if (z <= 9600000000.0) {
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(-a), t, Float64(z * y)) * x) t_2 = Float64(fma(Float64(-b), c, Float64(y * x)) * z) tmp = 0.0 if (z <= -3.5e+111) tmp = t_2; elseif (z <= -7.5e-137) tmp = t_1; elseif (z <= 1.5e-158) tmp = Float64(fma(Float64(-a), x, Float64(j * c)) * t); elseif (z <= 1e-62) tmp = Float64(fma(z, x, Float64(Float64(-j) * i)) * y); elseif (z <= 9600000000.0) 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[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -3.5e+111], t$95$2, If[LessEqual[z, -7.5e-137], t$95$1, If[LessEqual[z, 1.5e-158], N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 1e-62], N[(N[(z * x + N[((-j) * i), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 9600000000.0], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\
t_2 := \mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{+111}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -7.5 \cdot 10^{-137}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-158}:\\
\;\;\;\;\mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\\
\mathbf{elif}\;z \leq 10^{-62}:\\
\;\;\;\;\mathsf{fma}\left(z, x, \left(-j\right) \cdot i\right) \cdot y\\
\mathbf{elif}\;z \leq 9600000000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -3.5000000000000002e111 or 9.6e9 < z Initial program 67.2%
Taylor expanded in z around inf
Applied rewrites69.7%
if -3.5000000000000002e111 < z < -7.4999999999999995e-137 or 1e-62 < z < 9.6e9Initial program 86.9%
Taylor expanded in x around inf
Applied rewrites58.6%
if -7.4999999999999995e-137 < z < 1.5e-158Initial program 70.9%
Taylor expanded in t around inf
Applied rewrites58.5%
if 1.5e-158 < z < 1e-62Initial program 70.2%
Taylor expanded in y around inf
Applied rewrites60.4%
Applied rewrites60.4%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= z -2.7e+111) (not (<= z 4.8e+26))) (* (fma (- b) c (* y x)) z) (+ (* (- a) (* t x)) (* j (- (* c t) (* i y))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((z <= -2.7e+111) || !(z <= 4.8e+26)) {
tmp = fma(-b, c, (y * x)) * z;
} else {
tmp = (-a * (t * x)) + (j * ((c * t) - (i * y)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((z <= -2.7e+111) || !(z <= 4.8e+26)) tmp = Float64(fma(Float64(-b), c, Float64(y * x)) * z); else tmp = Float64(Float64(Float64(-a) * Float64(t * x)) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[z, -2.7e+111], N[Not[LessEqual[z, 4.8e+26]], $MachinePrecision]], N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+111} \lor \neg \left(z \leq 4.8 \cdot 10^{+26}\right):\\
\;\;\;\;\mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right) + j \cdot \left(c \cdot t - i \cdot y\right)\\
\end{array}
\end{array}
if z < -2.6999999999999999e111 or 4.80000000000000009e26 < z Initial program 67.1%
Taylor expanded in z around inf
Applied rewrites70.8%
if -2.6999999999999999e111 < z < 4.80000000000000009e26Initial program 76.7%
Taylor expanded in t around inf
Applied rewrites59.4%
Final simplification63.4%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* z x) y)))
(if (<= z -1.45e+138)
t_1
(if (<= z -2.7e-205)
(* (* i a) b)
(if (<= z 8.2e-159)
(* (* j t) c)
(if (<= z 3.1e-79)
(* (* (- j) y) i)
(if (<= z 0.00048) 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 = (z * x) * y;
double tmp;
if (z <= -1.45e+138) {
tmp = t_1;
} else if (z <= -2.7e-205) {
tmp = (i * a) * b;
} else if (z <= 8.2e-159) {
tmp = (j * t) * c;
} else if (z <= 3.1e-79) {
tmp = (-j * y) * i;
} else if (z <= 0.00048) {
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 = (z * x) * y
if (z <= (-1.45d+138)) then
tmp = t_1
else if (z <= (-2.7d-205)) then
tmp = (i * a) * b
else if (z <= 8.2d-159) then
tmp = (j * t) * c
else if (z <= 3.1d-79) then
tmp = (-j * y) * i
else if (z <= 0.00048d0) 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 = (z * x) * y;
double tmp;
if (z <= -1.45e+138) {
tmp = t_1;
} else if (z <= -2.7e-205) {
tmp = (i * a) * b;
} else if (z <= 8.2e-159) {
tmp = (j * t) * c;
} else if (z <= 3.1e-79) {
tmp = (-j * y) * i;
} else if (z <= 0.00048) {
tmp = t_1;
} else {
tmp = b * (-c * z);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (z * x) * y tmp = 0 if z <= -1.45e+138: tmp = t_1 elif z <= -2.7e-205: tmp = (i * a) * b elif z <= 8.2e-159: tmp = (j * t) * c elif z <= 3.1e-79: tmp = (-j * y) * i elif z <= 0.00048: 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(z * x) * y) tmp = 0.0 if (z <= -1.45e+138) tmp = t_1; elseif (z <= -2.7e-205) tmp = Float64(Float64(i * a) * b); elseif (z <= 8.2e-159) tmp = Float64(Float64(j * t) * c); elseif (z <= 3.1e-79) tmp = Float64(Float64(Float64(-j) * y) * i); elseif (z <= 0.00048) tmp = t_1; else tmp = Float64(b * Float64(Float64(-c) * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (z * x) * y; tmp = 0.0; if (z <= -1.45e+138) tmp = t_1; elseif (z <= -2.7e-205) tmp = (i * a) * b; elseif (z <= 8.2e-159) tmp = (j * t) * c; elseif (z <= 3.1e-79) tmp = (-j * y) * i; elseif (z <= 0.00048) 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[(N[(z * x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[z, -1.45e+138], t$95$1, If[LessEqual[z, -2.7e-205], N[(N[(i * a), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[z, 8.2e-159], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[z, 3.1e-79], N[(N[((-j) * y), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[z, 0.00048], t$95$1, N[(b * N[((-c) * z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot x\right) \cdot y\\
\mathbf{if}\;z \leq -1.45 \cdot 10^{+138}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.7 \cdot 10^{-205}:\\
\;\;\;\;\left(i \cdot a\right) \cdot b\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-159}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{-79}:\\
\;\;\;\;\left(\left(-j\right) \cdot y\right) \cdot i\\
\mathbf{elif}\;z \leq 0.00048:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(\left(-c\right) \cdot z\right)\\
\end{array}
\end{array}
if z < -1.45000000000000005e138 or 3.0999999999999999e-79 < z < 4.80000000000000012e-4Initial program 69.3%
Taylor expanded in y around inf
Applied rewrites61.7%
Taylor expanded in x around inf
Applied rewrites55.7%
if -1.45000000000000005e138 < z < -2.7000000000000001e-205Initial program 80.3%
Taylor expanded in b around inf
Applied rewrites44.2%
Taylor expanded in z around 0
Applied rewrites37.4%
if -2.7000000000000001e-205 < z < 8.20000000000000029e-159Initial program 71.0%
Taylor expanded in c around inf
Applied rewrites41.4%
Taylor expanded in z around 0
Applied rewrites36.2%
if 8.20000000000000029e-159 < z < 3.0999999999999999e-79Initial program 70.7%
Taylor expanded in j around inf
Applied rewrites54.5%
Taylor expanded in y around inf
Applied rewrites47.6%
if 4.80000000000000012e-4 < z Initial program 72.7%
Taylor expanded in c around inf
Applied rewrites57.1%
Applied rewrites57.1%
Taylor expanded in z around inf
Applied rewrites42.0%
Final simplification42.9%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* z x) y)))
(if (<= z -1.45e+138)
t_1
(if (<= z -2.7e-205)
(* (* i a) b)
(if (<= z 8.2e-159)
(* (* j t) c)
(if (<= z 3.1e-79)
(* (* (- j) y) i)
(if (<= z 0.00048) 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 = (z * x) * y;
double tmp;
if (z <= -1.45e+138) {
tmp = t_1;
} else if (z <= -2.7e-205) {
tmp = (i * a) * b;
} else if (z <= 8.2e-159) {
tmp = (j * t) * c;
} else if (z <= 3.1e-79) {
tmp = (-j * y) * i;
} else if (z <= 0.00048) {
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 = (z * x) * y
if (z <= (-1.45d+138)) then
tmp = t_1
else if (z <= (-2.7d-205)) then
tmp = (i * a) * b
else if (z <= 8.2d-159) then
tmp = (j * t) * c
else if (z <= 3.1d-79) then
tmp = (-j * y) * i
else if (z <= 0.00048d0) 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 = (z * x) * y;
double tmp;
if (z <= -1.45e+138) {
tmp = t_1;
} else if (z <= -2.7e-205) {
tmp = (i * a) * b;
} else if (z <= 8.2e-159) {
tmp = (j * t) * c;
} else if (z <= 3.1e-79) {
tmp = (-j * y) * i;
} else if (z <= 0.00048) {
tmp = t_1;
} else {
tmp = (-b * c) * z;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (z * x) * y tmp = 0 if z <= -1.45e+138: tmp = t_1 elif z <= -2.7e-205: tmp = (i * a) * b elif z <= 8.2e-159: tmp = (j * t) * c elif z <= 3.1e-79: tmp = (-j * y) * i elif z <= 0.00048: 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(z * x) * y) tmp = 0.0 if (z <= -1.45e+138) tmp = t_1; elseif (z <= -2.7e-205) tmp = Float64(Float64(i * a) * b); elseif (z <= 8.2e-159) tmp = Float64(Float64(j * t) * c); elseif (z <= 3.1e-79) tmp = Float64(Float64(Float64(-j) * y) * i); elseif (z <= 0.00048) tmp = t_1; else tmp = Float64(Float64(Float64(-b) * c) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (z * x) * y; tmp = 0.0; if (z <= -1.45e+138) tmp = t_1; elseif (z <= -2.7e-205) tmp = (i * a) * b; elseif (z <= 8.2e-159) tmp = (j * t) * c; elseif (z <= 3.1e-79) tmp = (-j * y) * i; elseif (z <= 0.00048) 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[(N[(z * x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[z, -1.45e+138], t$95$1, If[LessEqual[z, -2.7e-205], N[(N[(i * a), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[z, 8.2e-159], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[z, 3.1e-79], N[(N[((-j) * y), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[z, 0.00048], t$95$1, N[(N[((-b) * c), $MachinePrecision] * z), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot x\right) \cdot y\\
\mathbf{if}\;z \leq -1.45 \cdot 10^{+138}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.7 \cdot 10^{-205}:\\
\;\;\;\;\left(i \cdot a\right) \cdot b\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-159}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{-79}:\\
\;\;\;\;\left(\left(-j\right) \cdot y\right) \cdot i\\
\mathbf{elif}\;z \leq 0.00048:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-b\right) \cdot c\right) \cdot z\\
\end{array}
\end{array}
if z < -1.45000000000000005e138 or 3.0999999999999999e-79 < z < 4.80000000000000012e-4Initial program 69.3%
Taylor expanded in y around inf
Applied rewrites61.7%
Taylor expanded in x around inf
Applied rewrites55.7%
if -1.45000000000000005e138 < z < -2.7000000000000001e-205Initial program 80.3%
Taylor expanded in b around inf
Applied rewrites44.2%
Taylor expanded in z around 0
Applied rewrites37.4%
if -2.7000000000000001e-205 < z < 8.20000000000000029e-159Initial program 71.0%
Taylor expanded in c around inf
Applied rewrites41.4%
Taylor expanded in z around 0
Applied rewrites36.2%
if 8.20000000000000029e-159 < z < 3.0999999999999999e-79Initial program 70.7%
Taylor expanded in j around inf
Applied rewrites54.5%
Taylor expanded in y around inf
Applied rewrites47.6%
if 4.80000000000000012e-4 < z Initial program 72.7%
Taylor expanded in c around inf
Applied rewrites57.1%
Taylor expanded in z around inf
Applied rewrites41.9%
Final simplification42.9%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= t -4e+62)
(* (* j t) c)
(if (<= t -3e-81)
(* (* i b) a)
(if (<= t -5.8e-192)
(* (* z x) y)
(if (<= t 2e-287)
(* (* (- j) y) i)
(if (<= t 4.5e-95) (* (* i a) b) (* (- 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 (t <= -4e+62) {
tmp = (j * t) * c;
} else if (t <= -3e-81) {
tmp = (i * b) * a;
} else if (t <= -5.8e-192) {
tmp = (z * x) * y;
} else if (t <= 2e-287) {
tmp = (-j * y) * i;
} else if (t <= 4.5e-95) {
tmp = (i * a) * b;
} else {
tmp = -a * (t * 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 (t <= (-4d+62)) then
tmp = (j * t) * c
else if (t <= (-3d-81)) then
tmp = (i * b) * a
else if (t <= (-5.8d-192)) then
tmp = (z * x) * y
else if (t <= 2d-287) then
tmp = (-j * y) * i
else if (t <= 4.5d-95) then
tmp = (i * a) * b
else
tmp = -a * (t * 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 (t <= -4e+62) {
tmp = (j * t) * c;
} else if (t <= -3e-81) {
tmp = (i * b) * a;
} else if (t <= -5.8e-192) {
tmp = (z * x) * y;
} else if (t <= 2e-287) {
tmp = (-j * y) * i;
} else if (t <= 4.5e-95) {
tmp = (i * a) * b;
} else {
tmp = -a * (t * x);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if t <= -4e+62: tmp = (j * t) * c elif t <= -3e-81: tmp = (i * b) * a elif t <= -5.8e-192: tmp = (z * x) * y elif t <= 2e-287: tmp = (-j * y) * i elif t <= 4.5e-95: tmp = (i * a) * b else: tmp = -a * (t * x) return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (t <= -4e+62) tmp = Float64(Float64(j * t) * c); elseif (t <= -3e-81) tmp = Float64(Float64(i * b) * a); elseif (t <= -5.8e-192) tmp = Float64(Float64(z * x) * y); elseif (t <= 2e-287) tmp = Float64(Float64(Float64(-j) * y) * i); elseif (t <= 4.5e-95) tmp = Float64(Float64(i * a) * b); else tmp = Float64(Float64(-a) * Float64(t * x)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (t <= -4e+62) tmp = (j * t) * c; elseif (t <= -3e-81) tmp = (i * b) * a; elseif (t <= -5.8e-192) tmp = (z * x) * y; elseif (t <= 2e-287) tmp = (-j * y) * i; elseif (t <= 4.5e-95) tmp = (i * a) * b; else tmp = -a * (t * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[t, -4e+62], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[t, -3e-81], N[(N[(i * b), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[t, -5.8e-192], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t, 2e-287], N[(N[((-j) * y), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[t, 4.5e-95], N[(N[(i * a), $MachinePrecision] * b), $MachinePrecision], N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+62}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;t \leq -3 \cdot 10^{-81}:\\
\;\;\;\;\left(i \cdot b\right) \cdot a\\
\mathbf{elif}\;t \leq -5.8 \cdot 10^{-192}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\mathbf{elif}\;t \leq 2 \cdot 10^{-287}:\\
\;\;\;\;\left(\left(-j\right) \cdot y\right) \cdot i\\
\mathbf{elif}\;t \leq 4.5 \cdot 10^{-95}:\\
\;\;\;\;\left(i \cdot a\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right)\\
\end{array}
\end{array}
if t < -4.00000000000000014e62Initial program 62.2%
Taylor expanded in c around inf
Applied rewrites60.6%
Taylor expanded in z around 0
Applied rewrites49.5%
if -4.00000000000000014e62 < t < -2.9999999999999999e-81Initial program 68.9%
Taylor expanded in b around inf
Applied rewrites45.1%
Taylor expanded in z around 0
Applied rewrites42.1%
if -2.9999999999999999e-81 < t < -5.80000000000000033e-192Initial program 73.3%
Taylor expanded in y around inf
Applied rewrites54.9%
Taylor expanded in x around inf
Applied rewrites46.9%
if -5.80000000000000033e-192 < t < 2.00000000000000004e-287Initial program 82.1%
Taylor expanded in j around inf
Applied rewrites51.9%
Taylor expanded in y around inf
Applied rewrites48.1%
if 2.00000000000000004e-287 < t < 4.5e-95Initial program 85.7%
Taylor expanded in b around inf
Applied rewrites62.2%
Taylor expanded in z around 0
Applied rewrites36.0%
if 4.5e-95 < t Initial program 73.1%
Taylor expanded in x around inf
Applied rewrites49.1%
Taylor expanded in y around 0
Applied rewrites38.2%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= t -1.6e+236)
(* (* j t) c)
(if (or (<= t -3.3e+78) (not (<= t 6e-164)))
(* (fma (- a) t (* z y)) x)
(* (fma z x (* (- j) i)) y))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (t <= -1.6e+236) {
tmp = (j * t) * c;
} else if ((t <= -3.3e+78) || !(t <= 6e-164)) {
tmp = fma(-a, t, (z * y)) * x;
} else {
tmp = fma(z, x, (-j * i)) * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (t <= -1.6e+236) tmp = Float64(Float64(j * t) * c); elseif ((t <= -3.3e+78) || !(t <= 6e-164)) tmp = Float64(fma(Float64(-a), t, Float64(z * y)) * x); else tmp = Float64(fma(z, x, Float64(Float64(-j) * i)) * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[t, -1.6e+236], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[Or[LessEqual[t, -3.3e+78], N[Not[LessEqual[t, 6e-164]], $MachinePrecision]], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(z * x + N[((-j) * i), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{+236}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;t \leq -3.3 \cdot 10^{+78} \lor \neg \left(t \leq 6 \cdot 10^{-164}\right):\\
\;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, x, \left(-j\right) \cdot i\right) \cdot y\\
\end{array}
\end{array}
if t < -1.6000000000000001e236Initial program 50.4%
Taylor expanded in c around inf
Applied rewrites71.8%
Taylor expanded in z around 0
Applied rewrites71.8%
if -1.6000000000000001e236 < t < -3.3e78 or 6.0000000000000002e-164 < t Initial program 73.1%
Taylor expanded in x around inf
Applied rewrites51.1%
if -3.3e78 < t < 6.0000000000000002e-164Initial program 76.5%
Taylor expanded in y around inf
Applied rewrites51.6%
Applied rewrites52.5%
Final simplification52.8%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= t -4e+62)
(* (* j t) c)
(if (<= t -3e-81)
(* (* i b) a)
(if (<= t 5.9e-137)
(* (* z x) y)
(if (<= t 4.5e-95) (* (* i a) b) (* (- 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 (t <= -4e+62) {
tmp = (j * t) * c;
} else if (t <= -3e-81) {
tmp = (i * b) * a;
} else if (t <= 5.9e-137) {
tmp = (z * x) * y;
} else if (t <= 4.5e-95) {
tmp = (i * a) * b;
} else {
tmp = -a * (t * 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 (t <= (-4d+62)) then
tmp = (j * t) * c
else if (t <= (-3d-81)) then
tmp = (i * b) * a
else if (t <= 5.9d-137) then
tmp = (z * x) * y
else if (t <= 4.5d-95) then
tmp = (i * a) * b
else
tmp = -a * (t * 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 (t <= -4e+62) {
tmp = (j * t) * c;
} else if (t <= -3e-81) {
tmp = (i * b) * a;
} else if (t <= 5.9e-137) {
tmp = (z * x) * y;
} else if (t <= 4.5e-95) {
tmp = (i * a) * b;
} else {
tmp = -a * (t * x);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if t <= -4e+62: tmp = (j * t) * c elif t <= -3e-81: tmp = (i * b) * a elif t <= 5.9e-137: tmp = (z * x) * y elif t <= 4.5e-95: tmp = (i * a) * b else: tmp = -a * (t * x) return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (t <= -4e+62) tmp = Float64(Float64(j * t) * c); elseif (t <= -3e-81) tmp = Float64(Float64(i * b) * a); elseif (t <= 5.9e-137) tmp = Float64(Float64(z * x) * y); elseif (t <= 4.5e-95) tmp = Float64(Float64(i * a) * b); else tmp = Float64(Float64(-a) * Float64(t * x)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (t <= -4e+62) tmp = (j * t) * c; elseif (t <= -3e-81) tmp = (i * b) * a; elseif (t <= 5.9e-137) tmp = (z * x) * y; elseif (t <= 4.5e-95) tmp = (i * a) * b; else tmp = -a * (t * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[t, -4e+62], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[t, -3e-81], N[(N[(i * b), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[t, 5.9e-137], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t, 4.5e-95], N[(N[(i * a), $MachinePrecision] * b), $MachinePrecision], N[((-a) * N[(t * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+62}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;t \leq -3 \cdot 10^{-81}:\\
\;\;\;\;\left(i \cdot b\right) \cdot a\\
\mathbf{elif}\;t \leq 5.9 \cdot 10^{-137}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\mathbf{elif}\;t \leq 4.5 \cdot 10^{-95}:\\
\;\;\;\;\left(i \cdot a\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(-a\right) \cdot \left(t \cdot x\right)\\
\end{array}
\end{array}
if t < -4.00000000000000014e62Initial program 62.2%
Taylor expanded in c around inf
Applied rewrites60.6%
Taylor expanded in z around 0
Applied rewrites49.5%
if -4.00000000000000014e62 < t < -2.9999999999999999e-81Initial program 68.9%
Taylor expanded in b around inf
Applied rewrites45.1%
Taylor expanded in z around 0
Applied rewrites42.1%
if -2.9999999999999999e-81 < t < 5.9000000000000001e-137Initial program 81.6%
Taylor expanded in y around inf
Applied rewrites54.0%
Taylor expanded in x around inf
Applied rewrites34.5%
if 5.9000000000000001e-137 < t < 4.5e-95Initial program 77.6%
Taylor expanded in b around inf
Applied rewrites68.4%
Taylor expanded in z around 0
Applied rewrites68.4%
if 4.5e-95 < t Initial program 73.1%
Taylor expanded in x around inf
Applied rewrites49.1%
Taylor expanded in y around 0
Applied rewrites38.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- a) x (* j c)) t)))
(if (<= t -3.8e+71)
t_1
(if (<= t 7.2e-280)
(* (fma z x (* (- j) i)) y)
(if (<= t 1.08e-94) (* (fma (- c) z (* i a)) b) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-a, x, (j * c)) * t;
double tmp;
if (t <= -3.8e+71) {
tmp = t_1;
} else if (t <= 7.2e-280) {
tmp = fma(z, x, (-j * i)) * y;
} else if (t <= 1.08e-94) {
tmp = fma(-c, z, (i * a)) * b;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-a), x, Float64(j * c)) * t) tmp = 0.0 if (t <= -3.8e+71) tmp = t_1; elseif (t <= 7.2e-280) tmp = Float64(fma(z, x, Float64(Float64(-j) * i)) * y); elseif (t <= 1.08e-94) tmp = Float64(fma(Float64(-c), z, Float64(i * a)) * b); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -3.8e+71], t$95$1, If[LessEqual[t, 7.2e-280], N[(N[(z * x + N[((-j) * i), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t, 1.08e-94], N[(N[((-c) * z + N[(i * a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\\
\mathbf{if}\;t \leq -3.8 \cdot 10^{+71}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{-280}:\\
\;\;\;\;\mathsf{fma}\left(z, x, \left(-j\right) \cdot i\right) \cdot y\\
\mathbf{elif}\;t \leq 1.08 \cdot 10^{-94}:\\
\;\;\;\;\mathsf{fma}\left(-c, z, i \cdot a\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.8000000000000001e71 or 1.08e-94 < t Initial program 68.8%
Taylor expanded in t around inf
Applied rewrites63.1%
if -3.8000000000000001e71 < t < 7.19999999999999989e-280Initial program 74.2%
Taylor expanded in y around inf
Applied rewrites55.7%
Applied rewrites56.8%
if 7.19999999999999989e-280 < t < 1.08e-94Initial program 85.7%
Taylor expanded in b around inf
Applied rewrites62.2%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= t -4e+62)
(* (* j t) c)
(if (<= t -3e-81)
(* (* i b) a)
(if (<= t 5.9e-137)
(* (* z x) y)
(if (<= t 2.9e-93) (* (* i a) b) (* (* c t) j))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (t <= -4e+62) {
tmp = (j * t) * c;
} else if (t <= -3e-81) {
tmp = (i * b) * a;
} else if (t <= 5.9e-137) {
tmp = (z * x) * y;
} else if (t <= 2.9e-93) {
tmp = (i * a) * b;
} else {
tmp = (c * t) * j;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: tmp
if (t <= (-4d+62)) then
tmp = (j * t) * c
else if (t <= (-3d-81)) then
tmp = (i * b) * a
else if (t <= 5.9d-137) then
tmp = (z * x) * y
else if (t <= 2.9d-93) then
tmp = (i * a) * b
else
tmp = (c * t) * j
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (t <= -4e+62) {
tmp = (j * t) * c;
} else if (t <= -3e-81) {
tmp = (i * b) * a;
} else if (t <= 5.9e-137) {
tmp = (z * x) * y;
} else if (t <= 2.9e-93) {
tmp = (i * a) * b;
} else {
tmp = (c * t) * j;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if t <= -4e+62: tmp = (j * t) * c elif t <= -3e-81: tmp = (i * b) * a elif t <= 5.9e-137: tmp = (z * x) * y elif t <= 2.9e-93: tmp = (i * a) * b else: tmp = (c * t) * j return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (t <= -4e+62) tmp = Float64(Float64(j * t) * c); elseif (t <= -3e-81) tmp = Float64(Float64(i * b) * a); elseif (t <= 5.9e-137) tmp = Float64(Float64(z * x) * y); elseif (t <= 2.9e-93) tmp = Float64(Float64(i * a) * b); else tmp = Float64(Float64(c * t) * j); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if (t <= -4e+62) tmp = (j * t) * c; elseif (t <= -3e-81) tmp = (i * b) * a; elseif (t <= 5.9e-137) tmp = (z * x) * y; elseif (t <= 2.9e-93) tmp = (i * a) * b; else tmp = (c * t) * j; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[t, -4e+62], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[t, -3e-81], N[(N[(i * b), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[t, 5.9e-137], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t, 2.9e-93], N[(N[(i * a), $MachinePrecision] * b), $MachinePrecision], N[(N[(c * t), $MachinePrecision] * j), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+62}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;t \leq -3 \cdot 10^{-81}:\\
\;\;\;\;\left(i \cdot b\right) \cdot a\\
\mathbf{elif}\;t \leq 5.9 \cdot 10^{-137}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{-93}:\\
\;\;\;\;\left(i \cdot a\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(c \cdot t\right) \cdot j\\
\end{array}
\end{array}
if t < -4.00000000000000014e62Initial program 62.2%
Taylor expanded in c around inf
Applied rewrites60.6%
Taylor expanded in z around 0
Applied rewrites49.5%
if -4.00000000000000014e62 < t < -2.9999999999999999e-81Initial program 68.9%
Taylor expanded in b around inf
Applied rewrites45.1%
Taylor expanded in z around 0
Applied rewrites42.1%
if -2.9999999999999999e-81 < t < 5.9000000000000001e-137Initial program 81.6%
Taylor expanded in y around inf
Applied rewrites54.0%
Taylor expanded in x around inf
Applied rewrites34.5%
if 5.9000000000000001e-137 < t < 2.8999999999999998e-93Initial program 79.9%
Taylor expanded in b around inf
Applied rewrites61.9%
Taylor expanded in z around 0
Applied rewrites61.9%
if 2.8999999999999998e-93 < t Initial program 72.7%
Taylor expanded in j around inf
Applied rewrites38.1%
Taylor expanded in y around 0
Applied rewrites30.0%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= t -3.8e+71) (not (<= t 1.1e-68))) (* (fma (- a) x (* j c)) t) (* (fma z x (* (- j) i)) y)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((t <= -3.8e+71) || !(t <= 1.1e-68)) {
tmp = fma(-a, x, (j * c)) * t;
} else {
tmp = fma(z, x, (-j * i)) * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((t <= -3.8e+71) || !(t <= 1.1e-68)) tmp = Float64(fma(Float64(-a), x, Float64(j * c)) * t); else tmp = Float64(fma(z, x, Float64(Float64(-j) * i)) * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[t, -3.8e+71], N[Not[LessEqual[t, 1.1e-68]], $MachinePrecision]], N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], N[(N[(z * x + N[((-j) * i), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+71} \lor \neg \left(t \leq 1.1 \cdot 10^{-68}\right):\\
\;\;\;\;\mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, x, \left(-j\right) \cdot i\right) \cdot y\\
\end{array}
\end{array}
if t < -3.8000000000000001e71 or 1.10000000000000001e-68 < t Initial program 68.3%
Taylor expanded in t around inf
Applied rewrites63.2%
if -3.8000000000000001e71 < t < 1.10000000000000001e-68Initial program 77.9%
Taylor expanded in y around inf
Applied rewrites51.2%
Applied rewrites51.9%
Final simplification57.3%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= t -8e+76) (* (* j t) c) (if (<= t 2.05e+46) (* (fma z x (* (- j) i)) y) (* (* (- t) a) x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (t <= -8e+76) {
tmp = (j * t) * c;
} else if (t <= 2.05e+46) {
tmp = fma(z, x, (-j * i)) * y;
} else {
tmp = (-t * a) * x;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (t <= -8e+76) tmp = Float64(Float64(j * t) * c); elseif (t <= 2.05e+46) tmp = Float64(fma(z, x, Float64(Float64(-j) * i)) * y); else tmp = Float64(Float64(Float64(-t) * a) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[t, -8e+76], N[(N[(j * t), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[t, 2.05e+46], N[(N[(z * x + N[((-j) * i), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[((-t) * a), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+76}:\\
\;\;\;\;\left(j \cdot t\right) \cdot c\\
\mathbf{elif}\;t \leq 2.05 \cdot 10^{+46}:\\
\;\;\;\;\mathsf{fma}\left(z, x, \left(-j\right) \cdot i\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-t\right) \cdot a\right) \cdot x\\
\end{array}
\end{array}
if t < -8.0000000000000004e76Initial program 61.9%
Taylor expanded in c around inf
Applied rewrites62.2%
Taylor expanded in z around 0
Applied rewrites50.3%
if -8.0000000000000004e76 < t < 2.05e46Initial program 77.8%
Taylor expanded in y around inf
Applied rewrites48.4%
Applied rewrites49.0%
if 2.05e46 < t Initial program 71.0%
Taylor expanded in x around inf
Applied rewrites55.9%
Taylor expanded in y around 0
Applied rewrites46.9%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* z x) y)))
(if (<= x -1.2e+17)
t_1
(if (<= x -1.06e-273)
(* (* i a) b)
(if (<= x 6.1e-33) (* (* c t) 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 = (z * x) * y;
double tmp;
if (x <= -1.2e+17) {
tmp = t_1;
} else if (x <= -1.06e-273) {
tmp = (i * a) * b;
} else if (x <= 6.1e-33) {
tmp = (c * t) * j;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
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 = (z * x) * y
if (x <= (-1.2d+17)) then
tmp = t_1
else if (x <= (-1.06d-273)) then
tmp = (i * a) * b
else if (x <= 6.1d-33) then
tmp = (c * t) * j
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (z * x) * y;
double tmp;
if (x <= -1.2e+17) {
tmp = t_1;
} else if (x <= -1.06e-273) {
tmp = (i * a) * b;
} else if (x <= 6.1e-33) {
tmp = (c * t) * j;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (z * x) * y tmp = 0 if x <= -1.2e+17: tmp = t_1 elif x <= -1.06e-273: tmp = (i * a) * b elif x <= 6.1e-33: tmp = (c * t) * j else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(z * x) * y) tmp = 0.0 if (x <= -1.2e+17) tmp = t_1; elseif (x <= -1.06e-273) tmp = Float64(Float64(i * a) * b); elseif (x <= 6.1e-33) tmp = Float64(Float64(c * t) * j); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (z * x) * y; tmp = 0.0; if (x <= -1.2e+17) tmp = t_1; elseif (x <= -1.06e-273) tmp = (i * a) * b; elseif (x <= 6.1e-33) tmp = (c * t) * j; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[x, -1.2e+17], t$95$1, If[LessEqual[x, -1.06e-273], N[(N[(i * a), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[x, 6.1e-33], N[(N[(c * t), $MachinePrecision] * j), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot x\right) \cdot y\\
\mathbf{if}\;x \leq -1.2 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.06 \cdot 10^{-273}:\\
\;\;\;\;\left(i \cdot a\right) \cdot b\\
\mathbf{elif}\;x \leq 6.1 \cdot 10^{-33}:\\
\;\;\;\;\left(c \cdot t\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.2e17 or 6.1000000000000001e-33 < x Initial program 73.9%
Taylor expanded in y around inf
Applied rewrites46.7%
Taylor expanded in x around inf
Applied rewrites39.2%
if -1.2e17 < x < -1.0600000000000001e-273Initial program 79.4%
Taylor expanded in b around inf
Applied rewrites49.9%
Taylor expanded in z around 0
Applied rewrites32.0%
if -1.0600000000000001e-273 < x < 6.1000000000000001e-33Initial program 66.7%
Taylor expanded in j around inf
Applied rewrites51.4%
Taylor expanded in y around 0
Applied rewrites34.4%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= x -1.2e+17)
(* (* z y) x)
(if (<= x -1.06e-273)
(* (* i a) b)
(if (<= x 6.1e-33) (* (* c t) 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 (x <= -1.2e+17) {
tmp = (z * y) * x;
} else if (x <= -1.06e-273) {
tmp = (i * a) * b;
} else if (x <= 6.1e-33) {
tmp = (c * t) * 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 (x <= (-1.2d+17)) then
tmp = (z * y) * x
else if (x <= (-1.06d-273)) then
tmp = (i * a) * b
else if (x <= 6.1d-33) then
tmp = (c * t) * 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 (x <= -1.2e+17) {
tmp = (z * y) * x;
} else if (x <= -1.06e-273) {
tmp = (i * a) * b;
} else if (x <= 6.1e-33) {
tmp = (c * t) * j;
} else {
tmp = (y * x) * z;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if x <= -1.2e+17: tmp = (z * y) * x elif x <= -1.06e-273: tmp = (i * a) * b elif x <= 6.1e-33: tmp = (c * t) * j else: tmp = (y * x) * z return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -1.2e+17) tmp = Float64(Float64(z * y) * x); elseif (x <= -1.06e-273) tmp = Float64(Float64(i * a) * b); elseif (x <= 6.1e-33) tmp = Float64(Float64(c * t) * 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 (x <= -1.2e+17) tmp = (z * y) * x; elseif (x <= -1.06e-273) tmp = (i * a) * b; elseif (x <= 6.1e-33) tmp = (c * t) * j; else tmp = (y * x) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -1.2e+17], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, -1.06e-273], N[(N[(i * a), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[x, 6.1e-33], N[(N[(c * t), $MachinePrecision] * j), $MachinePrecision], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{+17}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{elif}\;x \leq -1.06 \cdot 10^{-273}:\\
\;\;\;\;\left(i \cdot a\right) \cdot b\\
\mathbf{elif}\;x \leq 6.1 \cdot 10^{-33}:\\
\;\;\;\;\left(c \cdot t\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\end{array}
\end{array}
if x < -1.2e17Initial program 77.0%
Taylor expanded in x around inf
Applied rewrites71.1%
Taylor expanded in y around inf
Applied rewrites38.9%
if -1.2e17 < x < -1.0600000000000001e-273Initial program 79.4%
Taylor expanded in b around inf
Applied rewrites49.9%
Taylor expanded in z around 0
Applied rewrites32.0%
if -1.0600000000000001e-273 < x < 6.1000000000000001e-33Initial program 66.7%
Taylor expanded in j around inf
Applied rewrites51.4%
Taylor expanded in y around 0
Applied rewrites34.4%
if 6.1000000000000001e-33 < x Initial program 71.8%
Taylor expanded in x around inf
Applied rewrites64.0%
Taylor expanded in t around inf
Applied rewrites65.2%
Taylor expanded in y around inf
Applied rewrites37.4%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= x -7e+90) (not (<= x 1.85e-60))) (* (* y x) z) (* (* i b) a)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((x <= -7e+90) || !(x <= 1.85e-60)) {
tmp = (y * x) * z;
} else {
tmp = (i * b) * 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 ((x <= (-7d+90)) .or. (.not. (x <= 1.85d-60))) then
tmp = (y * x) * z
else
tmp = (i * b) * 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 ((x <= -7e+90) || !(x <= 1.85e-60)) {
tmp = (y * x) * z;
} else {
tmp = (i * b) * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (x <= -7e+90) or not (x <= 1.85e-60): tmp = (y * x) * z else: tmp = (i * b) * a return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((x <= -7e+90) || !(x <= 1.85e-60)) tmp = Float64(Float64(y * x) * z); else tmp = Float64(Float64(i * b) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((x <= -7e+90) || ~((x <= 1.85e-60))) tmp = (y * x) * z; else tmp = (i * b) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[x, -7e+90], N[Not[LessEqual[x, 1.85e-60]], $MachinePrecision]], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision], N[(N[(i * b), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{+90} \lor \neg \left(x \leq 1.85 \cdot 10^{-60}\right):\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot b\right) \cdot a\\
\end{array}
\end{array}
if x < -6.9999999999999997e90 or 1.85000000000000012e-60 < x Initial program 72.9%
Taylor expanded in x around inf
Applied rewrites65.9%
Taylor expanded in t around inf
Applied rewrites66.6%
Taylor expanded in y around inf
Applied rewrites36.7%
if -6.9999999999999997e90 < x < 1.85000000000000012e-60Initial program 73.7%
Taylor expanded in b around inf
Applied rewrites49.1%
Taylor expanded in z around 0
Applied rewrites27.1%
Final simplification31.6%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= z -1.45e+138) (* (* z y) x) (if (<= z 1e-81) (* (* i a) b) (* (* 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 (z <= -1.45e+138) {
tmp = (z * y) * x;
} else if (z <= 1e-81) {
tmp = (i * a) * b;
} 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 (z <= (-1.45d+138)) then
tmp = (z * y) * x
else if (z <= 1d-81) then
tmp = (i * a) * b
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 (z <= -1.45e+138) {
tmp = (z * y) * x;
} else if (z <= 1e-81) {
tmp = (i * a) * b;
} else {
tmp = (y * x) * z;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if z <= -1.45e+138: tmp = (z * y) * x elif z <= 1e-81: tmp = (i * a) * b else: tmp = (y * x) * z return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (z <= -1.45e+138) tmp = Float64(Float64(z * y) * x); elseif (z <= 1e-81) tmp = Float64(Float64(i * a) * b); 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 (z <= -1.45e+138) tmp = (z * y) * x; elseif (z <= 1e-81) tmp = (i * a) * b; else tmp = (y * x) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[z, -1.45e+138], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 1e-81], N[(N[(i * a), $MachinePrecision] * b), $MachinePrecision], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+138}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{elif}\;z \leq 10^{-81}:\\
\;\;\;\;\left(i \cdot a\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\end{array}
\end{array}
if z < -1.45000000000000005e138Initial program 64.6%
Taylor expanded in x around inf
Applied rewrites63.3%
Taylor expanded in y around inf
Applied rewrites60.3%
if -1.45000000000000005e138 < z < 9.9999999999999996e-82Initial program 74.5%
Taylor expanded in b around inf
Applied rewrites37.4%
Taylor expanded in z around 0
Applied rewrites30.8%
if 9.9999999999999996e-82 < z Initial program 75.0%
Taylor expanded in x around inf
Applied rewrites40.9%
Taylor expanded in t around inf
Applied rewrites43.5%
Taylor expanded in y around inf
Applied rewrites25.9%
(FPCore (x y z t a b c i j) :precision binary64 (if (<= x -5.7e+90) (* (* z y) x) (if (<= x 1.85e-60) (* (* i b) a) (* (* 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 (x <= -5.7e+90) {
tmp = (z * y) * x;
} else if (x <= 1.85e-60) {
tmp = (i * b) * a;
} 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 (x <= (-5.7d+90)) then
tmp = (z * y) * x
else if (x <= 1.85d-60) then
tmp = (i * b) * a
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 (x <= -5.7e+90) {
tmp = (z * y) * x;
} else if (x <= 1.85e-60) {
tmp = (i * b) * a;
} else {
tmp = (y * x) * z;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if x <= -5.7e+90: tmp = (z * y) * x elif x <= 1.85e-60: tmp = (i * b) * a else: tmp = (y * x) * z return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -5.7e+90) tmp = Float64(Float64(z * y) * x); elseif (x <= 1.85e-60) tmp = Float64(Float64(i * b) * a); 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 (x <= -5.7e+90) tmp = (z * y) * x; elseif (x <= 1.85e-60) tmp = (i * b) * a; else tmp = (y * x) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -5.7e+90], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 1.85e-60], N[(N[(i * b), $MachinePrecision] * a), $MachinePrecision], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.7 \cdot 10^{+90}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-60}:\\
\;\;\;\;\left(i \cdot b\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\
\end{array}
\end{array}
if x < -5.70000000000000018e90Initial program 73.8%
Taylor expanded in x around inf
Applied rewrites72.1%
Taylor expanded in y around inf
Applied rewrites41.7%
if -5.70000000000000018e90 < x < 1.85000000000000012e-60Initial program 73.7%
Taylor expanded in b around inf
Applied rewrites49.1%
Taylor expanded in z around 0
Applied rewrites27.1%
if 1.85000000000000012e-60 < x Initial program 72.4%
Taylor expanded in x around inf
Applied rewrites62.4%
Taylor expanded in t around inf
Applied rewrites63.6%
Taylor expanded in y around inf
Applied rewrites35.1%
(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 73.3%
Taylor expanded in x around inf
Applied rewrites40.4%
Taylor expanded in t around inf
Applied rewrites41.4%
Taylor expanded in y around inf
Applied rewrites22.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a))))
(/
(* j (- (pow (* c t) 2.0) (pow (* i y) 2.0)))
(+ (* c t) (* i y)))))
(t_2
(-
(* x (- (* z y) (* a t)))
(- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j)))))
(if (< t -8.120978919195912e-33)
t_2
(if (< t -4.712553818218485e-169)
t_1
(if (< t -7.633533346031584e-308)
t_2
(if (< t 1.0535888557455487e-139) 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 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (pow((c * t), 2.0) - pow((i * y), 2.0))) / ((c * t) + (i * y)));
double t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j));
double tmp;
if (t < -8.120978919195912e-33) {
tmp = t_2;
} else if (t < -4.712553818218485e-169) {
tmp = t_1;
} else if (t < -7.633533346031584e-308) {
tmp = t_2;
} else if (t < 1.0535888557455487e-139) {
tmp = 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 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (((c * t) ** 2.0d0) - ((i * y) ** 2.0d0))) / ((c * t) + (i * y)))
t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j))
if (t < (-8.120978919195912d-33)) then
tmp = t_2
else if (t < (-4.712553818218485d-169)) then
tmp = t_1
else if (t < (-7.633533346031584d-308)) then
tmp = t_2
else if (t < 1.0535888557455487d-139) then
tmp = 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 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (Math.pow((c * t), 2.0) - Math.pow((i * y), 2.0))) / ((c * t) + (i * y)));
double t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j));
double tmp;
if (t < -8.120978919195912e-33) {
tmp = t_2;
} else if (t < -4.712553818218485e-169) {
tmp = t_1;
} else if (t < -7.633533346031584e-308) {
tmp = t_2;
} else if (t < 1.0535888557455487e-139) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (math.pow((c * t), 2.0) - math.pow((i * y), 2.0))) / ((c * t) + (i * y))) t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j)) tmp = 0 if t < -8.120978919195912e-33: tmp = t_2 elif t < -4.712553818218485e-169: tmp = t_1 elif t < -7.633533346031584e-308: tmp = t_2 elif t < 1.0535888557455487e-139: tmp = t_1 else: tmp = t_2 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(i * a)))) + Float64(Float64(j * Float64((Float64(c * t) ^ 2.0) - (Float64(i * y) ^ 2.0))) / Float64(Float64(c * t) + Float64(i * y)))) t_2 = Float64(Float64(x * Float64(Float64(z * y) - Float64(a * t))) - Float64(Float64(b * Float64(Float64(z * c) - Float64(a * i))) - Float64(Float64(Float64(c * t) - Float64(y * i)) * j))) tmp = 0.0 if (t < -8.120978919195912e-33) tmp = t_2; elseif (t < -4.712553818218485e-169) tmp = t_1; elseif (t < -7.633533346031584e-308) tmp = t_2; elseif (t < 1.0535888557455487e-139) tmp = 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 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (((c * t) ^ 2.0) - ((i * y) ^ 2.0))) / ((c * t) + (i * y))); t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j)); tmp = 0.0; if (t < -8.120978919195912e-33) tmp = t_2; elseif (t < -4.712553818218485e-169) tmp = t_1; elseif (t < -7.633533346031584e-308) tmp = t_2; elseif (t < 1.0535888557455487e-139) tmp = 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[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(j * N[(N[Power[N[(c * t), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[(i * y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(c * t), $MachinePrecision] + N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[(N[(z * y), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(b * N[(N[(z * c), $MachinePrecision] - N[(a * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(c * t), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -8.120978919195912e-33], t$95$2, If[Less[t, -4.712553818218485e-169], t$95$1, If[Less[t, -7.633533346031584e-308], t$95$2, If[Less[t, 1.0535888557455487e-139], t$95$1, t$95$2]]]]]]
\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 - i \cdot a\right)\right) + \frac{j \cdot \left({\left(c \cdot t\right)}^{2} - {\left(i \cdot y\right)}^{2}\right)}{c \cdot t + i \cdot y}\\
t_2 := x \cdot \left(z \cdot y - a \cdot t\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) - \left(c \cdot t - y \cdot i\right) \cdot j\right)\\
\mathbf{if}\;t < -8.120978919195912 \cdot 10^{-33}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t < -4.712553818218485 \cdot 10^{-169}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t < -7.633533346031584 \cdot 10^{-308}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t < 1.0535888557455487 \cdot 10^{-139}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2025018
(FPCore (x y z t a b c i j)
:name "Linear.Matrix:det33 from linear-1.19.1.3"
:precision binary64
:alt
(! :herbie-platform default (if (< t -1015122364899489/125000000000000000000000000000000000000000000000) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t -942510763643697/2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2) (pow (* i y) 2))) (+ (* c t) (* i y)))) (if (< t -238547917063487/3125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t 10535888557455487/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2) (pow (* i y) 2))) (+ (* c t) (* i y)))) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))))))))
(+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))