
(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 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i))); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)
\end{array}
(FPCore (x y z t a b c i j)
:precision binary64
(if (<=
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i))))
(* j (- (* c a) (* y i))))
INFINITY)
(fma
(fma (- t) a (* z y))
x
(fma (- b) (fma (- t) i (* c z)) (* (fma (- y) i (* c a)) j)))
(* (* (- x (/ (* c b) y)) y) z)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))) <= ((double) INFINITY)) {
tmp = fma(fma(-t, a, (z * y)), x, fma(-b, fma(-t, i, (c * z)), (fma(-y, i, (c * a)) * j)));
} else {
tmp = ((x - ((c * b) / y)) * y) * z;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (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)))) <= Inf) tmp = fma(fma(Float64(-t), a, Float64(z * y)), x, fma(Float64(-b), fma(Float64(-t), i, Float64(c * z)), Float64(fma(Float64(-y), i, Float64(c * a)) * j))); else tmp = Float64(Float64(Float64(x - Float64(Float64(c * b) / y)) * y) * z); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[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], Infinity], N[(N[((-t) * a + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[((-b) * N[((-t) * i + N[(c * z), $MachinePrecision]), $MachinePrecision] + N[(N[((-y) * i + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - N[(N[(c * b), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\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) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-t, a, z \cdot y\right), x, \mathsf{fma}\left(-b, \mathsf{fma}\left(-t, i, c \cdot z\right), \mathsf{fma}\left(-y, i, c \cdot a\right) \cdot j\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(x - \frac{c \cdot b}{y}\right) \cdot y\right) \cdot z\\
\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 95.3%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites95.3%
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 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-*.f6449.6
Applied rewrites49.6%
Taylor expanded in y around inf
Applied rewrites53.3%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (fma (- t) a (* z y)) x (* (- b) (* c z)))))
(if (<= i -7.8e+53)
(fma (* i t) b (* (fma (- j) i (* z x)) y))
(if (<= i -5.25e-163)
t_1
(if (<= i -4.2e-266)
(fma (* c a) j (* (* x y) z))
(if (<= i 5.4e+165)
t_1
(fma (fma (- c) z (* i t)) b (* (* (- j) i) y))))))))
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(-t, a, (z * y)), x, (-b * (c * z)));
double tmp;
if (i <= -7.8e+53) {
tmp = fma((i * t), b, (fma(-j, i, (z * x)) * y));
} else if (i <= -5.25e-163) {
tmp = t_1;
} else if (i <= -4.2e-266) {
tmp = fma((c * a), j, ((x * y) * z));
} else if (i <= 5.4e+165) {
tmp = t_1;
} else {
tmp = fma(fma(-c, z, (i * t)), b, ((-j * i) * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(fma(Float64(-t), a, Float64(z * y)), x, Float64(Float64(-b) * Float64(c * z))) tmp = 0.0 if (i <= -7.8e+53) tmp = fma(Float64(i * t), b, Float64(fma(Float64(-j), i, Float64(z * x)) * y)); elseif (i <= -5.25e-163) tmp = t_1; elseif (i <= -4.2e-266) tmp = fma(Float64(c * a), j, Float64(Float64(x * y) * z)); elseif (i <= 5.4e+165) tmp = t_1; else tmp = fma(fma(Float64(-c), z, Float64(i * t)), b, Float64(Float64(Float64(-j) * i) * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-t) * a + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[((-b) * N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -7.8e+53], N[(N[(i * t), $MachinePrecision] * b + N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, -5.25e-163], t$95$1, If[LessEqual[i, -4.2e-266], N[(N[(c * a), $MachinePrecision] * j + N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 5.4e+165], t$95$1, N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b + N[(N[((-j) * i), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(-t, a, z \cdot y\right), x, \left(-b\right) \cdot \left(c \cdot z\right)\right)\\
\mathbf{if}\;i \leq -7.8 \cdot 10^{+53}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot t, b, \mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\right)\\
\mathbf{elif}\;i \leq -5.25 \cdot 10^{-163}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;i \leq -4.2 \cdot 10^{-266}:\\
\;\;\;\;\mathsf{fma}\left(c \cdot a, j, \left(x \cdot y\right) \cdot z\right)\\
\mathbf{elif}\;i \leq 5.4 \cdot 10^{+165}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-c, z, i \cdot t\right), b, \left(\left(-j\right) \cdot i\right) \cdot y\right)\\
\end{array}
\end{array}
if i < -7.79999999999999952e53Initial program 68.7%
Taylor expanded in a around 0
Applied rewrites79.9%
Taylor expanded in z around 0
Applied rewrites76.5%
if -7.79999999999999952e53 < i < -5.25e-163 or -4.19999999999999994e-266 < i < 5.3999999999999999e165Initial program 77.0%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites79.8%
Taylor expanded in z around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f6469.3
Applied rewrites69.3%
if -5.25e-163 < i < -4.19999999999999994e-266Initial program 73.8%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6470.5
Applied rewrites70.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6474.8
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift-neg.f64N/A
+-commutativeN/A
lift-fma.f6474.8
Applied rewrites83.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6483.1
Applied rewrites83.1%
if 5.3999999999999999e165 < i Initial program 89.6%
Taylor expanded in a around 0
Applied rewrites81.1%
Taylor expanded in x around 0
Applied rewrites81.1%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- a) x (* i b)) t)) (t_2 (* (fma (- b) c (* y x)) z)))
(if (<= z -2.55e-79)
t_2
(if (<= z -1.3e-259)
t_1
(if (<= z 2.2e-238)
(* (fma (- i) y (* c a)) j)
(if (<= z 9.6e-160)
t_1
(if (<= z 5200000000000.0)
(* (fma (- j) i (* z x)) y)
(if (<= z 3.3e+77) t_1 t_2))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-a, x, (i * b)) * t;
double t_2 = fma(-b, c, (y * x)) * z;
double tmp;
if (z <= -2.55e-79) {
tmp = t_2;
} else if (z <= -1.3e-259) {
tmp = t_1;
} else if (z <= 2.2e-238) {
tmp = fma(-i, y, (c * a)) * j;
} else if (z <= 9.6e-160) {
tmp = t_1;
} else if (z <= 5200000000000.0) {
tmp = fma(-j, i, (z * x)) * y;
} else if (z <= 3.3e+77) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-a), x, Float64(i * b)) * t) t_2 = Float64(fma(Float64(-b), c, Float64(y * x)) * z) tmp = 0.0 if (z <= -2.55e-79) tmp = t_2; elseif (z <= -1.3e-259) tmp = t_1; elseif (z <= 2.2e-238) tmp = Float64(fma(Float64(-i), y, Float64(c * a)) * j); elseif (z <= 9.6e-160) tmp = t_1; elseif (z <= 5200000000000.0) tmp = Float64(fma(Float64(-j), i, Float64(z * x)) * y); elseif (z <= 3.3e+77) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -2.55e-79], t$95$2, If[LessEqual[z, -1.3e-259], t$95$1, If[LessEqual[z, 2.2e-238], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[z, 9.6e-160], t$95$1, If[LessEqual[z, 5200000000000.0], N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 3.3e+77], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\\
t_2 := \mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{if}\;z \leq -2.55 \cdot 10^{-79}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{-259}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-238}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{-160}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5200000000000:\\
\;\;\;\;\mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+77}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -2.55e-79 or 3.2999999999999998e77 < z Initial program 68.8%
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-*.f6469.3
Applied rewrites69.3%
if -2.55e-79 < z < -1.3e-259 or 2.19999999999999991e-238 < z < 9.59999999999999964e-160 or 5.2e12 < z < 3.2999999999999998e77Initial program 85.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6463.3
Applied rewrites63.3%
if -1.3e-259 < z < 2.19999999999999991e-238Initial program 74.1%
Taylor expanded in a around 0
Applied rewrites57.7%
Taylor expanded in j around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
if 9.59999999999999964e-160 < z < 5.2e12Initial program 88.2%
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-*.f6460.5
Applied rewrites60.5%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- z) b (* j a)) c)))
(if (<= c -1.8e+168)
t_1
(if (<= c -2.7e-39)
(fma (fma (- y) i (* c a)) j (* (* x y) z))
(if (<= c -2.8e-93)
(fma (* (- b) z) c (* (fma (- a) t (* z y)) x))
(if (<= c 5.5e+113)
(fma (* i t) b (* (fma (- j) i (* z x)) y))
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(-z, b, (j * a)) * c;
double tmp;
if (c <= -1.8e+168) {
tmp = t_1;
} else if (c <= -2.7e-39) {
tmp = fma(fma(-y, i, (c * a)), j, ((x * y) * z));
} else if (c <= -2.8e-93) {
tmp = fma((-b * z), c, (fma(-a, t, (z * y)) * x));
} else if (c <= 5.5e+113) {
tmp = fma((i * t), b, (fma(-j, i, (z * x)) * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-z), b, Float64(j * a)) * c) tmp = 0.0 if (c <= -1.8e+168) tmp = t_1; elseif (c <= -2.7e-39) tmp = fma(fma(Float64(-y), i, Float64(c * a)), j, Float64(Float64(x * y) * z)); elseif (c <= -2.8e-93) tmp = fma(Float64(Float64(-b) * z), c, Float64(fma(Float64(-a), t, Float64(z * y)) * x)); elseif (c <= 5.5e+113) tmp = fma(Float64(i * t), b, Float64(fma(Float64(-j), i, Float64(z * x)) * y)); 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) * b + N[(j * a), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, If[LessEqual[c, -1.8e+168], t$95$1, If[LessEqual[c, -2.7e-39], N[(N[((-y) * i + N[(c * a), $MachinePrecision]), $MachinePrecision] * j + N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -2.8e-93], N[(N[((-b) * z), $MachinePrecision] * c + N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 5.5e+113], N[(N[(i * t), $MachinePrecision] * b + N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-z, b, j \cdot a\right) \cdot c\\
\mathbf{if}\;c \leq -1.8 \cdot 10^{+168}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq -2.7 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-y, i, c \cdot a\right), j, \left(x \cdot y\right) \cdot z\right)\\
\mathbf{elif}\;c \leq -2.8 \cdot 10^{-93}:\\
\;\;\;\;\mathsf{fma}\left(\left(-b\right) \cdot z, c, \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right)\\
\mathbf{elif}\;c \leq 5.5 \cdot 10^{+113}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot t, b, \mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -1.8e168 or 5.5000000000000001e113 < c Initial program 67.3%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/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-*.f6473.1
Applied rewrites73.1%
if -1.8e168 < c < -2.7000000000000001e-39Initial program 73.6%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6471.8
Applied rewrites71.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6474.5
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift-neg.f64N/A
+-commutativeN/A
lift-fma.f6474.5
Applied rewrites74.7%
if -2.7000000000000001e-39 < c < -2.79999999999999998e-93Initial program 73.1%
Taylor expanded in i around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-lft-neg-inN/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
*-commutativeN/A
Applied rewrites82.3%
Taylor expanded in z around inf
Applied rewrites82.3%
if -2.79999999999999998e-93 < c < 5.5000000000000001e113Initial program 81.6%
Taylor expanded in a around 0
Applied rewrites77.2%
Taylor expanded in z around 0
Applied rewrites70.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- z) b (* j a)) c)))
(if (<= c -1.8e+168)
t_1
(if (<= c -2.75e-39)
(fma (fma (- y) i (* c a)) j (* (* x y) z))
(if (<= c -8.8e-93)
(* (* (fma (- a) (/ x i) b) i) t)
(if (<= c 5.5e+113)
(fma (* i t) b (* (fma (- j) i (* z x)) y))
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(-z, b, (j * a)) * c;
double tmp;
if (c <= -1.8e+168) {
tmp = t_1;
} else if (c <= -2.75e-39) {
tmp = fma(fma(-y, i, (c * a)), j, ((x * y) * z));
} else if (c <= -8.8e-93) {
tmp = (fma(-a, (x / i), b) * i) * t;
} else if (c <= 5.5e+113) {
tmp = fma((i * t), b, (fma(-j, i, (z * x)) * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-z), b, Float64(j * a)) * c) tmp = 0.0 if (c <= -1.8e+168) tmp = t_1; elseif (c <= -2.75e-39) tmp = fma(fma(Float64(-y), i, Float64(c * a)), j, Float64(Float64(x * y) * z)); elseif (c <= -8.8e-93) tmp = Float64(Float64(fma(Float64(-a), Float64(x / i), b) * i) * t); elseif (c <= 5.5e+113) tmp = fma(Float64(i * t), b, Float64(fma(Float64(-j), i, Float64(z * x)) * y)); 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) * b + N[(j * a), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]}, If[LessEqual[c, -1.8e+168], t$95$1, If[LessEqual[c, -2.75e-39], N[(N[((-y) * i + N[(c * a), $MachinePrecision]), $MachinePrecision] * j + N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -8.8e-93], N[(N[(N[((-a) * N[(x / i), $MachinePrecision] + b), $MachinePrecision] * i), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[c, 5.5e+113], N[(N[(i * t), $MachinePrecision] * b + N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-z, b, j \cdot a\right) \cdot c\\
\mathbf{if}\;c \leq -1.8 \cdot 10^{+168}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq -2.75 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-y, i, c \cdot a\right), j, \left(x \cdot y\right) \cdot z\right)\\
\mathbf{elif}\;c \leq -8.8 \cdot 10^{-93}:\\
\;\;\;\;\left(\mathsf{fma}\left(-a, \frac{x}{i}, b\right) \cdot i\right) \cdot t\\
\mathbf{elif}\;c \leq 5.5 \cdot 10^{+113}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot t, b, \mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -1.8e168 or 5.5000000000000001e113 < c Initial program 67.3%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/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-*.f6473.1
Applied rewrites73.1%
if -1.8e168 < c < -2.75000000000000009e-39Initial program 73.6%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6471.8
Applied rewrites71.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6474.5
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift-neg.f64N/A
+-commutativeN/A
lift-fma.f6474.5
Applied rewrites74.7%
if -2.75000000000000009e-39 < c < -8.79999999999999983e-93Initial program 73.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6473.3
Applied rewrites73.3%
Taylor expanded in i around inf
Applied rewrites73.4%
if -8.79999999999999983e-93 < c < 5.5000000000000001e113Initial program 81.6%
Taylor expanded in a around 0
Applied rewrites77.2%
Taylor expanded in z around 0
Applied rewrites70.8%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= b -8e+101) (not (<= b 6e-140))) (fma (fma (- c) z (* i t)) b (* (fma (- j) i (* z x)) y)) (fma (fma (- a) t (* z y)) 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 ((b <= -8e+101) || !(b <= 6e-140)) {
tmp = fma(fma(-c, z, (i * t)), b, (fma(-j, i, (z * x)) * y));
} else {
tmp = fma(fma(-a, t, (z * y)), x, (fma(-i, y, (c * a)) * j));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((b <= -8e+101) || !(b <= 6e-140)) tmp = fma(fma(Float64(-c), z, Float64(i * t)), b, Float64(fma(Float64(-j), i, Float64(z * x)) * y)); else tmp = fma(fma(Float64(-a), t, Float64(z * y)), x, 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[b, -8e+101], N[Not[LessEqual[b, 6e-140]], $MachinePrecision]], N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b + N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8 \cdot 10^{+101} \lor \neg \left(b \leq 6 \cdot 10^{-140}\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-c, z, i \cdot t\right), b, \mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-a, t, z \cdot y\right), x, \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\right)\\
\end{array}
\end{array}
if b < -7.9999999999999998e101 or 6.00000000000000037e-140 < b Initial program 73.1%
Taylor expanded in a around 0
Applied rewrites80.1%
if -7.9999999999999998e101 < b < 6.00000000000000037e-140Initial program 79.6%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites79.2%
Final simplification79.7%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (- c) z (* i t))))
(if (<= b -4.8e+116)
(fma t_1 b (* (* (- j) i) y))
(if (<= b 8.6e-33)
(fma (fma (- a) t (* z y)) x (* (fma (- i) y (* c a)) j))
(* t_1 b)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-c, z, (i * t));
double tmp;
if (b <= -4.8e+116) {
tmp = fma(t_1, b, ((-j * i) * y));
} else if (b <= 8.6e-33) {
tmp = fma(fma(-a, t, (z * y)), x, (fma(-i, y, (c * a)) * j));
} else {
tmp = t_1 * b;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(Float64(-c), z, Float64(i * t)) tmp = 0.0 if (b <= -4.8e+116) tmp = fma(t_1, b, Float64(Float64(Float64(-j) * i) * y)); elseif (b <= 8.6e-33) tmp = fma(fma(Float64(-a), t, Float64(z * y)), x, Float64(fma(Float64(-i), y, Float64(c * a)) * j)); else tmp = Float64(t_1 * b); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -4.8e+116], N[(t$95$1 * b + N[(N[((-j) * i), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.6e-33], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-c, z, i \cdot t\right)\\
\mathbf{if}\;b \leq -4.8 \cdot 10^{+116}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, b, \left(\left(-j\right) \cdot i\right) \cdot y\right)\\
\mathbf{elif}\;b \leq 8.6 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-a, t, z \cdot y\right), x, \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot b\\
\end{array}
\end{array}
if b < -4.8000000000000001e116Initial program 72.9%
Taylor expanded in a around 0
Applied rewrites87.8%
Taylor expanded in x around 0
Applied rewrites84.9%
if -4.8000000000000001e116 < b < 8.60000000000000062e-33Initial program 78.6%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.2%
if 8.60000000000000062e-33 < b Initial program 73.2%
Taylor expanded in b around inf
fp-cancel-sub-sign-invN/A
distribute-rgt-inN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-outN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-lft-neg-outN/A
mul-1-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-sign-invN/A
Applied rewrites65.9%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- c) z (* i t)) b)))
(if (<= b -2.9e+116)
t_1
(if (<= b -3.7e-274)
(* (fma (- t) a (* y z)) x)
(if (<= b 4e-268)
(* (fma (- i) y (* c a)) j)
(if (<= b 2.75e-39) (* (fma (- j) i (* z x)) y) 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(-c, z, (i * t)) * b;
double tmp;
if (b <= -2.9e+116) {
tmp = t_1;
} else if (b <= -3.7e-274) {
tmp = fma(-t, a, (y * z)) * x;
} else if (b <= 4e-268) {
tmp = fma(-i, y, (c * a)) * j;
} else if (b <= 2.75e-39) {
tmp = fma(-j, i, (z * x)) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-c), z, Float64(i * t)) * b) tmp = 0.0 if (b <= -2.9e+116) tmp = t_1; elseif (b <= -3.7e-274) tmp = Float64(fma(Float64(-t), a, Float64(y * z)) * x); elseif (b <= 4e-268) tmp = Float64(fma(Float64(-i), y, Float64(c * a)) * j); elseif (b <= 2.75e-39) tmp = Float64(fma(Float64(-j), i, Float64(z * x)) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-c) * z + N[(i * t), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -2.9e+116], t$95$1, If[LessEqual[b, -3.7e-274], N[(N[((-t) * a + N[(y * z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[b, 4e-268], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[b, 2.75e-39], N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-c, z, i \cdot t\right) \cdot b\\
\mathbf{if}\;b \leq -2.9 \cdot 10^{+116}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq -3.7 \cdot 10^{-274}:\\
\;\;\;\;\mathsf{fma}\left(-t, a, y \cdot z\right) \cdot x\\
\mathbf{elif}\;b \leq 4 \cdot 10^{-268}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\mathbf{elif}\;b \leq 2.75 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -2.9000000000000001e116 or 2.75000000000000009e-39 < b Initial program 73.1%
Taylor expanded in b around inf
fp-cancel-sub-sign-invN/A
distribute-rgt-inN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-outN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-lft-neg-outN/A
mul-1-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-sign-invN/A
Applied rewrites69.7%
if -2.9000000000000001e116 < b < -3.69999999999999984e-274Initial program 75.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6435.2
Applied rewrites35.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-*.f6458.8
Applied rewrites58.8%
if -3.69999999999999984e-274 < b < 3.99999999999999983e-268Initial program 79.0%
Taylor expanded in a around 0
Applied rewrites41.2%
Taylor expanded in j around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6459.9
Applied rewrites59.9%
if 3.99999999999999983e-268 < b < 2.75000000000000009e-39Initial program 83.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-*.f6464.3
Applied rewrites64.3%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma (- a) x (* i b)) t)) (t_2 (* (fma (- b) c (* y x)) z)))
(if (<= z -2.55e-79)
t_2
(if (<= z -1.3e-259)
t_1
(if (<= z 2.2e-238)
(* (fma (- i) y (* c a)) j)
(if (<= z 3.3e+77) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-a, x, (i * b)) * t;
double t_2 = fma(-b, c, (y * x)) * z;
double tmp;
if (z <= -2.55e-79) {
tmp = t_2;
} else if (z <= -1.3e-259) {
tmp = t_1;
} else if (z <= 2.2e-238) {
tmp = fma(-i, y, (c * a)) * j;
} else if (z <= 3.3e+77) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(Float64(-a), x, Float64(i * b)) * t) t_2 = Float64(fma(Float64(-b), c, Float64(y * x)) * z) tmp = 0.0 if (z <= -2.55e-79) tmp = t_2; elseif (z <= -1.3e-259) tmp = t_1; elseif (z <= 2.2e-238) tmp = Float64(fma(Float64(-i), y, Float64(c * a)) * j); elseif (z <= 3.3e+77) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-b) * c + N[(y * x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -2.55e-79], t$95$2, If[LessEqual[z, -1.3e-259], t$95$1, If[LessEqual[z, 2.2e-238], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[z, 3.3e+77], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\\
t_2 := \mathsf{fma}\left(-b, c, y \cdot x\right) \cdot z\\
\mathbf{if}\;z \leq -2.55 \cdot 10^{-79}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{-259}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-238}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+77}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -2.55e-79 or 3.2999999999999998e77 < z Initial program 68.8%
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-*.f6469.3
Applied rewrites69.3%
if -2.55e-79 < z < -1.3e-259 or 2.19999999999999991e-238 < z < 3.2999999999999998e77Initial program 86.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6452.9
Applied rewrites52.9%
if -1.3e-259 < z < 2.19999999999999991e-238Initial program 74.1%
Taylor expanded in a around 0
Applied rewrites57.7%
Taylor expanded in j around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= c -8e+89) (not (<= c 5.5e+113))) (* (fma (- z) b (* j a)) c) (fma (* i t) b (* (fma (- j) i (* z x)) y))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((c <= -8e+89) || !(c <= 5.5e+113)) {
tmp = fma(-z, b, (j * a)) * c;
} else {
tmp = fma((i * t), b, (fma(-j, i, (z * x)) * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((c <= -8e+89) || !(c <= 5.5e+113)) tmp = Float64(fma(Float64(-z), b, Float64(j * a)) * c); else tmp = fma(Float64(i * t), b, Float64(fma(Float64(-j), i, Float64(z * x)) * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[c, -8e+89], N[Not[LessEqual[c, 5.5e+113]], $MachinePrecision]], N[(N[((-z) * b + N[(j * a), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], N[(N[(i * t), $MachinePrecision] * b + N[(N[((-j) * i + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -8 \cdot 10^{+89} \lor \neg \left(c \leq 5.5 \cdot 10^{+113}\right):\\
\;\;\;\;\mathsf{fma}\left(-z, b, j \cdot a\right) \cdot c\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i \cdot t, b, \mathsf{fma}\left(-j, i, z \cdot x\right) \cdot y\right)\\
\end{array}
\end{array}
if c < -7.99999999999999996e89 or 5.5000000000000001e113 < c Initial program 68.4%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/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-*.f6471.0
Applied rewrites71.0%
if -7.99999999999999996e89 < c < 5.5000000000000001e113Initial program 79.8%
Taylor expanded in a around 0
Applied rewrites73.2%
Taylor expanded in z around 0
Applied rewrites67.1%
Final simplification68.3%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* z y) x)))
(if (<= x -6.5e+100)
t_1
(if (<= x -2e-293)
(* (* i t) b)
(if (<= x 2.9e-74)
(* (* j a) c)
(if (<= x 3.3e+109) (* (* (- a) x) 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 = (z * y) * x;
double tmp;
if (x <= -6.5e+100) {
tmp = t_1;
} else if (x <= -2e-293) {
tmp = (i * t) * b;
} else if (x <= 2.9e-74) {
tmp = (j * a) * c;
} else if (x <= 3.3e+109) {
tmp = (-a * x) * 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 = (z * y) * x
if (x <= (-6.5d+100)) then
tmp = t_1
else if (x <= (-2d-293)) then
tmp = (i * t) * b
else if (x <= 2.9d-74) then
tmp = (j * a) * c
else if (x <= 3.3d+109) then
tmp = (-a * x) * 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 = (z * y) * x;
double tmp;
if (x <= -6.5e+100) {
tmp = t_1;
} else if (x <= -2e-293) {
tmp = (i * t) * b;
} else if (x <= 2.9e-74) {
tmp = (j * a) * c;
} else if (x <= 3.3e+109) {
tmp = (-a * x) * t;
} 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 x <= -6.5e+100: tmp = t_1 elif x <= -2e-293: tmp = (i * t) * b elif x <= 2.9e-74: tmp = (j * a) * c elif x <= 3.3e+109: tmp = (-a * x) * t 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 (x <= -6.5e+100) tmp = t_1; elseif (x <= -2e-293) tmp = Float64(Float64(i * t) * b); elseif (x <= 2.9e-74) tmp = Float64(Float64(j * a) * c); elseif (x <= 3.3e+109) tmp = Float64(Float64(Float64(-a) * x) * t); 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 (x <= -6.5e+100) tmp = t_1; elseif (x <= -2e-293) tmp = (i * t) * b; elseif (x <= 2.9e-74) tmp = (j * a) * c; elseif (x <= 3.3e+109) tmp = (-a * x) * 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[(z * y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -6.5e+100], t$95$1, If[LessEqual[x, -2e-293], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[x, 2.9e-74], N[(N[(j * a), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[x, 3.3e+109], N[(N[((-a) * x), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot y\right) \cdot x\\
\mathbf{if}\;x \leq -6.5 \cdot 10^{+100}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-293}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-74}:\\
\;\;\;\;\left(j \cdot a\right) \cdot c\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{+109}:\\
\;\;\;\;\left(\left(-a\right) \cdot x\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.50000000000000001e100 or 3.2999999999999999e109 < x Initial program 76.6%
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-*.f6458.3
Applied rewrites58.3%
Taylor expanded in x around inf
Applied rewrites49.1%
if -6.50000000000000001e100 < x < -2.0000000000000001e-293Initial program 72.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6435.9
Applied rewrites35.9%
Taylor expanded in x around 0
Applied rewrites37.5%
if -2.0000000000000001e-293 < x < 2.9e-74Initial program 71.0%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/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-*.f6455.1
Applied rewrites55.1%
Taylor expanded in z around 0
Applied rewrites45.8%
if 2.9e-74 < x < 3.2999999999999999e109Initial program 89.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6452.1
Applied rewrites52.1%
Taylor expanded in x around inf
Applied rewrites32.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (- b) (* c z))))
(if (<= z -3.55e+227)
t_1
(if (<= z -1.05e-75)
(* (* z y) x)
(if (<= z 9.6e+77) (* (fma (- a) x (* i b)) 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 = -b * (c * z);
double tmp;
if (z <= -3.55e+227) {
tmp = t_1;
} else if (z <= -1.05e-75) {
tmp = (z * y) * x;
} else if (z <= 9.6e+77) {
tmp = fma(-a, x, (i * b)) * t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(-b) * Float64(c * z)) tmp = 0.0 if (z <= -3.55e+227) tmp = t_1; elseif (z <= -1.05e-75) tmp = Float64(Float64(z * y) * x); elseif (z <= 9.6e+77) tmp = Float64(fma(Float64(-a), x, Float64(i * b)) * t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-b) * N[(c * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.55e+227], t$95$1, If[LessEqual[z, -1.05e-75], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 9.6e+77], N[(N[((-a) * x + N[(i * b), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-b\right) \cdot \left(c \cdot z\right)\\
\mathbf{if}\;z \leq -3.55 \cdot 10^{+227}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-75}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{+77}:\\
\;\;\;\;\mathsf{fma}\left(-a, x, i \cdot b\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.5500000000000001e227 or 9.5999999999999994e77 < z Initial program 63.5%
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-*.f6475.8
Applied rewrites75.8%
Taylor expanded in x around 0
Applied rewrites51.1%
if -3.5500000000000001e227 < z < -1.0500000000000001e-75Initial program 73.6%
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-*.f6462.5
Applied rewrites62.5%
Taylor expanded in x around inf
Applied rewrites44.8%
if -1.0500000000000001e-75 < z < 9.5999999999999994e77Initial program 84.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6448.1
Applied rewrites48.1%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* i t) b)) (t_2 (* (* z y) x)))
(if (<= x -6.5e+100)
t_2
(if (<= x -2e-293)
t_1
(if (<= x 8e-113) (* (* j a) c) (if (<= x 1.32e+88) 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 = (i * t) * b;
double t_2 = (z * y) * x;
double tmp;
if (x <= -6.5e+100) {
tmp = t_2;
} else if (x <= -2e-293) {
tmp = t_1;
} else if (x <= 8e-113) {
tmp = (j * a) * c;
} else if (x <= 1.32e+88) {
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 = (i * t) * b
t_2 = (z * y) * x
if (x <= (-6.5d+100)) then
tmp = t_2
else if (x <= (-2d-293)) then
tmp = t_1
else if (x <= 8d-113) then
tmp = (j * a) * c
else if (x <= 1.32d+88) 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 = (i * t) * b;
double t_2 = (z * y) * x;
double tmp;
if (x <= -6.5e+100) {
tmp = t_2;
} else if (x <= -2e-293) {
tmp = t_1;
} else if (x <= 8e-113) {
tmp = (j * a) * c;
} else if (x <= 1.32e+88) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (i * t) * b t_2 = (z * y) * x tmp = 0 if x <= -6.5e+100: tmp = t_2 elif x <= -2e-293: tmp = t_1 elif x <= 8e-113: tmp = (j * a) * c elif x <= 1.32e+88: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(i * t) * b) t_2 = Float64(Float64(z * y) * x) tmp = 0.0 if (x <= -6.5e+100) tmp = t_2; elseif (x <= -2e-293) tmp = t_1; elseif (x <= 8e-113) tmp = Float64(Float64(j * a) * c); elseif (x <= 1.32e+88) 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 = (i * t) * b; t_2 = (z * y) * x; tmp = 0.0; if (x <= -6.5e+100) tmp = t_2; elseif (x <= -2e-293) tmp = t_1; elseif (x <= 8e-113) tmp = (j * a) * c; elseif (x <= 1.32e+88) 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[(i * t), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -6.5e+100], t$95$2, If[LessEqual[x, -2e-293], t$95$1, If[LessEqual[x, 8e-113], N[(N[(j * a), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[x, 1.32e+88], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(i \cdot t\right) \cdot b\\
t_2 := \left(z \cdot y\right) \cdot x\\
\mathbf{if}\;x \leq -6.5 \cdot 10^{+100}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-293}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-113}:\\
\;\;\;\;\left(j \cdot a\right) \cdot c\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -6.50000000000000001e100 or 1.3200000000000001e88 < x Initial program 77.0%
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-*.f6457.3
Applied rewrites57.3%
Taylor expanded in x around inf
Applied rewrites48.2%
if -6.50000000000000001e100 < x < -2.0000000000000001e-293 or 7.99999999999999983e-113 < x < 1.3200000000000001e88Initial program 75.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6441.0
Applied rewrites41.0%
Taylor expanded in x around 0
Applied rewrites35.0%
if -2.0000000000000001e-293 < x < 7.99999999999999983e-113Initial program 75.5%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/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-*.f6456.0
Applied rewrites56.0%
Taylor expanded in z around 0
Applied rewrites50.3%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= z -2.55e-79) (not (<= z 3.3e+77))) (* (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 <= -2.55e-79) || !(z <= 3.3e+77)) {
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 <= -2.55e-79) || !(z <= 3.3e+77)) 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, -2.55e-79], N[Not[LessEqual[z, 3.3e+77]], $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 -2.55 \cdot 10^{-79} \lor \neg \left(z \leq 3.3 \cdot 10^{+77}\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 < -2.55e-79 or 3.2999999999999998e77 < z Initial program 68.8%
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-*.f6469.3
Applied rewrites69.3%
if -2.55e-79 < z < 3.2999999999999998e77Initial program 84.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6448.8
Applied rewrites48.8%
Final simplification59.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* i t) b)))
(if (<= i -2.8e-15)
t_1
(if (<= i 7.1e-71)
(* (* z y) x)
(if (<= i 3e+111) (* (* (- t) a) 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 = (i * t) * b;
double tmp;
if (i <= -2.8e-15) {
tmp = t_1;
} else if (i <= 7.1e-71) {
tmp = (z * y) * x;
} else if (i <= 3e+111) {
tmp = (-t * a) * x;
} 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 = (i * t) * b
if (i <= (-2.8d-15)) then
tmp = t_1
else if (i <= 7.1d-71) then
tmp = (z * y) * x
else if (i <= 3d+111) then
tmp = (-t * a) * x
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 = (i * t) * b;
double tmp;
if (i <= -2.8e-15) {
tmp = t_1;
} else if (i <= 7.1e-71) {
tmp = (z * y) * x;
} else if (i <= 3e+111) {
tmp = (-t * a) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (i * t) * b tmp = 0 if i <= -2.8e-15: tmp = t_1 elif i <= 7.1e-71: tmp = (z * y) * x elif i <= 3e+111: tmp = (-t * a) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(i * t) * b) tmp = 0.0 if (i <= -2.8e-15) tmp = t_1; elseif (i <= 7.1e-71) tmp = Float64(Float64(z * y) * x); elseif (i <= 3e+111) tmp = Float64(Float64(Float64(-t) * a) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (i * t) * b; tmp = 0.0; if (i <= -2.8e-15) tmp = t_1; elseif (i <= 7.1e-71) tmp = (z * y) * x; elseif (i <= 3e+111) tmp = (-t * a) * x; 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[(i * t), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[i, -2.8e-15], t$95$1, If[LessEqual[i, 7.1e-71], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[i, 3e+111], N[(N[((-t) * a), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(i \cdot t\right) \cdot b\\
\mathbf{if}\;i \leq -2.8 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;i \leq 7.1 \cdot 10^{-71}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\mathbf{elif}\;i \leq 3 \cdot 10^{+111}:\\
\;\;\;\;\left(\left(-t\right) \cdot a\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if i < -2.80000000000000014e-15 or 3e111 < i Initial program 73.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6443.5
Applied rewrites43.5%
Taylor expanded in x around 0
Applied rewrites46.2%
if -2.80000000000000014e-15 < i < 7.10000000000000008e-71Initial program 78.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-*.f6457.8
Applied rewrites57.8%
Taylor expanded in x around inf
Applied rewrites38.8%
if 7.10000000000000008e-71 < i < 3e111Initial program 79.0%
Taylor expanded in b around inf
Applied rewrites74.9%
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
*-commutativeN/A
lower-*.f6454.0
Applied rewrites54.0%
Taylor expanded in y around 0
Applied rewrites37.3%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= i -2.8e-15) (not (<= i 9e+170))) (* (* i t) b) (* (* z y) x)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((i <= -2.8e-15) || !(i <= 9e+170)) {
tmp = (i * t) * b;
} else {
tmp = (z * y) * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: tmp
if ((i <= (-2.8d-15)) .or. (.not. (i <= 9d+170))) then
tmp = (i * t) * b
else
tmp = (z * y) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((i <= -2.8e-15) || !(i <= 9e+170)) {
tmp = (i * t) * b;
} else {
tmp = (z * y) * x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (i <= -2.8e-15) or not (i <= 9e+170): tmp = (i * t) * b else: tmp = (z * y) * x return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((i <= -2.8e-15) || !(i <= 9e+170)) tmp = Float64(Float64(i * t) * b); else tmp = Float64(Float64(z * y) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((i <= -2.8e-15) || ~((i <= 9e+170))) tmp = (i * t) * b; else tmp = (z * y) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[i, -2.8e-15], N[Not[LessEqual[i, 9e+170]], $MachinePrecision]], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2.8 \cdot 10^{-15} \lor \neg \left(i \leq 9 \cdot 10^{+170}\right):\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot x\\
\end{array}
\end{array}
if i < -2.80000000000000014e-15 or 9.00000000000000044e170 < i Initial program 76.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6445.1
Applied rewrites45.1%
Taylor expanded in x around 0
Applied rewrites49.1%
if -2.80000000000000014e-15 < i < 9.00000000000000044e170Initial program 76.2%
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-*.f6452.6
Applied rewrites52.6%
Taylor expanded in x around inf
Applied rewrites33.5%
Final simplification39.4%
(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 76.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6437.9
Applied rewrites37.9%
Taylor expanded in x around 0
Applied rewrites25.4%
(FPCore (x y z t a b c i j) :precision binary64 (* (* b t) i))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return (b * t) * 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 = (b * t) * 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 (b * t) * i;
}
def code(x, y, z, t, a, b, c, i, j): return (b * t) * i
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(b * t) * i) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = (b * t) * i; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(b * t), $MachinePrecision] * i), $MachinePrecision]
\begin{array}{l}
\\
\left(b \cdot t\right) \cdot i
\end{array}
Initial program 76.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6437.9
Applied rewrites37.9%
Taylor expanded in x around 0
Applied rewrites25.4%
Applied rewrites23.3%
(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 2025017
(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)))))