
(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 17 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
(let* ((t_1
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a))))
(* j (- (* c t) (* i y))))))
(if (<= t_1 INFINITY) t_1 (fma (* b a) i (* (fma (- a) t (* z y)) x)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma((b * a), i, (fma(-a, t, (z * y)) * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(i * a)))) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(Float64(b * a), i, Float64(fma(Float64(-a), t, Float64(z * y)) * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(b * a), $MachinePrecision] * i + N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot a, i, \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y)))) < +inf.0Initial program 91.6%
if +inf.0 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y)))) Initial program 0.0%
Taylor expanded in c around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sign-subN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-lft-identityN/A
metadata-evalN/A
distribute-rgt-inN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
Applied rewrites46.6%
Taylor expanded in y around 0
Applied rewrites52.4%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (fma (- y) j (* b a)) i (* (fma (- a) t (* z y)) x)))
(t_2 (* (fma (- b) c (* y x)) z)))
(if (<= z -1.95e+177)
t_2
(if (<= z 3.4e-279)
t_1
(if (<= z 4.5e-83)
(fma (* i a) b (* (fma (- a) x (* j c)) t))
(if (<= z 5.5e+164) 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(fma(-y, j, (b * a)), i, (fma(-a, t, (z * y)) * x));
double t_2 = fma(-b, c, (y * x)) * z;
double tmp;
if (z <= -1.95e+177) {
tmp = t_2;
} else if (z <= 3.4e-279) {
tmp = t_1;
} else if (z <= 4.5e-83) {
tmp = fma((i * a), b, (fma(-a, x, (j * c)) * t));
} else if (z <= 5.5e+164) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(fma(Float64(-y), j, Float64(b * a)), i, 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 <= -1.95e+177) tmp = t_2; elseif (z <= 3.4e-279) tmp = t_1; elseif (z <= 4.5e-83) tmp = fma(Float64(i * a), b, Float64(fma(Float64(-a), x, Float64(j * c)) * t)); elseif (z <= 5.5e+164) 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[((-y) * j + N[(b * a), $MachinePrecision]), $MachinePrecision] * i + N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1.95e+177], t$95$2, If[LessEqual[z, 3.4e-279], t$95$1, If[LessEqual[z, 4.5e-83], N[(N[(i * a), $MachinePrecision] * b + N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.5e+164], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(-y, j, b \cdot a\right), i, \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right)\\
t_2 := \mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{if}\;z \leq -1.95 \cdot 10^{+177}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{-279}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-83}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot a, b, \mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\right)\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{+164}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -1.95e177 or 5.4999999999999998e164 < z Initial program 55.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6477.7
Applied rewrites77.7%
if -1.95e177 < z < 3.40000000000000015e-279 or 4.49999999999999997e-83 < z < 5.4999999999999998e164Initial program 78.5%
Taylor expanded in c around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sign-subN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-lft-identityN/A
metadata-evalN/A
distribute-rgt-inN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
Applied rewrites71.4%
if 3.40000000000000015e-279 < z < 4.49999999999999997e-83Initial program 80.4%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites91.9%
Taylor expanded in z around 0
Applied rewrites86.5%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (fma (- z) c (* i a)) b (* (fma (- a) x (* j c)) t))))
(if (<= b -1.55e-34)
t_1
(if (<= b -9e-185)
(+ (* (* z x) y) (* j (- (* c t) (* i y))))
(if (<= b 940000.0)
(fma (fma (- y) j (* b a)) i (* (fma (- a) t (* 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(fma(-z, c, (i * a)), b, (fma(-a, x, (j * c)) * t));
double tmp;
if (b <= -1.55e-34) {
tmp = t_1;
} else if (b <= -9e-185) {
tmp = ((z * x) * y) + (j * ((c * t) - (i * y)));
} else if (b <= 940000.0) {
tmp = fma(fma(-y, j, (b * a)), i, (fma(-a, t, (z * y)) * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(fma(Float64(-z), c, Float64(i * a)), b, Float64(fma(Float64(-a), x, Float64(j * c)) * t)) tmp = 0.0 if (b <= -1.55e-34) tmp = t_1; elseif (b <= -9e-185) tmp = Float64(Float64(Float64(z * x) * y) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))); elseif (b <= 940000.0) tmp = fma(fma(Float64(-y), j, Float64(b * a)), i, Float64(fma(Float64(-a), t, 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[((-z) * c + N[(i * a), $MachinePrecision]), $MachinePrecision] * b + N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.55e-34], t$95$1, If[LessEqual[b, -9e-185], N[(N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 940000.0], N[(N[((-y) * j + N[(b * a), $MachinePrecision]), $MachinePrecision] * i + N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(-z, c, i \cdot a\right), b, \mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\right)\\
\mathbf{if}\;b \leq -1.55 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq -9 \cdot 10^{-185}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y + j \cdot \left(c \cdot t - i \cdot y\right)\\
\mathbf{elif}\;b \leq 940000:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-y, j, b \cdot a\right), i, \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.5499999999999999e-34 or 9.4e5 < b Initial program 74.2%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites74.1%
if -1.5499999999999999e-34 < b < -9.0000000000000003e-185Initial program 65.1%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.9
Applied rewrites78.9%
if -9.0000000000000003e-185 < b < 9.4e5Initial program 73.7%
Taylor expanded in c around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sign-subN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-lft-identityN/A
metadata-evalN/A
distribute-rgt-inN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
Applied rewrites74.9%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- b) c (* y x)) z)))
(if (<= z -2.2e+231)
t_1
(if (<= z -15200000.0)
(fma (* b a) i (* (fma (- a) t (* z y)) x))
(if (<= z 1.25e+112)
(fma (* i a) b (* (fma (- a) x (* j c)) t))
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.2e+231) {
tmp = t_1;
} else if (z <= -15200000.0) {
tmp = fma((b * a), i, (fma(-a, t, (z * y)) * x));
} else if (z <= 1.25e+112) {
tmp = fma((i * a), b, (fma(-a, x, (j * c)) * t));
} 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.2e+231) tmp = t_1; elseif (z <= -15200000.0) tmp = fma(Float64(b * a), i, Float64(fma(Float64(-a), t, Float64(z * y)) * x)); elseif (z <= 1.25e+112) tmp = fma(Float64(i * a), b, Float64(fma(Float64(-a), x, Float64(j * c)) * t)); 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.2e+231], t$95$1, If[LessEqual[z, -15200000.0], N[(N[(b * a), $MachinePrecision] * i + N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.25e+112], N[(N[(i * a), $MachinePrecision] * b + N[(N[((-a) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * t), $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.2 \cdot 10^{+231}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -15200000:\\
\;\;\;\;\mathsf{fma}\left(b \cdot a, i, \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right)\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+112}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot a, b, \mathsf{fma}\left(-a, x, j \cdot c\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.19999999999999992e231 or 1.25e112 < z Initial program 49.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6479.2
Applied rewrites79.2%
if -2.19999999999999992e231 < z < -1.52e7Initial program 64.8%
Taylor expanded in c around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sign-subN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-lft-identityN/A
metadata-evalN/A
distribute-rgt-inN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
Applied rewrites71.9%
Taylor expanded in y around 0
Applied rewrites69.7%
if -1.52e7 < z < 1.25e112Initial program 84.4%
Taylor expanded in y around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites69.0%
Taylor expanded in z around 0
Applied rewrites64.8%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= j -7.4e-13) (not (<= j 2.3e+26))) (+ (* (* (- z) b) c) (* j (- (* c t) (* i y)))) (fma (* b a) i (* (fma (- a) t (* z y)) x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((j <= -7.4e-13) || !(j <= 2.3e+26)) {
tmp = ((-z * b) * c) + (j * ((c * t) - (i * y)));
} else {
tmp = fma((b * a), i, (fma(-a, t, (z * y)) * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((j <= -7.4e-13) || !(j <= 2.3e+26)) tmp = Float64(Float64(Float64(Float64(-z) * b) * c) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))); else tmp = fma(Float64(b * a), i, Float64(fma(Float64(-a), t, Float64(z * y)) * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[j, -7.4e-13], N[Not[LessEqual[j, 2.3e+26]], $MachinePrecision]], N[(N[(N[((-z) * b), $MachinePrecision] * c), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * a), $MachinePrecision] * i + N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;j \leq -7.4 \cdot 10^{-13} \lor \neg \left(j \leq 2.3 \cdot 10^{+26}\right):\\
\;\;\;\;\left(\left(-z\right) \cdot b\right) \cdot c + j \cdot \left(c \cdot t - i \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot a, i, \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right)\\
\end{array}
\end{array}
if j < -7.39999999999999977e-13 or 2.3000000000000001e26 < j Initial program 69.8%
Taylor expanded in c around inf
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6469.2
Applied rewrites69.2%
if -7.39999999999999977e-13 < j < 2.3000000000000001e26Initial program 76.1%
Taylor expanded in c around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sign-subN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-lft-identityN/A
metadata-evalN/A
distribute-rgt-inN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
Applied rewrites72.8%
Taylor expanded in y around 0
Applied rewrites69.8%
Final simplification69.5%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= j -5.1e+32) (not (<= j 2.85e+62))) (+ (* (* z x) y) (* j (- (* c t) (* i y)))) (fma (* b a) i (* (fma (- a) t (* z y)) x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((j <= -5.1e+32) || !(j <= 2.85e+62)) {
tmp = ((z * x) * y) + (j * ((c * t) - (i * y)));
} else {
tmp = fma((b * a), i, (fma(-a, t, (z * y)) * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((j <= -5.1e+32) || !(j <= 2.85e+62)) tmp = Float64(Float64(Float64(z * x) * y) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))); else tmp = fma(Float64(b * a), i, Float64(fma(Float64(-a), t, Float64(z * y)) * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[j, -5.1e+32], N[Not[LessEqual[j, 2.85e+62]], $MachinePrecision]], N[(N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * a), $MachinePrecision] * i + N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;j \leq -5.1 \cdot 10^{+32} \lor \neg \left(j \leq 2.85 \cdot 10^{+62}\right):\\
\;\;\;\;\left(z \cdot x\right) \cdot y + j \cdot \left(c \cdot t - i \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot a, i, \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right)\\
\end{array}
\end{array}
if j < -5.10000000000000004e32 or 2.84999999999999999e62 < j Initial program 68.7%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.4
Applied rewrites68.4%
if -5.10000000000000004e32 < j < 2.84999999999999999e62Initial program 76.6%
Taylor expanded in c around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sign-subN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-lft-identityN/A
metadata-evalN/A
distribute-rgt-inN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
Applied rewrites70.3%
Taylor expanded in y around 0
Applied rewrites67.6%
Final simplification68.0%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* c j) t)))
(if (<= j -7.1e+210)
t_1
(if (<= j -4.8e+155)
(* (* (- i) y) j)
(if (<= j -3.25e+35)
t_1
(if (<= j 6.8e-237)
(* (* z x) y)
(if (<= j 1.3e+24) (* (* (- x) a) t) 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 = (c * j) * t;
double tmp;
if (j <= -7.1e+210) {
tmp = t_1;
} else if (j <= -4.8e+155) {
tmp = (-i * y) * j;
} else if (j <= -3.25e+35) {
tmp = t_1;
} else if (j <= 6.8e-237) {
tmp = (z * x) * y;
} else if (j <= 1.3e+24) {
tmp = (-x * a) * t;
} 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 = (c * j) * t
if (j <= (-7.1d+210)) then
tmp = t_1
else if (j <= (-4.8d+155)) then
tmp = (-i * y) * j
else if (j <= (-3.25d+35)) then
tmp = t_1
else if (j <= 6.8d-237) then
tmp = (z * x) * y
else if (j <= 1.3d+24) then
tmp = (-x * a) * t
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 = (c * j) * t;
double tmp;
if (j <= -7.1e+210) {
tmp = t_1;
} else if (j <= -4.8e+155) {
tmp = (-i * y) * j;
} else if (j <= -3.25e+35) {
tmp = t_1;
} else if (j <= 6.8e-237) {
tmp = (z * x) * y;
} else if (j <= 1.3e+24) {
tmp = (-x * a) * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (c * j) * t tmp = 0 if j <= -7.1e+210: tmp = t_1 elif j <= -4.8e+155: tmp = (-i * y) * j elif j <= -3.25e+35: tmp = t_1 elif j <= 6.8e-237: tmp = (z * x) * y elif j <= 1.3e+24: tmp = (-x * a) * t else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(c * j) * t) tmp = 0.0 if (j <= -7.1e+210) tmp = t_1; elseif (j <= -4.8e+155) tmp = Float64(Float64(Float64(-i) * y) * j); elseif (j <= -3.25e+35) tmp = t_1; elseif (j <= 6.8e-237) tmp = Float64(Float64(z * x) * y); elseif (j <= 1.3e+24) tmp = Float64(Float64(Float64(-x) * a) * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (c * j) * t; tmp = 0.0; if (j <= -7.1e+210) tmp = t_1; elseif (j <= -4.8e+155) tmp = (-i * y) * j; elseif (j <= -3.25e+35) tmp = t_1; elseif (j <= 6.8e-237) tmp = (z * x) * y; elseif (j <= 1.3e+24) tmp = (-x * a) * t; 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[(c * j), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[j, -7.1e+210], t$95$1, If[LessEqual[j, -4.8e+155], N[(N[((-i) * y), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[j, -3.25e+35], t$95$1, If[LessEqual[j, 6.8e-237], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[j, 1.3e+24], N[(N[((-x) * a), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(c \cdot j\right) \cdot t\\
\mathbf{if}\;j \leq -7.1 \cdot 10^{+210}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;j \leq -4.8 \cdot 10^{+155}:\\
\;\;\;\;\left(\left(-i\right) \cdot y\right) \cdot j\\
\mathbf{elif}\;j \leq -3.25 \cdot 10^{+35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;j \leq 6.8 \cdot 10^{-237}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\mathbf{elif}\;j \leq 1.3 \cdot 10^{+24}:\\
\;\;\;\;\left(\left(-x\right) \cdot a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if j < -7.10000000000000023e210 or -4.80000000000000042e155 < j < -3.2500000000000002e35 or 1.2999999999999999e24 < j Initial program 69.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6453.6
Applied rewrites53.6%
Taylor expanded in x around 0
Applied rewrites44.3%
if -7.10000000000000023e210 < j < -4.80000000000000042e155Initial program 60.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6466.8
Applied rewrites66.8%
Taylor expanded in x around 0
Applied rewrites70.4%
if -3.2500000000000002e35 < j < 6.8000000000000005e-237Initial program 73.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6440.1
Applied rewrites40.1%
Taylor expanded in x around inf
Applied rewrites36.6%
if 6.8000000000000005e-237 < j < 1.2999999999999999e24Initial program 82.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6454.7
Applied rewrites54.7%
Taylor expanded in x around inf
Applied rewrites45.1%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= j -3e+35) (not (<= j 4.8e+62))) (* (fma t c (* (- i) y)) j) (fma (* b a) i (* (fma (- a) t (* z y)) x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((j <= -3e+35) || !(j <= 4.8e+62)) {
tmp = fma(t, c, (-i * y)) * j;
} else {
tmp = fma((b * a), i, (fma(-a, t, (z * y)) * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((j <= -3e+35) || !(j <= 4.8e+62)) tmp = Float64(fma(t, c, Float64(Float64(-i) * y)) * j); else tmp = fma(Float64(b * a), i, Float64(fma(Float64(-a), t, Float64(z * y)) * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[j, -3e+35], N[Not[LessEqual[j, 4.8e+62]], $MachinePrecision]], N[(N[(t * c + N[((-i) * y), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], N[(N[(b * a), $MachinePrecision] * i + N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;j \leq -3 \cdot 10^{+35} \lor \neg \left(j \leq 4.8 \cdot 10^{+62}\right):\\
\;\;\;\;\mathsf{fma}\left(t, c, \left(-i\right) \cdot y\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot a, i, \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right)\\
\end{array}
\end{array}
if j < -2.99999999999999991e35 or 4.8e62 < j Initial program 68.7%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f6451.0
Applied rewrites51.0%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6466.9
Applied rewrites66.9%
if -2.99999999999999991e35 < j < 4.8e62Initial program 76.6%
Taylor expanded in c around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sign-subN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-lft-identityN/A
metadata-evalN/A
distribute-rgt-inN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
Applied rewrites70.3%
Taylor expanded in y around 0
Applied rewrites67.6%
Final simplification67.3%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* z x) y)))
(if (<= z -4.1e+18)
t_1
(if (<= z -4.2e-251)
(* (* (- i) y) j)
(if (<= z 5.8e+82)
(* (* c t) j)
(if (<= z 2.2e+242) 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 = (z * x) * y;
double tmp;
if (z <= -4.1e+18) {
tmp = t_1;
} else if (z <= -4.2e-251) {
tmp = (-i * y) * j;
} else if (z <= 5.8e+82) {
tmp = (c * t) * j;
} else if (z <= 2.2e+242) {
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 = (z * x) * y
if (z <= (-4.1d+18)) then
tmp = t_1
else if (z <= (-4.2d-251)) then
tmp = (-i * y) * j
else if (z <= 5.8d+82) then
tmp = (c * t) * j
else if (z <= 2.2d+242) 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 = (z * x) * y;
double tmp;
if (z <= -4.1e+18) {
tmp = t_1;
} else if (z <= -4.2e-251) {
tmp = (-i * y) * j;
} else if (z <= 5.8e+82) {
tmp = (c * t) * j;
} else if (z <= 2.2e+242) {
tmp = t_1;
} else {
tmp = (-z * b) * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (z * x) * y tmp = 0 if z <= -4.1e+18: tmp = t_1 elif z <= -4.2e-251: tmp = (-i * y) * j elif z <= 5.8e+82: tmp = (c * t) * j elif z <= 2.2e+242: 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(z * x) * y) tmp = 0.0 if (z <= -4.1e+18) tmp = t_1; elseif (z <= -4.2e-251) tmp = Float64(Float64(Float64(-i) * y) * j); elseif (z <= 5.8e+82) tmp = Float64(Float64(c * t) * j); elseif (z <= 2.2e+242) 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 = (z * x) * y; tmp = 0.0; if (z <= -4.1e+18) tmp = t_1; elseif (z <= -4.2e-251) tmp = (-i * y) * j; elseif (z <= 5.8e+82) tmp = (c * t) * j; elseif (z <= 2.2e+242) 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[(z * x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[z, -4.1e+18], t$95$1, If[LessEqual[z, -4.2e-251], N[(N[((-i) * y), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[z, 5.8e+82], N[(N[(c * t), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[z, 2.2e+242], t$95$1, N[(N[((-z) * b), $MachinePrecision] * c), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot x\right) \cdot y\\
\mathbf{if}\;z \leq -4.1 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{-251}:\\
\;\;\;\;\left(\left(-i\right) \cdot y\right) \cdot j\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{+82}:\\
\;\;\;\;\left(c \cdot t\right) \cdot j\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+242}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-z\right) \cdot b\right) \cdot c\\
\end{array}
\end{array}
if z < -4.1e18 or 5.8000000000000003e82 < z < 2.19999999999999999e242Initial program 59.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6459.8
Applied rewrites59.8%
Taylor expanded in x around inf
Applied rewrites50.1%
if -4.1e18 < z < -4.19999999999999964e-251Initial program 90.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6439.9
Applied rewrites39.9%
Taylor expanded in x around 0
Applied rewrites33.6%
if -4.19999999999999964e-251 < z < 5.8000000000000003e82Initial program 81.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6451.6
Applied rewrites51.6%
Taylor expanded in x around 0
Applied rewrites29.2%
Applied rewrites31.2%
if 2.19999999999999999e242 < z Initial program 53.4%
Taylor expanded in b around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-lft-neg-inN/A
distribute-neg-inN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
lower-*.f64N/A
Applied rewrites45.1%
Taylor expanded in z around inf
Applied rewrites53.6%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* c j) t)))
(if (<= j -7.1e+210)
t_1
(if (<= j -4.8e+155)
(* (* (- i) y) j)
(if (or (<= j -3.25e+35) (not (<= j 2.6e-12))) t_1 (* (* z x) y))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (c * j) * t;
double tmp;
if (j <= -7.1e+210) {
tmp = t_1;
} else if (j <= -4.8e+155) {
tmp = (-i * y) * j;
} else if ((j <= -3.25e+35) || !(j <= 2.6e-12)) {
tmp = t_1;
} else {
tmp = (z * x) * y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: tmp
t_1 = (c * j) * t
if (j <= (-7.1d+210)) then
tmp = t_1
else if (j <= (-4.8d+155)) then
tmp = (-i * y) * j
else if ((j <= (-3.25d+35)) .or. (.not. (j <= 2.6d-12))) then
tmp = t_1
else
tmp = (z * x) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (c * j) * t;
double tmp;
if (j <= -7.1e+210) {
tmp = t_1;
} else if (j <= -4.8e+155) {
tmp = (-i * y) * j;
} else if ((j <= -3.25e+35) || !(j <= 2.6e-12)) {
tmp = t_1;
} else {
tmp = (z * x) * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (c * j) * t tmp = 0 if j <= -7.1e+210: tmp = t_1 elif j <= -4.8e+155: tmp = (-i * y) * j elif (j <= -3.25e+35) or not (j <= 2.6e-12): tmp = t_1 else: tmp = (z * x) * y return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(c * j) * t) tmp = 0.0 if (j <= -7.1e+210) tmp = t_1; elseif (j <= -4.8e+155) tmp = Float64(Float64(Float64(-i) * y) * j); elseif ((j <= -3.25e+35) || !(j <= 2.6e-12)) tmp = t_1; else tmp = Float64(Float64(z * x) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (c * j) * t; tmp = 0.0; if (j <= -7.1e+210) tmp = t_1; elseif (j <= -4.8e+155) tmp = (-i * y) * j; elseif ((j <= -3.25e+35) || ~((j <= 2.6e-12))) tmp = t_1; else tmp = (z * x) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(c * j), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[j, -7.1e+210], t$95$1, If[LessEqual[j, -4.8e+155], N[(N[((-i) * y), $MachinePrecision] * j), $MachinePrecision], If[Or[LessEqual[j, -3.25e+35], N[Not[LessEqual[j, 2.6e-12]], $MachinePrecision]], t$95$1, N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(c \cdot j\right) \cdot t\\
\mathbf{if}\;j \leq -7.1 \cdot 10^{+210}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;j \leq -4.8 \cdot 10^{+155}:\\
\;\;\;\;\left(\left(-i\right) \cdot y\right) \cdot j\\
\mathbf{elif}\;j \leq -3.25 \cdot 10^{+35} \lor \neg \left(j \leq 2.6 \cdot 10^{-12}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\end{array}
\end{array}
if j < -7.10000000000000023e210 or -4.80000000000000042e155 < j < -3.2500000000000002e35 or 2.59999999999999983e-12 < j Initial program 71.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6454.4
Applied rewrites54.4%
Taylor expanded in x around 0
Applied rewrites43.8%
if -7.10000000000000023e210 < j < -4.80000000000000042e155Initial program 60.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6466.8
Applied rewrites66.8%
Taylor expanded in x around 0
Applied rewrites70.4%
if -3.2500000000000002e35 < j < 2.59999999999999983e-12Initial program 76.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6436.0
Applied rewrites36.0%
Taylor expanded in x around inf
Applied rewrites32.9%
Final simplification40.0%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= j -2e+35) (not (<= j 4.1e+62))) (* (fma t c (* (- i) y)) j) (* (- (* z y) (* 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 ((j <= -2e+35) || !(j <= 4.1e+62)) {
tmp = fma(t, c, (-i * y)) * j;
} else {
tmp = ((z * y) - (a * t)) * x;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((j <= -2e+35) || !(j <= 4.1e+62)) tmp = Float64(fma(t, c, Float64(Float64(-i) * y)) * j); else tmp = Float64(Float64(Float64(z * y) - Float64(a * t)) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[j, -2e+35], N[Not[LessEqual[j, 4.1e+62]], $MachinePrecision]], N[(N[(t * c + N[((-i) * y), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;j \leq -2 \cdot 10^{+35} \lor \neg \left(j \leq 4.1 \cdot 10^{+62}\right):\\
\;\;\;\;\mathsf{fma}\left(t, c, \left(-i\right) \cdot y\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y - a \cdot t\right) \cdot x\\
\end{array}
\end{array}
if j < -1.9999999999999999e35 or 4.09999999999999984e62 < j Initial program 68.7%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f6451.0
Applied rewrites51.0%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6466.9
Applied rewrites66.9%
if -1.9999999999999999e35 < j < 4.09999999999999984e62Initial program 76.6%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f6478.2
Applied rewrites78.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6453.9
Applied rewrites53.9%
Final simplification59.8%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= x -3.05e-118) (not (<= x 1.75e-126))) (* (- (* z y) (* a t)) x) (* (* c j) t)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((x <= -3.05e-118) || !(x <= 1.75e-126)) {
tmp = ((z * y) - (a * t)) * x;
} else {
tmp = (c * j) * t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: tmp
if ((x <= (-3.05d-118)) .or. (.not. (x <= 1.75d-126))) then
tmp = ((z * y) - (a * t)) * x
else
tmp = (c * j) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((x <= -3.05e-118) || !(x <= 1.75e-126)) {
tmp = ((z * y) - (a * t)) * x;
} else {
tmp = (c * j) * t;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (x <= -3.05e-118) or not (x <= 1.75e-126): tmp = ((z * y) - (a * t)) * x else: tmp = (c * j) * t return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((x <= -3.05e-118) || !(x <= 1.75e-126)) tmp = Float64(Float64(Float64(z * y) - Float64(a * t)) * x); else tmp = Float64(Float64(c * j) * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((x <= -3.05e-118) || ~((x <= 1.75e-126))) tmp = ((z * y) - (a * t)) * x; else tmp = (c * j) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[x, -3.05e-118], N[Not[LessEqual[x, 1.75e-126]], $MachinePrecision]], N[(N[(N[(z * y), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(c * j), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.05 \cdot 10^{-118} \lor \neg \left(x \leq 1.75 \cdot 10^{-126}\right):\\
\;\;\;\;\left(z \cdot y - a \cdot t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(c \cdot j\right) \cdot t\\
\end{array}
\end{array}
if x < -3.04999999999999992e-118 or 1.75e-126 < x Initial program 77.1%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f6471.8
Applied rewrites71.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6458.4
Applied rewrites58.4%
if -3.04999999999999992e-118 < x < 1.75e-126Initial program 65.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6438.3
Applied rewrites38.3%
Taylor expanded in x around 0
Applied rewrites36.0%
Final simplification50.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* z y) x)))
(if (<= z -9.6e+41)
t_1
(if (<= z -2.15e-103)
(* (* b i) a)
(if (<= z 2.3e-79) (* (* t j) c) 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 * y) * x;
double tmp;
if (z <= -9.6e+41) {
tmp = t_1;
} else if (z <= -2.15e-103) {
tmp = (b * i) * a;
} else if (z <= 2.3e-79) {
tmp = (t * j) * c;
} 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 * y) * x
if (z <= (-9.6d+41)) then
tmp = t_1
else if (z <= (-2.15d-103)) then
tmp = (b * i) * a
else if (z <= 2.3d-79) then
tmp = (t * j) * c
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 * y) * x;
double tmp;
if (z <= -9.6e+41) {
tmp = t_1;
} else if (z <= -2.15e-103) {
tmp = (b * i) * a;
} else if (z <= 2.3e-79) {
tmp = (t * j) * c;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (z * y) * x tmp = 0 if z <= -9.6e+41: tmp = t_1 elif z <= -2.15e-103: tmp = (b * i) * a elif z <= 2.3e-79: tmp = (t * j) * c else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(z * y) * x) tmp = 0.0 if (z <= -9.6e+41) tmp = t_1; elseif (z <= -2.15e-103) tmp = Float64(Float64(b * i) * a); elseif (z <= 2.3e-79) tmp = Float64(Float64(t * j) * c); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (z * y) * x; tmp = 0.0; if (z <= -9.6e+41) tmp = t_1; elseif (z <= -2.15e-103) tmp = (b * i) * a; elseif (z <= 2.3e-79) tmp = (t * j) * c; 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 * y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -9.6e+41], t$95$1, If[LessEqual[z, -2.15e-103], N[(N[(b * i), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[z, 2.3e-79], N[(N[(t * j), $MachinePrecision] * c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot y\right) \cdot x\\
\mathbf{if}\;z \leq -9.6 \cdot 10^{+41}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.15 \cdot 10^{-103}:\\
\;\;\;\;\left(b \cdot i\right) \cdot a\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-79}:\\
\;\;\;\;\left(t \cdot j\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.6000000000000007e41 or 2.30000000000000012e-79 < z Initial program 62.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6451.5
Applied rewrites51.5%
Taylor expanded in x around inf
Applied rewrites37.5%
if -9.6000000000000007e41 < z < -2.15000000000000011e-103Initial program 79.4%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
mul-1-negN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6454.7
Applied rewrites54.7%
Taylor expanded in y around 0
Applied rewrites36.1%
if -2.15000000000000011e-103 < z < 2.30000000000000012e-79Initial program 87.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6454.3
Applied rewrites54.3%
Taylor expanded in x around 0
Applied rewrites32.4%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= j -3.25e+35) (not (<= j 2.6e-12))) (* (* c j) t) (* (* z x) y)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((j <= -3.25e+35) || !(j <= 2.6e-12)) {
tmp = (c * j) * t;
} else {
tmp = (z * x) * y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: tmp
if ((j <= (-3.25d+35)) .or. (.not. (j <= 2.6d-12))) then
tmp = (c * j) * t
else
tmp = (z * x) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((j <= -3.25e+35) || !(j <= 2.6e-12)) {
tmp = (c * j) * t;
} else {
tmp = (z * x) * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (j <= -3.25e+35) or not (j <= 2.6e-12): tmp = (c * j) * t else: tmp = (z * x) * y return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((j <= -3.25e+35) || !(j <= 2.6e-12)) tmp = Float64(Float64(c * j) * t); else tmp = Float64(Float64(z * x) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((j <= -3.25e+35) || ~((j <= 2.6e-12))) tmp = (c * j) * t; else tmp = (z * x) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[j, -3.25e+35], N[Not[LessEqual[j, 2.6e-12]], $MachinePrecision]], N[(N[(c * j), $MachinePrecision] * t), $MachinePrecision], N[(N[(z * x), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;j \leq -3.25 \cdot 10^{+35} \lor \neg \left(j \leq 2.6 \cdot 10^{-12}\right):\\
\;\;\;\;\left(c \cdot j\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot y\\
\end{array}
\end{array}
if j < -3.2500000000000002e35 or 2.59999999999999983e-12 < j Initial program 70.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6451.3
Applied rewrites51.3%
Taylor expanded in x around 0
Applied rewrites40.4%
if -3.2500000000000002e35 < j < 2.59999999999999983e-12Initial program 76.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6436.0
Applied rewrites36.0%
Taylor expanded in x around inf
Applied rewrites32.9%
Final simplification36.7%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= j -3.2e+35) (not (<= j 2.6e-12))) (* (* c j) t) (* (* z y) x)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((j <= -3.2e+35) || !(j <= 2.6e-12)) {
tmp = (c * j) * t;
} else {
tmp = (z * y) * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: tmp
if ((j <= (-3.2d+35)) .or. (.not. (j <= 2.6d-12))) then
tmp = (c * j) * t
else
tmp = (z * y) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((j <= -3.2e+35) || !(j <= 2.6e-12)) {
tmp = (c * j) * t;
} else {
tmp = (z * y) * x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (j <= -3.2e+35) or not (j <= 2.6e-12): tmp = (c * j) * t else: tmp = (z * y) * x return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((j <= -3.2e+35) || !(j <= 2.6e-12)) tmp = Float64(Float64(c * j) * t); else tmp = Float64(Float64(z * y) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((j <= -3.2e+35) || ~((j <= 2.6e-12))) tmp = (c * j) * t; else tmp = (z * y) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[j, -3.2e+35], N[Not[LessEqual[j, 2.6e-12]], $MachinePrecision]], N[(N[(c * j), $MachinePrecision] * t), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;j \leq -3.2 \cdot 10^{+35} \lor \neg \left(j \leq 2.6 \cdot 10^{-12}\right):\\
\;\;\;\;\left(c \cdot j\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\end{array}
\end{array}
if j < -3.19999999999999983e35 or 2.59999999999999983e-12 < j Initial program 70.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6451.3
Applied rewrites51.3%
Taylor expanded in x around 0
Applied rewrites40.4%
if -3.19999999999999983e35 < j < 2.59999999999999983e-12Initial program 76.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6436.0
Applied rewrites36.0%
Taylor expanded in x around inf
Applied rewrites29.8%
Final simplification35.1%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= z -8.5e+21) (not (<= z 2.3e-79))) (* (* z y) x) (* (* t j) c)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((z <= -8.5e+21) || !(z <= 2.3e-79)) {
tmp = (z * y) * x;
} else {
tmp = (t * j) * c;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: tmp
if ((z <= (-8.5d+21)) .or. (.not. (z <= 2.3d-79))) then
tmp = (z * y) * x
else
tmp = (t * j) * c
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((z <= -8.5e+21) || !(z <= 2.3e-79)) {
tmp = (z * y) * x;
} else {
tmp = (t * j) * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (z <= -8.5e+21) or not (z <= 2.3e-79): tmp = (z * y) * x else: tmp = (t * j) * c return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((z <= -8.5e+21) || !(z <= 2.3e-79)) tmp = Float64(Float64(z * y) * x); else tmp = Float64(Float64(t * j) * c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((z <= -8.5e+21) || ~((z <= 2.3e-79))) tmp = (z * y) * x; else tmp = (t * j) * c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[z, -8.5e+21], N[Not[LessEqual[z, 2.3e-79]], $MachinePrecision]], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], N[(N[(t * j), $MachinePrecision] * c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+21} \lor \neg \left(z \leq 2.3 \cdot 10^{-79}\right):\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(t \cdot j\right) \cdot c\\
\end{array}
\end{array}
if z < -8.5e21 or 2.30000000000000012e-79 < z Initial program 63.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6451.8
Applied rewrites51.8%
Taylor expanded in x around inf
Applied rewrites37.4%
if -8.5e21 < z < 2.30000000000000012e-79Initial program 85.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6450.9
Applied rewrites50.9%
Taylor expanded in x around 0
Applied rewrites29.6%
Final simplification34.0%
(FPCore (x y z t a b c i j) :precision binary64 (* (* c t) j))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return (c * t) * j;
}
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 = (c * t) * j
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 (c * t) * j;
}
def code(x, y, z, t, a, b, c, i, j): return (c * t) * j
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(c * t) * j) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = (c * t) * j; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(c * t), $MachinePrecision] * j), $MachinePrecision]
\begin{array}{l}
\\
\left(c \cdot t\right) \cdot j
\end{array}
Initial program 73.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6443.1
Applied rewrites43.1%
Taylor expanded in x around 0
Applied rewrites20.5%
Applied rewrites20.8%
(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 2024363
(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)))))