
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i))); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i))); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)
\end{array}
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i))))
(* j (- (* c a) (* y i))))))
(if (<= t_1 INFINITY)
t_1
(* (- a) (fma t x (- (fma j c (* (/ (fma (- b) c (* y x)) a) z))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = -a * fma(t, x, -fma(j, c, ((fma(-b, c, (y * x)) / a) * z)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(-a) * fma(t, x, Float64(-fma(j, c, Float64(Float64(fma(Float64(-b), c, Float64(y * x)) / a) * z))))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[((-a) * N[(t * x + (-N[(j * c + N[(N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision])), $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 - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(-a\right) \cdot \mathsf{fma}\left(t, x, -\mathsf{fma}\left(j, c, \frac{\mathsf{fma}\left(-b, c, y \cdot x\right)}{a} \cdot z\right)\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) < +inf.0Initial program 92.9%
if +inf.0 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) Initial program 0.0%
Taylor expanded in a around -inf
Applied rewrites62.4%
Taylor expanded in z around inf
Applied rewrites74.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (- b) c (* y x))) (t_2 (* t_1 z)))
(if (<= a -1.75e+81)
(* (- a) (fma t x (- (fma j c (* (/ t_1 a) z)))))
(if (<= a 1.25e+88)
(fma (fma (- i) y (* c a)) j (fma (fma (- a) x (* i b)) t t_2))
(* (fma (- x) t (fma j c (/ t_2 a))) a)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-b, c, (y * x));
double t_2 = t_1 * z;
double tmp;
if (a <= -1.75e+81) {
tmp = -a * fma(t, x, -fma(j, c, ((t_1 / a) * z)));
} else if (a <= 1.25e+88) {
tmp = fma(fma(-i, y, (c * a)), j, fma(fma(-a, x, (i * b)), t, t_2));
} else {
tmp = fma(-x, t, fma(j, c, (t_2 / a))) * a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(Float64(-b), c, Float64(y * x)) t_2 = Float64(t_1 * z) tmp = 0.0 if (a <= -1.75e+81) tmp = Float64(Float64(-a) * fma(t, x, Float64(-fma(j, c, Float64(Float64(t_1 / a) * z))))); elseif (a <= 1.25e+88) tmp = fma(fma(Float64(-i), y, Float64(c * a)), j, fma(fma(Float64(-a), x, Float64(i * b)), t, t_2)); else tmp = Float64(fma(Float64(-x), t, fma(j, c, Float64(t_2 / a))) * a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * z), $MachinePrecision]}, If[LessEqual[a, -1.75e+81], N[((-a) * N[(t * x + (-N[(j * c + N[(N[(t$95$1 / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.25e+88], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j + N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t + t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[((-x) * t + N[(j * c + N[(t$95$2 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-b, c, y \cdot x\right)\\
t_2 := t\_1 \cdot z\\
\mathbf{if}\;a \leq -1.75 \cdot 10^{+81}:\\
\;\;\;\;\left(-a\right) \cdot \mathsf{fma}\left(t, x, -\mathsf{fma}\left(j, c, \frac{t\_1}{a} \cdot z\right)\right)\\
\mathbf{elif}\;a \leq 1.25 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, y, c \cdot a\right), j, \mathsf{fma}\left(\mathsf{fma}\left(-a, x, i \cdot b\right), t, t\_2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-x, t, \mathsf{fma}\left(j, c, \frac{t\_2}{a}\right)\right) \cdot a\\
\end{array}
\end{array}
if a < -1.75e81Initial program 66.9%
Taylor expanded in a around -inf
Applied rewrites83.3%
Taylor expanded in z around inf
Applied rewrites85.9%
if -1.75e81 < a < 1.24999999999999999e88Initial program 80.2%
Taylor expanded in t around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-fma.f64N/A
Applied rewrites82.5%
if 1.24999999999999999e88 < a Initial program 65.7%
Taylor expanded in i around 0
Applied rewrites74.7%
Taylor expanded in a around inf
Applied rewrites88.1%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= a -6.5e+96) (not (<= a 1.4e+39))) (* (- a) (fma t x (- (fma j c (* (/ (fma (- b) c (* y x)) a) z))))) (fma (fma (- i) j (* z x)) y (* (fma (- c) z (* i t)) b))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((a <= -6.5e+96) || !(a <= 1.4e+39)) {
tmp = -a * fma(t, x, -fma(j, c, ((fma(-b, c, (y * x)) / a) * z)));
} else {
tmp = fma(fma(-i, j, (z * x)), y, (fma(-c, z, (i * t)) * b));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((a <= -6.5e+96) || !(a <= 1.4e+39)) tmp = Float64(Float64(-a) * fma(t, x, Float64(-fma(j, c, Float64(Float64(fma(Float64(-b), c, Float64(y * x)) / a) * z))))); else tmp = fma(fma(Float64(-i), j, Float64(z * x)), y, Float64(fma(Float64(-c), z, Float64(i * t)) * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[a, -6.5e+96], N[Not[LessEqual[a, 1.4e+39]], $MachinePrecision]], N[((-a) * N[(t * x + (-N[(j * c + N[(N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y + N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.5 \cdot 10^{+96} \lor \neg \left(a \leq 1.4 \cdot 10^{+39}\right):\\
\;\;\;\;\left(-a\right) \cdot \mathsf{fma}\left(t, x, -\mathsf{fma}\left(j, c, \frac{\mathsf{fma}\left(-b, c, y \cdot x\right)}{a} \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, j, z \cdot x\right), y, \mathsf{fma}\left(-c, z, i \cdot t\right) \cdot b\right)\\
\end{array}
\end{array}
if a < -6.5e96 or 1.40000000000000001e39 < a Initial program 64.5%
Taylor expanded in a around -inf
Applied rewrites80.8%
Taylor expanded in z around inf
Applied rewrites84.6%
if -6.5e96 < a < 1.40000000000000001e39Initial program 82.4%
Taylor expanded in b around inf
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
lower-*.f64N/A
Applied rewrites77.1%
Taylor expanded in y around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.2
Applied rewrites68.2%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
Applied rewrites75.1%
Final simplification79.2%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= a -6.5e+96) (not (<= a 1.4e+39))) (* (fma (- x) t (fma j c (/ (* (fma (- b) c (* y x)) z) a))) a) (fma (fma (- i) j (* z x)) y (* (fma (- c) z (* i t)) b))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((a <= -6.5e+96) || !(a <= 1.4e+39)) {
tmp = fma(-x, t, fma(j, c, ((fma(-b, c, (y * x)) * z) / a))) * a;
} else {
tmp = fma(fma(-i, j, (z * x)), y, (fma(-c, z, (i * t)) * b));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((a <= -6.5e+96) || !(a <= 1.4e+39)) tmp = Float64(fma(Float64(-x), t, fma(j, c, Float64(Float64(fma(Float64(-b), c, Float64(y * x)) * z) / a))) * a); else tmp = fma(fma(Float64(-i), j, Float64(z * x)), y, Float64(fma(Float64(-c), z, Float64(i * t)) * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[a, -6.5e+96], N[Not[LessEqual[a, 1.4e+39]], $MachinePrecision]], N[(N[((-x) * t + N[(j * c + N[(N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y + N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.5 \cdot 10^{+96} \lor \neg \left(a \leq 1.4 \cdot 10^{+39}\right):\\
\;\;\;\;\mathsf{fma}\left(-x, t, \mathsf{fma}\left(j, c, \frac{\mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z}{a}\right)\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, j, z \cdot x\right), y, \mathsf{fma}\left(-c, z, i \cdot t\right) \cdot b\right)\\
\end{array}
\end{array}
if a < -6.5e96 or 1.40000000000000001e39 < a Initial program 64.5%
Taylor expanded in i around 0
Applied rewrites73.9%
Taylor expanded in a around inf
Applied rewrites82.8%
if -6.5e96 < a < 1.40000000000000001e39Initial program 82.4%
Taylor expanded in b around inf
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
lower-*.f64N/A
Applied rewrites77.1%
Taylor expanded in y around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.2
Applied rewrites68.2%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
Applied rewrites75.1%
Final simplification78.4%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= a -6.5e+96) (not (<= a 8.5e+55))) (fma (fma (- t) x (* j c)) a (* (fma (- b) c (* y x)) z)) (fma (fma (- i) j (* z x)) y (* (fma (- c) z (* i t)) b))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((a <= -6.5e+96) || !(a <= 8.5e+55)) {
tmp = fma(fma(-t, x, (j * c)), a, (fma(-b, c, (y * x)) * z));
} else {
tmp = fma(fma(-i, j, (z * x)), y, (fma(-c, z, (i * t)) * b));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((a <= -6.5e+96) || !(a <= 8.5e+55)) tmp = fma(fma(Float64(-t), x, Float64(j * c)), a, Float64(fma(Float64(-b), c, Float64(y * x)) * z)); else tmp = fma(fma(Float64(-i), j, Float64(z * x)), y, Float64(fma(Float64(-c), z, Float64(i * t)) * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[a, -6.5e+96], N[Not[LessEqual[a, 8.5e+55]], $MachinePrecision]], N[(N[((-t) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * a + N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y + N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.5 \cdot 10^{+96} \lor \neg \left(a \leq 8.5 \cdot 10^{+55}\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-t, x, j \cdot c\right), a, \mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, j, z \cdot x\right), y, \mathsf{fma}\left(-c, z, i \cdot t\right) \cdot b\right)\\
\end{array}
\end{array}
if a < -6.5e96 or 8.50000000000000002e55 < a Initial program 64.7%
Taylor expanded in i around 0
Applied rewrites75.2%
Taylor expanded in a around inf
Applied rewrites83.4%
Taylor expanded in i around 0
Applied rewrites83.4%
if -6.5e96 < a < 8.50000000000000002e55Initial program 81.9%
Taylor expanded in b around inf
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
lower-*.f64N/A
Applied rewrites76.8%
Taylor expanded in y around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
Applied rewrites67.3%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
Applied rewrites74.8%
Final simplification78.4%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= a -1.25e+100)
(* (fma (- x) t (* j c)) a)
(if (<= a 2.6e+66)
(fma (fma (- i) j (* z x)) y (* (fma (- c) z (* i t)) b))
(fma (fma (- z) b (* j a)) c (* (* (- 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 (a <= -1.25e+100) {
tmp = fma(-x, t, (j * c)) * a;
} else if (a <= 2.6e+66) {
tmp = fma(fma(-i, j, (z * x)), y, (fma(-c, z, (i * t)) * b));
} else {
tmp = fma(fma(-z, b, (j * a)), c, ((-a * t) * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (a <= -1.25e+100) tmp = Float64(fma(Float64(-x), t, Float64(j * c)) * a); elseif (a <= 2.6e+66) tmp = fma(fma(Float64(-i), j, Float64(z * x)), y, Float64(fma(Float64(-c), z, Float64(i * t)) * b)); else tmp = fma(fma(Float64(-z), b, Float64(j * a)), c, Float64(Float64(Float64(-a) * t) * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[a, -1.25e+100], N[(N[((-x) * t + N[(j * c), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[a, 2.6e+66], N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y + N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(N[((-z) * b + N[(j * a), $MachinePrecision]), $MachinePrecision] * c + N[(N[((-a) * t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.25 \cdot 10^{+100}:\\
\;\;\;\;\mathsf{fma}\left(-x, t, j \cdot c\right) \cdot a\\
\mathbf{elif}\;a \leq 2.6 \cdot 10^{+66}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, j, z \cdot x\right), y, \mathsf{fma}\left(-c, z, i \cdot t\right) \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-z, b, j \cdot a\right), c, \left(\left(-a\right) \cdot t\right) \cdot x\right)\\
\end{array}
\end{array}
if a < -1.25e100Initial program 64.3%
Taylor expanded in a 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-*.f6479.9
Applied rewrites79.9%
if -1.25e100 < a < 2.60000000000000012e66Initial program 81.0%
Taylor expanded in b around inf
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
lower-*.f64N/A
Applied rewrites75.9%
Taylor expanded in y around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6466.6
Applied rewrites66.6%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
Applied rewrites74.6%
if 2.60000000000000012e66 < a Initial program 66.4%
Taylor expanded in i around 0
Applied rewrites74.5%
Taylor expanded in y around 0
Applied rewrites70.1%
Final simplification74.3%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= x -2.6e-33)
(* (fma (- t) a (* y z)) x)
(if (<= x 3.8e+44)
(fma (fma (- i) y (* c a)) j (* (* (- b) c) z))
(* (* (fma y (/ z a) (- t)) x) 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 <= -2.6e-33) {
tmp = fma(-t, a, (y * z)) * x;
} else if (x <= 3.8e+44) {
tmp = fma(fma(-i, y, (c * a)), j, ((-b * c) * z));
} else {
tmp = (fma(y, (z / a), -t) * x) * a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -2.6e-33) tmp = Float64(fma(Float64(-t), a, Float64(y * z)) * x); elseif (x <= 3.8e+44) tmp = fma(fma(Float64(-i), y, Float64(c * a)), j, Float64(Float64(Float64(-b) * c) * z)); else tmp = Float64(Float64(fma(y, Float64(z / a), Float64(-t)) * x) * a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -2.6e-33], N[(N[((-t) * a + N[(y * z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 3.8e+44], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j + N[(N[((-b) * c), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * N[(z / a), $MachinePrecision] + (-t)), $MachinePrecision] * x), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(-t, a, y \cdot z\right) \cdot x\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{+44}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, y, c \cdot a\right), j, \left(\left(-b\right) \cdot c\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(y, \frac{z}{a}, -t\right) \cdot x\right) \cdot a\\
\end{array}
\end{array}
if x < -2.59999999999999994e-33Initial program 74.4%
Taylor expanded in a around -inf
Applied rewrites71.3%
Taylor expanded in x around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6471.3
Applied rewrites71.3%
if -2.59999999999999994e-33 < x < 3.8000000000000002e44Initial program 74.0%
Taylor expanded in t around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-fma.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.0%
Taylor expanded in x around 0
Applied rewrites64.2%
if 3.8000000000000002e44 < x Initial program 76.7%
Taylor expanded in i around 0
Applied rewrites75.5%
Taylor expanded in a around inf
Applied rewrites75.5%
Taylor expanded in x around inf
Applied rewrites69.1%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= x -7.8e-44)
(* (fma (- t) a (* y z)) x)
(if (<= x 4.5e-52)
(* (fma (- i) y (* c a)) j)
(* (* (fma y (/ z a) (- t)) x) 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 <= -7.8e-44) {
tmp = fma(-t, a, (y * z)) * x;
} else if (x <= 4.5e-52) {
tmp = fma(-i, y, (c * a)) * j;
} else {
tmp = (fma(y, (z / a), -t) * x) * a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (x <= -7.8e-44) tmp = Float64(fma(Float64(-t), a, Float64(y * z)) * x); elseif (x <= 4.5e-52) tmp = Float64(fma(Float64(-i), y, Float64(c * a)) * j); else tmp = Float64(Float64(fma(y, Float64(z / a), Float64(-t)) * x) * a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[x, -7.8e-44], N[(N[((-t) * a + N[(y * z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 4.5e-52], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], N[(N[(N[(y * N[(z / a), $MachinePrecision] + (-t)), $MachinePrecision] * x), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{-44}:\\
\;\;\;\;\mathsf{fma}\left(-t, a, y \cdot z\right) \cdot x\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-52}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(y, \frac{z}{a}, -t\right) \cdot x\right) \cdot a\\
\end{array}
\end{array}
if x < -7.8000000000000004e-44Initial program 75.0%
Taylor expanded in a around -inf
Applied rewrites72.0%
Taylor expanded in x around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6470.8
Applied rewrites70.8%
if -7.8000000000000004e-44 < x < 4.5e-52Initial program 70.9%
Taylor expanded in t around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-fma.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.0%
Taylor expanded in z around 0
Applied rewrites56.7%
if 4.5e-52 < x Initial program 79.8%
Taylor expanded in i around 0
Applied rewrites76.2%
Taylor expanded in a around inf
Applied rewrites76.1%
Taylor expanded in x around inf
Applied rewrites65.6%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- t) a (* y z)) x)))
(if (<= x -7.8e-44)
t_1
(if (<= x 1.06e-191)
(* (fma (- i) y (* c a)) j)
(if (<= x 8e-8) (* (fma (- z) b (* j a)) 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 = fma(-t, a, (y * z)) * x;
double tmp;
if (x <= -7.8e-44) {
tmp = t_1;
} else if (x <= 1.06e-191) {
tmp = fma(-i, y, (c * a)) * j;
} else if (x <= 8e-8) {
tmp = fma(-z, b, (j * a)) * c;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-t), a, Float64(y * z)) * x) tmp = 0.0 if (x <= -7.8e-44) tmp = t_1; elseif (x <= 1.06e-191) tmp = Float64(fma(Float64(-i), y, Float64(c * a)) * j); elseif (x <= 8e-8) tmp = Float64(fma(Float64(-z), b, Float64(j * a)) * c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-t) * a + N[(y * z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -7.8e-44], t$95$1, If[LessEqual[x, 1.06e-191], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[x, 8e-8], N[(N[((-z) * b + N[(j * a), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-t, a, y \cdot z\right) \cdot x\\
\mathbf{if}\;x \leq -7.8 \cdot 10^{-44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.06 \cdot 10^{-191}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(-z, b, j \cdot a\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -7.8000000000000004e-44 or 8.0000000000000002e-8 < x Initial program 76.7%
Taylor expanded in a around -inf
Applied rewrites77.1%
Taylor expanded in x around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6468.0
Applied rewrites68.0%
if -7.8000000000000004e-44 < x < 1.05999999999999994e-191Initial program 73.2%
Taylor expanded in t around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-fma.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.7%
Taylor expanded in z around 0
Applied rewrites59.6%
if 1.05999999999999994e-191 < x < 8.0000000000000002e-8Initial program 69.5%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
*-commutativeN/A
mul-1-negN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6458.7
Applied rewrites58.7%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- i) y (* c a)) j)))
(if (<= j -2.5e+23)
t_1
(if (<= j 5.5e-244)
(* (fma (- a) x (* i b)) t)
(if (<= j 3.5e-99) (* (* 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(-i, y, (c * a)) * j;
double tmp;
if (j <= -2.5e+23) {
tmp = t_1;
} else if (j <= 5.5e-244) {
tmp = fma(-a, x, (i * b)) * t;
} else if (j <= 3.5e-99) {
tmp = (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(-i), y, Float64(c * a)) * j) tmp = 0.0 if (j <= -2.5e+23) tmp = t_1; elseif (j <= 5.5e-244) tmp = Float64(fma(Float64(-a), x, Float64(i * b)) * t); elseif (j <= 3.5e-99) tmp = 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[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]}, If[LessEqual[j, -2.5e+23], t$95$1, If[LessEqual[j, 5.5e-244], N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[j, 3.5e-99], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\mathbf{if}\;j \leq -2.5 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;j \leq 5.5 \cdot 10^{-244}:\\
\;\;\;\;\mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\\
\mathbf{elif}\;j \leq 3.5 \cdot 10^{-99}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if j < -2.5e23 or 3.4999999999999999e-99 < j Initial program 81.1%
Taylor expanded in t around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-fma.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites75.1%
Taylor expanded in z around 0
Applied rewrites61.1%
if -2.5e23 < j < 5.4999999999999998e-244Initial program 65.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6446.5
Applied rewrites46.5%
if 5.4999999999999998e-244 < j < 3.4999999999999999e-99Initial program 73.9%
Taylor expanded in a around -inf
Applied rewrites94.7%
Taylor expanded in x around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6461.9
Applied rewrites61.9%
Taylor expanded in y around inf
Applied rewrites48.8%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= z -3.5e+121)
(* (* (- c) b) z)
(if (<= z 6.8e-215)
(* (* (- a) x) t)
(if (<= z 3.5e-135)
(* (* (- y) j) i)
(if (<= z 0.0015) (* (* j c) a) (* (* z y) x))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (z <= -3.5e+121) {
tmp = (-c * b) * z;
} else if (z <= 6.8e-215) {
tmp = (-a * x) * t;
} else if (z <= 3.5e-135) {
tmp = (-y * j) * i;
} else if (z <= 0.0015) {
tmp = (j * c) * a;
} 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 (z <= (-3.5d+121)) then
tmp = (-c * b) * z
else if (z <= 6.8d-215) then
tmp = (-a * x) * t
else if (z <= 3.5d-135) then
tmp = (-y * j) * i
else if (z <= 0.0015d0) then
tmp = (j * c) * a
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 (z <= -3.5e+121) {
tmp = (-c * b) * z;
} else if (z <= 6.8e-215) {
tmp = (-a * x) * t;
} else if (z <= 3.5e-135) {
tmp = (-y * j) * i;
} else if (z <= 0.0015) {
tmp = (j * c) * a;
} else {
tmp = (z * y) * x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if z <= -3.5e+121: tmp = (-c * b) * z elif z <= 6.8e-215: tmp = (-a * x) * t elif z <= 3.5e-135: tmp = (-y * j) * i elif z <= 0.0015: tmp = (j * c) * a else: tmp = (z * y) * x return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (z <= -3.5e+121) tmp = Float64(Float64(Float64(-c) * b) * z); elseif (z <= 6.8e-215) tmp = Float64(Float64(Float64(-a) * x) * t); elseif (z <= 3.5e-135) tmp = Float64(Float64(Float64(-y) * j) * i); elseif (z <= 0.0015) tmp = Float64(Float64(j * c) * a); 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 (z <= -3.5e+121) tmp = (-c * b) * z; elseif (z <= 6.8e-215) tmp = (-a * x) * t; elseif (z <= 3.5e-135) tmp = (-y * j) * i; elseif (z <= 0.0015) tmp = (j * c) * a; else tmp = (z * y) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[z, -3.5e+121], N[(N[((-c) * b), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 6.8e-215], N[(N[((-a) * x), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 3.5e-135], N[(N[((-y) * j), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[z, 0.0015], N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+121}:\\
\;\;\;\;\left(\left(-c\right) \cdot b\right) \cdot z\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{-215}:\\
\;\;\;\;\left(\left(-a\right) \cdot x\right) \cdot t\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-135}:\\
\;\;\;\;\left(\left(-y\right) \cdot j\right) \cdot i\\
\mathbf{elif}\;z \leq 0.0015:\\
\;\;\;\;\left(j \cdot c\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\end{array}
\end{array}
if z < -3.5e121Initial program 60.6%
Taylor expanded in i around 0
Applied rewrites68.2%
Taylor expanded in b around inf
Applied rewrites47.4%
if -3.5e121 < z < 6.80000000000000003e-215Initial program 83.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6453.3
Applied rewrites53.3%
Taylor expanded in x around inf
Applied rewrites38.7%
if 6.80000000000000003e-215 < z < 3.4999999999999998e-135Initial program 76.6%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-neg-inN/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6460.7
Applied rewrites60.7%
Taylor expanded in y around inf
Applied rewrites54.6%
if 3.4999999999999998e-135 < z < 0.0015Initial program 83.5%
Taylor expanded in a 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 0
Applied rewrites35.0%
if 0.0015 < z Initial program 65.6%
Taylor expanded in a around -inf
Applied rewrites73.3%
Taylor expanded in x around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6457.1
Applied rewrites57.1%
Taylor expanded in y around inf
Applied rewrites44.8%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= x -7.8e-44) (not (<= x 2.5e+29))) (* (fma (- t) a (* y z)) x) (* (fma (- i) y (* c a)) j)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((x <= -7.8e-44) || !(x <= 2.5e+29)) {
tmp = fma(-t, a, (y * z)) * x;
} else {
tmp = fma(-i, y, (c * a)) * j;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((x <= -7.8e-44) || !(x <= 2.5e+29)) tmp = Float64(fma(Float64(-t), a, Float64(y * z)) * x); else tmp = Float64(fma(Float64(-i), y, Float64(c * a)) * j); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[x, -7.8e-44], N[Not[LessEqual[x, 2.5e+29]], $MachinePrecision]], N[(N[((-t) * a + N[(y * z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{-44} \lor \neg \left(x \leq 2.5 \cdot 10^{+29}\right):\\
\;\;\;\;\mathsf{fma}\left(-t, a, y \cdot z\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\end{array}
\end{array}
if x < -7.8000000000000004e-44 or 2.5e29 < x Initial program 75.7%
Taylor expanded in a around -inf
Applied rewrites76.2%
Taylor expanded in x around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6468.7
Applied rewrites68.7%
if -7.8000000000000004e-44 < x < 2.5e29Initial program 73.6%
Taylor expanded in t around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-fma.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.5%
Taylor expanded in z around 0
Applied rewrites55.2%
Final simplification62.6%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= z -8.4e+68) (not (<= z 2.65e-20))) (* (fma (- b) c (* y x)) z) (* (fma (- a) x (* i b)) t)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((z <= -8.4e+68) || !(z <= 2.65e-20)) {
tmp = fma(-b, c, (y * x)) * z;
} else {
tmp = fma(-a, x, (i * b)) * t;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((z <= -8.4e+68) || !(z <= 2.65e-20)) tmp = Float64(fma(Float64(-b), c, Float64(y * x)) * z); else tmp = Float64(fma(Float64(-a), x, Float64(i * b)) * t); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[z, -8.4e+68], N[Not[LessEqual[z, 2.65e-20]], $MachinePrecision]], N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.4 \cdot 10^{+68} \lor \neg \left(z \leq 2.65 \cdot 10^{-20}\right):\\
\;\;\;\;\mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\\
\end{array}
\end{array}
if z < -8.40000000000000003e68 or 2.6500000000000001e-20 < z Initial program 63.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-*.f6467.1
Applied rewrites67.1%
if -8.40000000000000003e68 < z < 2.6500000000000001e-20Initial program 83.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6451.6
Applied rewrites51.6%
Final simplification58.6%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= x -2.3e+101) (not (<= x 4.8e+44))) (* (* (- a) x) t) (* (fma (- i) y (* c a)) j)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((x <= -2.3e+101) || !(x <= 4.8e+44)) {
tmp = (-a * x) * t;
} else {
tmp = fma(-i, y, (c * a)) * j;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((x <= -2.3e+101) || !(x <= 4.8e+44)) tmp = Float64(Float64(Float64(-a) * x) * t); else tmp = Float64(fma(Float64(-i), y, Float64(c * a)) * j); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[x, -2.3e+101], N[Not[LessEqual[x, 4.8e+44]], $MachinePrecision]], N[(N[((-a) * x), $MachinePrecision] * t), $MachinePrecision], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+101} \lor \neg \left(x \leq 4.8 \cdot 10^{+44}\right):\\
\;\;\;\;\left(\left(-a\right) \cdot x\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\end{array}
\end{array}
if x < -2.3000000000000001e101 or 4.80000000000000026e44 < x Initial program 78.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6452.4
Applied rewrites52.4%
Taylor expanded in x around inf
Applied rewrites44.3%
if -2.3000000000000001e101 < x < 4.80000000000000026e44Initial program 72.1%
Taylor expanded in t around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-out--N/A
lower-fma.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.9%
Taylor expanded in z around 0
Applied rewrites52.1%
Final simplification48.8%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= z -3.5e+121)
(* (* (- c) b) z)
(if (<= z 4e-182)
(* (* (- a) x) t)
(if (<= z 0.0015) (* (* j c) a) (* (* z y) x)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (z <= -3.5e+121) {
tmp = (-c * b) * z;
} else if (z <= 4e-182) {
tmp = (-a * x) * t;
} else if (z <= 0.0015) {
tmp = (j * c) * a;
} 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 (z <= (-3.5d+121)) then
tmp = (-c * b) * z
else if (z <= 4d-182) then
tmp = (-a * x) * t
else if (z <= 0.0015d0) then
tmp = (j * c) * a
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 (z <= -3.5e+121) {
tmp = (-c * b) * z;
} else if (z <= 4e-182) {
tmp = (-a * x) * t;
} else if (z <= 0.0015) {
tmp = (j * c) * a;
} else {
tmp = (z * y) * x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if z <= -3.5e+121: tmp = (-c * b) * z elif z <= 4e-182: tmp = (-a * x) * t elif z <= 0.0015: tmp = (j * c) * a else: tmp = (z * y) * x return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (z <= -3.5e+121) tmp = Float64(Float64(Float64(-c) * b) * z); elseif (z <= 4e-182) tmp = Float64(Float64(Float64(-a) * x) * t); elseif (z <= 0.0015) tmp = Float64(Float64(j * c) * a); 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 (z <= -3.5e+121) tmp = (-c * b) * z; elseif (z <= 4e-182) tmp = (-a * x) * t; elseif (z <= 0.0015) tmp = (j * c) * a; else tmp = (z * y) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[z, -3.5e+121], N[(N[((-c) * b), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 4e-182], N[(N[((-a) * x), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 0.0015], N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+121}:\\
\;\;\;\;\left(\left(-c\right) \cdot b\right) \cdot z\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-182}:\\
\;\;\;\;\left(\left(-a\right) \cdot x\right) \cdot t\\
\mathbf{elif}\;z \leq 0.0015:\\
\;\;\;\;\left(j \cdot c\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\end{array}
\end{array}
if z < -3.5e121Initial program 60.6%
Taylor expanded in i around 0
Applied rewrites68.2%
Taylor expanded in b around inf
Applied rewrites47.4%
if -3.5e121 < z < 4.0000000000000002e-182Initial program 83.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6452.8
Applied rewrites52.8%
Taylor expanded in x around inf
Applied rewrites37.8%
if 4.0000000000000002e-182 < z < 0.0015Initial program 79.4%
Taylor expanded in a 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-*.f6445.5
Applied rewrites45.5%
Taylor expanded in x around 0
Applied rewrites33.0%
if 0.0015 < z Initial program 65.6%
Taylor expanded in a around -inf
Applied rewrites73.3%
Taylor expanded in x around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6457.1
Applied rewrites57.1%
Taylor expanded in y around inf
Applied rewrites44.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* z y) x)))
(if (<= y -1.7e+124)
t_1
(if (<= y 6.4e-153) (* (* j c) a) (if (<= y 9e+68) (* (* i t) b) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (z * y) * x;
double tmp;
if (y <= -1.7e+124) {
tmp = t_1;
} else if (y <= 6.4e-153) {
tmp = (j * c) * a;
} else if (y <= 9e+68) {
tmp = (i * t) * b;
} 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 (y <= (-1.7d+124)) then
tmp = t_1
else if (y <= 6.4d-153) then
tmp = (j * c) * a
else if (y <= 9d+68) then
tmp = (i * t) * b
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 (y <= -1.7e+124) {
tmp = t_1;
} else if (y <= 6.4e-153) {
tmp = (j * c) * a;
} else if (y <= 9e+68) {
tmp = (i * t) * b;
} 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 y <= -1.7e+124: tmp = t_1 elif y <= 6.4e-153: tmp = (j * c) * a elif y <= 9e+68: tmp = (i * t) * b 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 (y <= -1.7e+124) tmp = t_1; elseif (y <= 6.4e-153) tmp = Float64(Float64(j * c) * a); elseif (y <= 9e+68) tmp = Float64(Float64(i * t) * b); 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 (y <= -1.7e+124) tmp = t_1; elseif (y <= 6.4e-153) tmp = (j * c) * a; elseif (y <= 9e+68) tmp = (i * t) * b; 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[y, -1.7e+124], t$95$1, If[LessEqual[y, 6.4e-153], N[(N[(j * c), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[y, 9e+68], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot y\right) \cdot x\\
\mathbf{if}\;y \leq -1.7 \cdot 10^{+124}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{-153}:\\
\;\;\;\;\left(j \cdot c\right) \cdot a\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+68}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.7e124 or 9.0000000000000007e68 < y Initial program 61.8%
Taylor expanded in a around -inf
Applied rewrites78.3%
Taylor expanded in x around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6462.4
Applied rewrites62.4%
Taylor expanded in y around inf
Applied rewrites47.1%
if -1.7e124 < y < 6.3999999999999998e-153Initial program 81.0%
Taylor expanded in a 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-*.f6455.1
Applied rewrites55.1%
Taylor expanded in x around 0
Applied rewrites34.2%
if 6.3999999999999998e-153 < y < 9.0000000000000007e68Initial program 88.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6449.0
Applied rewrites49.0%
Taylor expanded in x around 0
Applied rewrites32.5%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= t -175000.0) (not (<= t 2.7e-20))) (* (- a) (* x 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 ((t <= -175000.0) || !(t <= 2.7e-20)) {
tmp = -a * (x * 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 ((t <= (-175000.0d0)) .or. (.not. (t <= 2.7d-20))) then
tmp = -a * (x * 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 ((t <= -175000.0) || !(t <= 2.7e-20)) {
tmp = -a * (x * t);
} else {
tmp = (z * y) * x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (t <= -175000.0) or not (t <= 2.7e-20): tmp = -a * (x * t) else: tmp = (z * y) * x return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((t <= -175000.0) || !(t <= 2.7e-20)) tmp = Float64(Float64(-a) * Float64(x * 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 ((t <= -175000.0) || ~((t <= 2.7e-20))) tmp = -a * (x * t); else tmp = (z * y) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[t, -175000.0], N[Not[LessEqual[t, 2.7e-20]], $MachinePrecision]], N[((-a) * N[(x * t), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -175000 \lor \neg \left(t \leq 2.7 \cdot 10^{-20}\right):\\
\;\;\;\;\left(-a\right) \cdot \left(x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\end{array}
\end{array}
if t < -175000 or 2.7e-20 < t Initial program 68.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6455.8
Applied rewrites55.8%
Taylor expanded in x around inf
Applied rewrites37.7%
if -175000 < t < 2.7e-20Initial program 80.3%
Taylor expanded in a around -inf
Applied rewrites84.4%
Taylor expanded in x around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6444.9
Applied rewrites44.9%
Taylor expanded in y around inf
Applied rewrites37.7%
Final simplification37.7%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= z -1.05e-86) (not (<= z 4.5e-69))) (* (* z y) x) (* (* i t) b)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((z <= -1.05e-86) || !(z <= 4.5e-69)) {
tmp = (z * y) * x;
} else {
tmp = (i * t) * b;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: tmp
if ((z <= (-1.05d-86)) .or. (.not. (z <= 4.5d-69))) then
tmp = (z * y) * x
else
tmp = (i * t) * b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((z <= -1.05e-86) || !(z <= 4.5e-69)) {
tmp = (z * y) * x;
} else {
tmp = (i * t) * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (z <= -1.05e-86) or not (z <= 4.5e-69): tmp = (z * y) * x else: tmp = (i * t) * b return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((z <= -1.05e-86) || !(z <= 4.5e-69)) tmp = Float64(Float64(z * y) * x); else tmp = Float64(Float64(i * t) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((z <= -1.05e-86) || ~((z <= 4.5e-69))) tmp = (z * y) * x; else tmp = (i * t) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[z, -1.05e-86], N[Not[LessEqual[z, 4.5e-69]], $MachinePrecision]], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{-86} \lor \neg \left(z \leq 4.5 \cdot 10^{-69}\right):\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\end{array}
\end{array}
if z < -1.05e-86 or 4.50000000000000009e-69 < z Initial program 68.8%
Taylor expanded in a around -inf
Applied rewrites78.7%
Taylor expanded in x around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6452.9
Applied rewrites52.9%
Taylor expanded in y around inf
Applied rewrites39.1%
if -1.05e-86 < z < 4.50000000000000009e-69Initial program 84.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6452.8
Applied rewrites52.8%
Taylor expanded in x around 0
Applied rewrites31.0%
Final simplification35.9%
(FPCore (x y z t a b c i j) :precision binary64 (* (* i t) b))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return (i * t) * b;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
code = (i * t) * b
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return (i * t) * b;
}
def code(x, y, z, t, a, b, c, i, j): return (i * t) * b
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(i * t) * b) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = (i * t) * b; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision]
\begin{array}{l}
\\
\left(i \cdot t\right) \cdot b
\end{array}
Initial program 74.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
mul-1-negN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6437.3
Applied rewrites37.3%
Taylor expanded in x around 0
Applied rewrites19.1%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* j (- (* c a) (* y i))))
(t_2
(+
(-
(* x (- (* y z) (* t a)))
(/
(* b (- (pow (* c z) 2.0) (pow (* t i) 2.0)))
(+ (* c z) (* t i))))
t_1)))
(if (< x -1.469694296777705e-64)
t_2
(if (< x 3.2113527362226803e-147)
(- (* (- (* b i) (* x a)) t) (- (* z (* c b)) t_1))
t_2))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = j * ((c * a) - (y * i));
double t_2 = ((x * ((y * z) - (t * a))) - ((b * (pow((c * z), 2.0) - pow((t * i), 2.0))) / ((c * z) + (t * i)))) + t_1;
double tmp;
if (x < -1.469694296777705e-64) {
tmp = t_2;
} else if (x < 3.2113527362226803e-147) {
tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1);
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = j * ((c * a) - (y * i))
t_2 = ((x * ((y * z) - (t * a))) - ((b * (((c * z) ** 2.0d0) - ((t * i) ** 2.0d0))) / ((c * z) + (t * i)))) + t_1
if (x < (-1.469694296777705d-64)) then
tmp = t_2
else if (x < 3.2113527362226803d-147) then
tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = j * ((c * a) - (y * i));
double t_2 = ((x * ((y * z) - (t * a))) - ((b * (Math.pow((c * z), 2.0) - Math.pow((t * i), 2.0))) / ((c * z) + (t * i)))) + t_1;
double tmp;
if (x < -1.469694296777705e-64) {
tmp = t_2;
} else if (x < 3.2113527362226803e-147) {
tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = j * ((c * a) - (y * i)) t_2 = ((x * ((y * z) - (t * a))) - ((b * (math.pow((c * z), 2.0) - math.pow((t * i), 2.0))) / ((c * z) + (t * i)))) + t_1 tmp = 0 if x < -1.469694296777705e-64: tmp = t_2 elif x < 3.2113527362226803e-147: tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(j * Float64(Float64(c * a) - Float64(y * i))) t_2 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(Float64(b * Float64((Float64(c * z) ^ 2.0) - (Float64(t * i) ^ 2.0))) / Float64(Float64(c * z) + Float64(t * i)))) + t_1) tmp = 0.0 if (x < -1.469694296777705e-64) tmp = t_2; elseif (x < 3.2113527362226803e-147) tmp = Float64(Float64(Float64(Float64(b * i) - Float64(x * a)) * t) - Float64(Float64(z * Float64(c * b)) - t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = j * ((c * a) - (y * i)); t_2 = ((x * ((y * z) - (t * a))) - ((b * (((c * z) ^ 2.0) - ((t * i) ^ 2.0))) / ((c * z) + (t * i)))) + t_1; tmp = 0.0; if (x < -1.469694296777705e-64) tmp = t_2; elseif (x < 3.2113527362226803e-147) tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(b * N[(N[Power[N[(c * z), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[(t * i), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(c * z), $MachinePrecision] + N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[Less[x, -1.469694296777705e-64], t$95$2, If[Less[x, 3.2113527362226803e-147], N[(N[(N[(N[(b * i), $MachinePrecision] - N[(x * a), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] - N[(N[(z * N[(c * b), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := j \cdot \left(c \cdot a - y \cdot i\right)\\
t_2 := \left(x \cdot \left(y \cdot z - t \cdot a\right) - \frac{b \cdot \left({\left(c \cdot z\right)}^{2} - {\left(t \cdot i\right)}^{2}\right)}{c \cdot z + t \cdot i}\right) + t\_1\\
\mathbf{if}\;x < -1.469694296777705 \cdot 10^{-64}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x < 3.2113527362226803 \cdot 10^{-147}:\\
\;\;\;\;\left(b \cdot i - x \cdot a\right) \cdot t - \left(z \cdot \left(c \cdot b\right) - t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2024352
(FPCore (x y z t a b c i j)
:name "Data.Colour.Matrix:determinant from colour-2.3.3, A"
:precision binary64
:alt
(! :herbie-platform default (if (< x -293938859355541/2000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i)))) (if (< x 32113527362226803/10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (- (* b i) (* x a)) t) (- (* z (* c b)) (* j (- (* c a) (* y i))))) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i)))))))
(+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))