
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)))
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(i * a)))) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y))); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)));
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)))
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(i * a)))) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y))); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\end{array}
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a))))
(* j (- (* c t) (* i y))))))
(if (<= t_1 INFINITY) t_1 (* (* c (- t (/ (* b z) j))) j))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (c * (t - ((b * z) / j))) * j;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (c * (t - ((b * z) / j))) * j;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y))) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = (c * (t - ((b * z) / j))) * j return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(i * a)))) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(c * Float64(t - Float64(Float64(b * z) / j))) * j); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y))); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = (c * (t - ((b * z) / j))) * j; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(c * N[(t - N[(N[(b * z), $MachinePrecision] / j), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(c \cdot \left(t - \frac{b \cdot z}{j}\right)\right) \cdot j\\
\end{array}
\end{array}
if (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y)))) < +inf.0Initial program 90.3%
if +inf.0 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y)))) Initial program 0.0%
Taylor expanded in j around inf
Applied rewrites40.8%
Taylor expanded in c around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f6457.7
Applied rewrites57.7%
(FPCore (x y z t a b c i j)
:precision binary64
(if (<= c -4.5e+126)
(* (* c (- t (/ (* b z) j))) j)
(if (<= c -180000.0)
(* (fma (- i) y (* c t)) j)
(if (<= c 3.85e-171)
(* (fma (- a) t (* z y)) x)
(if (<= c 1e-33)
(* (* y (- (/ (* x z) j) i)) j)
(* c (- (* j t) (* b z))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if (c <= -4.5e+126) {
tmp = (c * (t - ((b * z) / j))) * j;
} else if (c <= -180000.0) {
tmp = fma(-i, y, (c * t)) * j;
} else if (c <= 3.85e-171) {
tmp = fma(-a, t, (z * y)) * x;
} else if (c <= 1e-33) {
tmp = (y * (((x * z) / j) - i)) * j;
} else {
tmp = c * ((j * t) - (b * z));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if (c <= -4.5e+126) tmp = Float64(Float64(c * Float64(t - Float64(Float64(b * z) / j))) * j); elseif (c <= -180000.0) tmp = Float64(fma(Float64(-i), y, Float64(c * t)) * j); elseif (c <= 3.85e-171) tmp = Float64(fma(Float64(-a), t, Float64(z * y)) * x); elseif (c <= 1e-33) tmp = Float64(Float64(y * Float64(Float64(Float64(x * z) / j) - i)) * j); else tmp = Float64(c * Float64(Float64(j * t) - Float64(b * z))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[c, -4.5e+126], N[(N[(c * N[(t - N[(N[(b * z), $MachinePrecision] / j), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[c, -180000.0], N[(N[((-i) * y + N[(c * t), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[c, 3.85e-171], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[c, 1e-33], N[(N[(y * N[(N[(N[(x * z), $MachinePrecision] / j), $MachinePrecision] - i), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], N[(c * N[(N[(j * t), $MachinePrecision] - N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -4.5 \cdot 10^{+126}:\\
\;\;\;\;\left(c \cdot \left(t - \frac{b \cdot z}{j}\right)\right) \cdot j\\
\mathbf{elif}\;c \leq -180000:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot t\right) \cdot j\\
\mathbf{elif}\;c \leq 3.85 \cdot 10^{-171}:\\
\;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\
\mathbf{elif}\;c \leq 10^{-33}:\\
\;\;\;\;\left(y \cdot \left(\frac{x \cdot z}{j} - i\right)\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(j \cdot t - b \cdot z\right)\\
\end{array}
\end{array}
if c < -4.49999999999999974e126Initial program 70.3%
Taylor expanded in j around inf
Applied rewrites65.7%
Taylor expanded in c around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f6468.8
Applied rewrites68.8%
if -4.49999999999999974e126 < c < -1.8e5Initial program 99.5%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6460.2
Applied rewrites60.2%
if -1.8e5 < c < 3.8499999999999998e-171Initial program 78.5%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/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-*.f6455.2
Applied rewrites55.2%
if 3.8499999999999998e-171 < c < 1.0000000000000001e-33Initial program 80.4%
Taylor expanded in j around inf
Applied rewrites80.7%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-*.f6474.3
Applied rewrites74.3%
if 1.0000000000000001e-33 < c Initial program 55.1%
Taylor expanded in j around inf
Applied rewrites58.2%
Taylor expanded in c around inf
lower-*.f64N/A
lower--.f64N/A
lift-*.f64N/A
lift-*.f6466.3
Applied rewrites66.3%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (fma (- a) t (* z y))))
(if (or (<= j -9.4e+114) (not (<= j 9.5e+34)))
(fma t_1 x (* (fma (- i) y (* c t)) j))
(fma t_1 x (* (- b) (fma (- a) i (* c z)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(-a, t, (z * y));
double tmp;
if ((j <= -9.4e+114) || !(j <= 9.5e+34)) {
tmp = fma(t_1, x, (fma(-i, y, (c * t)) * j));
} else {
tmp = fma(t_1, x, (-b * fma(-a, i, (c * z))));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = fma(Float64(-a), t, Float64(z * y)) tmp = 0.0 if ((j <= -9.4e+114) || !(j <= 9.5e+34)) tmp = fma(t_1, x, Float64(fma(Float64(-i), y, Float64(c * t)) * j)); else tmp = fma(t_1, x, Float64(Float64(-b) * fma(Float64(-a), i, Float64(c * z)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[j, -9.4e+114], N[Not[LessEqual[j, 9.5e+34]], $MachinePrecision]], N[(t$95$1 * x + N[(N[((-i) * y + N[(c * t), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * x + N[((-b) * N[((-a) * i + N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, t, z \cdot y\right)\\
\mathbf{if}\;j \leq -9.4 \cdot 10^{+114} \lor \neg \left(j \leq 9.5 \cdot 10^{+34}\right):\\
\;\;\;\;\mathsf{fma}\left(t\_1, x, \mathsf{fma}\left(-i, y, c \cdot t\right) \cdot j\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, x, \left(-b\right) \cdot \mathsf{fma}\left(-a, i, c \cdot z\right)\right)\\
\end{array}
\end{array}
if j < -9.4000000000000001e114 or 9.4999999999999999e34 < j Initial program 71.5%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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
Applied rewrites80.4%
if -9.4000000000000001e114 < j < 9.4999999999999999e34Initial program 73.9%
Taylor expanded in j around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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
Applied rewrites75.5%
Final simplification77.4%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= b -2.05e+163) (not (<= b 8.5e+64))) (* (fma i a (* (- c) z)) b) (fma (fma (- a) t (* z y)) x (* (fma (- i) y (* c t)) j))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((b <= -2.05e+163) || !(b <= 8.5e+64)) {
tmp = fma(i, a, (-c * z)) * b;
} else {
tmp = fma(fma(-a, t, (z * y)), x, (fma(-i, y, (c * t)) * j));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((b <= -2.05e+163) || !(b <= 8.5e+64)) tmp = Float64(fma(i, a, Float64(Float64(-c) * z)) * b); else tmp = fma(fma(Float64(-a), t, Float64(z * y)), x, Float64(fma(Float64(-i), y, Float64(c * t)) * j)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[b, -2.05e+163], N[Not[LessEqual[b, 8.5e+64]], $MachinePrecision]], N[(N[(i * a + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[(N[((-i) * y + N[(c * t), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.05 \cdot 10^{+163} \lor \neg \left(b \leq 8.5 \cdot 10^{+64}\right):\\
\;\;\;\;\mathsf{fma}\left(i, a, \left(-c\right) \cdot z\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-a, t, z \cdot y\right), x, \mathsf{fma}\left(-i, y, c \cdot t\right) \cdot j\right)\\
\end{array}
\end{array}
if b < -2.05e163 or 8.4999999999999998e64 < b Initial program 68.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6465.6
Applied rewrites65.6%
if -2.05e163 < b < 8.4999999999999998e64Initial program 74.9%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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
Applied rewrites71.7%
Final simplification69.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (- i) (fma j y (* (- a) b)))))
(if (<= i -1.26e+67)
t_1
(if (<= i -4.2e-12)
(* (fma (- i) y (* c t)) j)
(if (<= i 2.7e-164)
(* (fma (- a) t (* z y)) x)
(if (<= i 3e+70) (* (fma y x (* (- b) c)) z) 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 * fma(j, y, (-a * b));
double tmp;
if (i <= -1.26e+67) {
tmp = t_1;
} else if (i <= -4.2e-12) {
tmp = fma(-i, y, (c * t)) * j;
} else if (i <= 2.7e-164) {
tmp = fma(-a, t, (z * y)) * x;
} else if (i <= 3e+70) {
tmp = fma(y, x, (-b * c)) * z;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(-i) * fma(j, y, Float64(Float64(-a) * b))) tmp = 0.0 if (i <= -1.26e+67) tmp = t_1; elseif (i <= -4.2e-12) tmp = Float64(fma(Float64(-i), y, Float64(c * t)) * j); elseif (i <= 2.7e-164) tmp = Float64(fma(Float64(-a), t, Float64(z * y)) * x); elseif (i <= 3e+70) tmp = Float64(fma(y, x, Float64(Float64(-b) * c)) * z); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-i) * N[(j * y + N[((-a) * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -1.26e+67], t$95$1, If[LessEqual[i, -4.2e-12], N[(N[((-i) * y + N[(c * t), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[i, 2.7e-164], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[i, 3e+70], N[(N[(y * x + N[((-b) * c), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-a\right) \cdot b\right)\\
\mathbf{if}\;i \leq -1.26 \cdot 10^{+67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;i \leq -4.2 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot t\right) \cdot j\\
\mathbf{elif}\;i \leq 2.7 \cdot 10^{-164}:\\
\;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\
\mathbf{elif}\;i \leq 3 \cdot 10^{+70}:\\
\;\;\;\;\mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if i < -1.26e67 or 2.99999999999999976e70 < i Initial program 63.0%
Taylor expanded in i around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6466.6
Applied rewrites66.6%
if -1.26e67 < i < -4.19999999999999988e-12Initial program 65.1%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6457.2
Applied rewrites57.2%
if -4.19999999999999988e-12 < i < 2.7000000000000001e-164Initial program 84.3%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/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-*.f6458.6
Applied rewrites58.6%
if 2.7000000000000001e-164 < i < 2.99999999999999976e70Initial program 75.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6458.6
Applied rewrites58.6%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma i a (* (- c) z)) b)))
(if (<= y -1e-29)
(* (fma y x (* (- b) c)) z)
(if (<= y -1.4e-186)
t_1
(if (<= y 1.08e-103)
(* c (- (* j t) (* b z)))
(if (<= y 1.76e+47) t_1 (* z (- (* x y) (* b c)))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(i, a, (-c * z)) * b;
double tmp;
if (y <= -1e-29) {
tmp = fma(y, x, (-b * c)) * z;
} else if (y <= -1.4e-186) {
tmp = t_1;
} else if (y <= 1.08e-103) {
tmp = c * ((j * t) - (b * z));
} else if (y <= 1.76e+47) {
tmp = t_1;
} else {
tmp = z * ((x * y) - (b * c));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(i, a, Float64(Float64(-c) * z)) * b) tmp = 0.0 if (y <= -1e-29) tmp = Float64(fma(y, x, Float64(Float64(-b) * c)) * z); elseif (y <= -1.4e-186) tmp = t_1; elseif (y <= 1.08e-103) tmp = Float64(c * Float64(Float64(j * t) - Float64(b * z))); elseif (y <= 1.76e+47) tmp = t_1; else tmp = Float64(z * Float64(Float64(x * y) - Float64(b * c))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(i * a + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[y, -1e-29], N[(N[(y * x + N[((-b) * c), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[y, -1.4e-186], t$95$1, If[LessEqual[y, 1.08e-103], N[(c * N[(N[(j * t), $MachinePrecision] - N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.76e+47], t$95$1, N[(z * N[(N[(x * y), $MachinePrecision] - N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(i, a, \left(-c\right) \cdot z\right) \cdot b\\
\mathbf{if}\;y \leq -1 \cdot 10^{-29}:\\
\;\;\;\;\mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{-186}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.08 \cdot 10^{-103}:\\
\;\;\;\;c \cdot \left(j \cdot t - b \cdot z\right)\\
\mathbf{elif}\;y \leq 1.76 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right)\\
\end{array}
\end{array}
if y < -9.99999999999999943e-30Initial program 72.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6453.2
Applied rewrites53.2%
if -9.99999999999999943e-30 < y < -1.39999999999999992e-186 or 1.0799999999999999e-103 < y < 1.76e47Initial program 88.4%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6455.6
Applied rewrites55.6%
if -1.39999999999999992e-186 < y < 1.0799999999999999e-103Initial program 76.8%
Taylor expanded in j around inf
Applied rewrites67.7%
Taylor expanded in c around inf
lower-*.f64N/A
lower--.f64N/A
lift-*.f64N/A
lift-*.f6458.1
Applied rewrites58.1%
if 1.76e47 < y Initial program 51.2%
Taylor expanded in j around inf
Applied rewrites53.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6455.4
Applied rewrites55.4%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (fma i a (* (- c) z)) b)) (t_2 (* z (- (* x y) (* b c)))))
(if (<= y -1e-29)
t_2
(if (<= y -1.4e-186)
t_1
(if (<= y 1.08e-103)
(* c (- (* j t) (* b z)))
(if (<= y 1.14e+49) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = fma(i, a, (-c * z)) * b;
double t_2 = z * ((x * y) - (b * c));
double tmp;
if (y <= -1e-29) {
tmp = t_2;
} else if (y <= -1.4e-186) {
tmp = t_1;
} else if (y <= 1.08e-103) {
tmp = c * ((j * t) - (b * z));
} else if (y <= 1.14e+49) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(fma(i, a, Float64(Float64(-c) * z)) * b) t_2 = Float64(z * Float64(Float64(x * y) - Float64(b * c))) tmp = 0.0 if (y <= -1e-29) tmp = t_2; elseif (y <= -1.4e-186) tmp = t_1; elseif (y <= 1.08e-103) tmp = Float64(c * Float64(Float64(j * t) - Float64(b * z))); elseif (y <= 1.14e+49) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(i * a + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(N[(x * y), $MachinePrecision] - N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1e-29], t$95$2, If[LessEqual[y, -1.4e-186], t$95$1, If[LessEqual[y, 1.08e-103], N[(c * N[(N[(j * t), $MachinePrecision] - N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.14e+49], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(i, a, \left(-c\right) \cdot z\right) \cdot b\\
t_2 := z \cdot \left(x \cdot y - b \cdot c\right)\\
\mathbf{if}\;y \leq -1 \cdot 10^{-29}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{-186}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.08 \cdot 10^{-103}:\\
\;\;\;\;c \cdot \left(j \cdot t - b \cdot z\right)\\
\mathbf{elif}\;y \leq 1.14 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -9.99999999999999943e-30 or 1.13999999999999994e49 < y Initial program 63.3%
Taylor expanded in j around inf
Applied rewrites62.4%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6454.6
Applied rewrites54.6%
if -9.99999999999999943e-30 < y < -1.39999999999999992e-186 or 1.0799999999999999e-103 < y < 1.13999999999999994e49Initial program 88.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6454.7
Applied rewrites54.7%
if -1.39999999999999992e-186 < y < 1.0799999999999999e-103Initial program 76.8%
Taylor expanded in j around inf
Applied rewrites67.7%
Taylor expanded in c around inf
lower-*.f64N/A
lower--.f64N/A
lift-*.f64N/A
lift-*.f6458.1
Applied rewrites58.1%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (- i) (fma j y (* (- a) b)))))
(if (<= i -9.5e+49)
t_1
(if (<= i 6.2e-30)
(fma (fma (- a) t (* z y)) x (* (* c t) j))
(if (<= i 2.95e+70) (* c (- (* j t) (* b z))) 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 * fma(j, y, (-a * b));
double tmp;
if (i <= -9.5e+49) {
tmp = t_1;
} else if (i <= 6.2e-30) {
tmp = fma(fma(-a, t, (z * y)), x, ((c * t) * j));
} else if (i <= 2.95e+70) {
tmp = c * ((j * t) - (b * z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(-i) * fma(j, y, Float64(Float64(-a) * b))) tmp = 0.0 if (i <= -9.5e+49) tmp = t_1; elseif (i <= 6.2e-30) tmp = fma(fma(Float64(-a), t, Float64(z * y)), x, Float64(Float64(c * t) * j)); elseif (i <= 2.95e+70) tmp = Float64(c * Float64(Float64(j * t) - Float64(b * z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-i) * N[(j * y + N[((-a) * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -9.5e+49], t$95$1, If[LessEqual[i, 6.2e-30], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x + N[(N[(c * t), $MachinePrecision] * j), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 2.95e+70], N[(c * N[(N[(j * t), $MachinePrecision] - N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-a\right) \cdot b\right)\\
\mathbf{if}\;i \leq -9.5 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;i \leq 6.2 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-a, t, z \cdot y\right), x, \left(c \cdot t\right) \cdot j\right)\\
\mathbf{elif}\;i \leq 2.95 \cdot 10^{+70}:\\
\;\;\;\;c \cdot \left(j \cdot t - b \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if i < -9.49999999999999969e49 or 2.9500000000000001e70 < i Initial program 64.5%
Taylor expanded in i around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6465.1
Applied rewrites65.1%
if -9.49999999999999969e49 < i < 6.19999999999999982e-30Initial program 78.4%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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
Applied rewrites72.4%
Taylor expanded in y around 0
lift-*.f6465.6
Applied rewrites65.6%
if 6.19999999999999982e-30 < i < 2.9500000000000001e70Initial program 80.6%
Taylor expanded in j around inf
Applied rewrites56.6%
Taylor expanded in c around inf
lower-*.f64N/A
lower--.f64N/A
lift-*.f64N/A
lift-*.f6465.9
Applied rewrites65.9%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* a i) b)))
(if (<= i -1.05e+82)
t_1
(if (<= i -9e-13)
(* (* (- i) j) y)
(if (<= i 2.3e-36)
(* x (* y z))
(if (<= i 5.8e+68) (* (* (- c) z) 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 = (a * i) * b;
double tmp;
if (i <= -1.05e+82) {
tmp = t_1;
} else if (i <= -9e-13) {
tmp = (-i * j) * y;
} else if (i <= 2.3e-36) {
tmp = x * (y * z);
} else if (i <= 5.8e+68) {
tmp = (-c * z) * 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 = (a * i) * b
if (i <= (-1.05d+82)) then
tmp = t_1
else if (i <= (-9d-13)) then
tmp = (-i * j) * y
else if (i <= 2.3d-36) then
tmp = x * (y * z)
else if (i <= 5.8d+68) then
tmp = (-c * z) * 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 = (a * i) * b;
double tmp;
if (i <= -1.05e+82) {
tmp = t_1;
} else if (i <= -9e-13) {
tmp = (-i * j) * y;
} else if (i <= 2.3e-36) {
tmp = x * (y * z);
} else if (i <= 5.8e+68) {
tmp = (-c * z) * b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (a * i) * b tmp = 0 if i <= -1.05e+82: tmp = t_1 elif i <= -9e-13: tmp = (-i * j) * y elif i <= 2.3e-36: tmp = x * (y * z) elif i <= 5.8e+68: tmp = (-c * z) * b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(a * i) * b) tmp = 0.0 if (i <= -1.05e+82) tmp = t_1; elseif (i <= -9e-13) tmp = Float64(Float64(Float64(-i) * j) * y); elseif (i <= 2.3e-36) tmp = Float64(x * Float64(y * z)); elseif (i <= 5.8e+68) tmp = Float64(Float64(Float64(-c) * z) * b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (a * i) * b; tmp = 0.0; if (i <= -1.05e+82) tmp = t_1; elseif (i <= -9e-13) tmp = (-i * j) * y; elseif (i <= 2.3e-36) tmp = x * (y * z); elseif (i <= 5.8e+68) tmp = (-c * z) * 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[(a * i), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[i, -1.05e+82], t$95$1, If[LessEqual[i, -9e-13], N[(N[((-i) * j), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[i, 2.3e-36], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 5.8e+68], N[(N[((-c) * z), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot i\right) \cdot b\\
\mathbf{if}\;i \leq -1.05 \cdot 10^{+82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;i \leq -9 \cdot 10^{-13}:\\
\;\;\;\;\left(\left(-i\right) \cdot j\right) \cdot y\\
\mathbf{elif}\;i \leq 2.3 \cdot 10^{-36}:\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;i \leq 5.8 \cdot 10^{+68}:\\
\;\;\;\;\left(\left(-c\right) \cdot z\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if i < -1.05e82 or 5.80000000000000023e68 < i Initial program 64.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6454.4
Applied rewrites54.4%
Taylor expanded in z around 0
lower-*.f6447.3
Applied rewrites47.3%
if -1.05e82 < i < -9e-13Initial program 61.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6446.0
Applied rewrites46.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6437.5
Applied rewrites37.5%
if -9e-13 < i < 2.29999999999999996e-36Initial program 80.7%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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
Applied rewrites73.6%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6436.5
Applied rewrites36.5%
if 2.29999999999999996e-36 < i < 5.80000000000000023e68Initial program 81.4%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6444.2
Applied rewrites44.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6439.7
Applied rewrites39.7%
Final simplification40.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* a i) b)))
(if (<= i -1.1e+84)
t_1
(if (<= i -3.8e-106)
(* (* (- a) x) t)
(if (<= i 2.3e-36)
(* x (* y z))
(if (<= i 5.8e+68) (* (* (- c) z) 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 = (a * i) * b;
double tmp;
if (i <= -1.1e+84) {
tmp = t_1;
} else if (i <= -3.8e-106) {
tmp = (-a * x) * t;
} else if (i <= 2.3e-36) {
tmp = x * (y * z);
} else if (i <= 5.8e+68) {
tmp = (-c * z) * 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 = (a * i) * b
if (i <= (-1.1d+84)) then
tmp = t_1
else if (i <= (-3.8d-106)) then
tmp = (-a * x) * t
else if (i <= 2.3d-36) then
tmp = x * (y * z)
else if (i <= 5.8d+68) then
tmp = (-c * z) * 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 = (a * i) * b;
double tmp;
if (i <= -1.1e+84) {
tmp = t_1;
} else if (i <= -3.8e-106) {
tmp = (-a * x) * t;
} else if (i <= 2.3e-36) {
tmp = x * (y * z);
} else if (i <= 5.8e+68) {
tmp = (-c * z) * b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (a * i) * b tmp = 0 if i <= -1.1e+84: tmp = t_1 elif i <= -3.8e-106: tmp = (-a * x) * t elif i <= 2.3e-36: tmp = x * (y * z) elif i <= 5.8e+68: tmp = (-c * z) * b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(a * i) * b) tmp = 0.0 if (i <= -1.1e+84) tmp = t_1; elseif (i <= -3.8e-106) tmp = Float64(Float64(Float64(-a) * x) * t); elseif (i <= 2.3e-36) tmp = Float64(x * Float64(y * z)); elseif (i <= 5.8e+68) tmp = Float64(Float64(Float64(-c) * z) * b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (a * i) * b; tmp = 0.0; if (i <= -1.1e+84) tmp = t_1; elseif (i <= -3.8e-106) tmp = (-a * x) * t; elseif (i <= 2.3e-36) tmp = x * (y * z); elseif (i <= 5.8e+68) tmp = (-c * z) * 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[(a * i), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[i, -1.1e+84], t$95$1, If[LessEqual[i, -3.8e-106], N[(N[((-a) * x), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[i, 2.3e-36], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 5.8e+68], N[(N[((-c) * z), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot i\right) \cdot b\\
\mathbf{if}\;i \leq -1.1 \cdot 10^{+84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;i \leq -3.8 \cdot 10^{-106}:\\
\;\;\;\;\left(\left(-a\right) \cdot x\right) \cdot t\\
\mathbf{elif}\;i \leq 2.3 \cdot 10^{-36}:\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;i \leq 5.8 \cdot 10^{+68}:\\
\;\;\;\;\left(\left(-c\right) \cdot z\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if i < -1.0999999999999999e84 or 5.80000000000000023e68 < i Initial program 65.0%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6453.9
Applied rewrites53.9%
Taylor expanded in z around 0
lower-*.f6446.8
Applied rewrites46.8%
if -1.0999999999999999e84 < i < -3.7999999999999999e-106Initial program 68.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6450.6
Applied rewrites50.6%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f6431.4
Applied rewrites31.4%
if -3.7999999999999999e-106 < i < 2.29999999999999996e-36Initial program 80.2%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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
Applied rewrites74.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6439.4
Applied rewrites39.4%
if 2.29999999999999996e-36 < i < 5.80000000000000023e68Initial program 81.4%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6444.2
Applied rewrites44.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6439.7
Applied rewrites39.7%
Final simplification40.8%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* a i) b)))
(if (<= i -1.3e+82)
t_1
(if (<= i -9e-13)
(* (- i) (* j y))
(if (<= i 2.3e-36)
(* x (* y z))
(if (<= i 5.8e+68) (* (* (- c) z) 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 = (a * i) * b;
double tmp;
if (i <= -1.3e+82) {
tmp = t_1;
} else if (i <= -9e-13) {
tmp = -i * (j * y);
} else if (i <= 2.3e-36) {
tmp = x * (y * z);
} else if (i <= 5.8e+68) {
tmp = (-c * z) * 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 = (a * i) * b
if (i <= (-1.3d+82)) then
tmp = t_1
else if (i <= (-9d-13)) then
tmp = -i * (j * y)
else if (i <= 2.3d-36) then
tmp = x * (y * z)
else if (i <= 5.8d+68) then
tmp = (-c * z) * 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 = (a * i) * b;
double tmp;
if (i <= -1.3e+82) {
tmp = t_1;
} else if (i <= -9e-13) {
tmp = -i * (j * y);
} else if (i <= 2.3e-36) {
tmp = x * (y * z);
} else if (i <= 5.8e+68) {
tmp = (-c * z) * b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (a * i) * b tmp = 0 if i <= -1.3e+82: tmp = t_1 elif i <= -9e-13: tmp = -i * (j * y) elif i <= 2.3e-36: tmp = x * (y * z) elif i <= 5.8e+68: tmp = (-c * z) * b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(a * i) * b) tmp = 0.0 if (i <= -1.3e+82) tmp = t_1; elseif (i <= -9e-13) tmp = Float64(Float64(-i) * Float64(j * y)); elseif (i <= 2.3e-36) tmp = Float64(x * Float64(y * z)); elseif (i <= 5.8e+68) tmp = Float64(Float64(Float64(-c) * z) * b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (a * i) * b; tmp = 0.0; if (i <= -1.3e+82) tmp = t_1; elseif (i <= -9e-13) tmp = -i * (j * y); elseif (i <= 2.3e-36) tmp = x * (y * z); elseif (i <= 5.8e+68) tmp = (-c * z) * 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[(a * i), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[i, -1.3e+82], t$95$1, If[LessEqual[i, -9e-13], N[((-i) * N[(j * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 2.3e-36], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 5.8e+68], N[(N[((-c) * z), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot i\right) \cdot b\\
\mathbf{if}\;i \leq -1.3 \cdot 10^{+82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;i \leq -9 \cdot 10^{-13}:\\
\;\;\;\;\left(-i\right) \cdot \left(j \cdot y\right)\\
\mathbf{elif}\;i \leq 2.3 \cdot 10^{-36}:\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;i \leq 5.8 \cdot 10^{+68}:\\
\;\;\;\;\left(\left(-c\right) \cdot z\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if i < -1.2999999999999999e82 or 5.80000000000000023e68 < i Initial program 64.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6454.4
Applied rewrites54.4%
Taylor expanded in z around 0
lower-*.f6447.3
Applied rewrites47.3%
if -1.2999999999999999e82 < i < -9e-13Initial program 61.1%
Taylor expanded in i around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6440.5
Applied rewrites40.5%
Taylor expanded in y around inf
lower-*.f6433.4
Applied rewrites33.4%
if -9e-13 < i < 2.29999999999999996e-36Initial program 80.7%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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
Applied rewrites73.6%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6436.5
Applied rewrites36.5%
if 2.29999999999999996e-36 < i < 5.80000000000000023e68Initial program 81.4%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6444.2
Applied rewrites44.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6439.7
Applied rewrites39.7%
Final simplification40.5%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* c (- (* j t) (* b z)))))
(if (<= c -162000.0)
t_1
(if (<= c 3.85e-171)
(* (fma (- a) t (* z y)) x)
(if (<= c 1e-33) (* (fma (- i) j (* 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 = c * ((j * t) - (b * z));
double tmp;
if (c <= -162000.0) {
tmp = t_1;
} else if (c <= 3.85e-171) {
tmp = fma(-a, t, (z * y)) * x;
} else if (c <= 1e-33) {
tmp = fma(-i, j, (z * x)) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(c * Float64(Float64(j * t) - Float64(b * z))) tmp = 0.0 if (c <= -162000.0) tmp = t_1; elseif (c <= 3.85e-171) tmp = Float64(fma(Float64(-a), t, Float64(z * y)) * x); elseif (c <= 1e-33) tmp = Float64(fma(Float64(-i), j, 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[(c * N[(N[(j * t), $MachinePrecision] - N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -162000.0], t$95$1, If[LessEqual[c, 3.85e-171], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[c, 1e-33], N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c \cdot \left(j \cdot t - b \cdot z\right)\\
\mathbf{if}\;c \leq -162000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq 3.85 \cdot 10^{-171}:\\
\;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\
\mathbf{elif}\;c \leq 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -162000 or 1.0000000000000001e-33 < c Initial program 67.3%
Taylor expanded in j around inf
Applied rewrites64.6%
Taylor expanded in c around inf
lower-*.f64N/A
lower--.f64N/A
lift-*.f64N/A
lift-*.f6462.4
Applied rewrites62.4%
if -162000 < c < 3.8499999999999998e-171Initial program 78.5%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/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-*.f6455.2
Applied rewrites55.2%
if 3.8499999999999998e-171 < c < 1.0000000000000001e-33Initial program 80.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6459.2
Applied rewrites59.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* c (- (* j t) (* b z)))))
(if (<= c -420000.0)
t_1
(if (<= c -1.4e-107)
(* x (* y z))
(if (<= c 9.5e-40) (* (* (- 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 = c * ((j * t) - (b * z));
double tmp;
if (c <= -420000.0) {
tmp = t_1;
} else if (c <= -1.4e-107) {
tmp = x * (y * z);
} else if (c <= 9.5e-40) {
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 = c * ((j * t) - (b * z))
if (c <= (-420000.0d0)) then
tmp = t_1
else if (c <= (-1.4d-107)) then
tmp = x * (y * z)
else if (c <= 9.5d-40) 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 = c * ((j * t) - (b * z));
double tmp;
if (c <= -420000.0) {
tmp = t_1;
} else if (c <= -1.4e-107) {
tmp = x * (y * z);
} else if (c <= 9.5e-40) {
tmp = (-a * x) * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = c * ((j * t) - (b * z)) tmp = 0 if c <= -420000.0: tmp = t_1 elif c <= -1.4e-107: tmp = x * (y * z) elif c <= 9.5e-40: tmp = (-a * x) * t else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(c * Float64(Float64(j * t) - Float64(b * z))) tmp = 0.0 if (c <= -420000.0) tmp = t_1; elseif (c <= -1.4e-107) tmp = Float64(x * Float64(y * z)); elseif (c <= 9.5e-40) 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 = c * ((j * t) - (b * z)); tmp = 0.0; if (c <= -420000.0) tmp = t_1; elseif (c <= -1.4e-107) tmp = x * (y * z); elseif (c <= 9.5e-40) 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[(c * N[(N[(j * t), $MachinePrecision] - N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -420000.0], t$95$1, If[LessEqual[c, -1.4e-107], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 9.5e-40], N[(N[((-a) * x), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c \cdot \left(j \cdot t - b \cdot z\right)\\
\mathbf{if}\;c \leq -420000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq -1.4 \cdot 10^{-107}:\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;c \leq 9.5 \cdot 10^{-40}:\\
\;\;\;\;\left(\left(-a\right) \cdot x\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -4.2e5 or 9.5000000000000006e-40 < c Initial program 67.3%
Taylor expanded in j around inf
Applied rewrites64.7%
Taylor expanded in c around inf
lower-*.f64N/A
lower--.f64N/A
lift-*.f64N/A
lift-*.f6461.8
Applied rewrites61.8%
if -4.2e5 < c < -1.3999999999999999e-107Initial program 75.1%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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
Applied rewrites68.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6436.8
Applied rewrites36.8%
if -1.3999999999999999e-107 < c < 9.5000000000000006e-40Initial program 80.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6439.4
Applied rewrites39.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f6436.1
Applied rewrites36.1%
Final simplification49.5%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* a i) b)))
(if (<= i -1.3e+82)
t_1
(if (<= i -9e-13)
(* (- i) (* j y))
(if (<= i 1e-64)
(* x (* y z))
(if (<= i 3.4e+70) (* (* c t) j) t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (a * i) * b;
double tmp;
if (i <= -1.3e+82) {
tmp = t_1;
} else if (i <= -9e-13) {
tmp = -i * (j * y);
} else if (i <= 1e-64) {
tmp = x * (y * z);
} else if (i <= 3.4e+70) {
tmp = (c * t) * j;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: tmp
t_1 = (a * i) * b
if (i <= (-1.3d+82)) then
tmp = t_1
else if (i <= (-9d-13)) then
tmp = -i * (j * y)
else if (i <= 1d-64) then
tmp = x * (y * z)
else if (i <= 3.4d+70) then
tmp = (c * t) * j
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (a * i) * b;
double tmp;
if (i <= -1.3e+82) {
tmp = t_1;
} else if (i <= -9e-13) {
tmp = -i * (j * y);
} else if (i <= 1e-64) {
tmp = x * (y * z);
} else if (i <= 3.4e+70) {
tmp = (c * t) * j;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (a * i) * b tmp = 0 if i <= -1.3e+82: tmp = t_1 elif i <= -9e-13: tmp = -i * (j * y) elif i <= 1e-64: tmp = x * (y * z) elif i <= 3.4e+70: tmp = (c * t) * j else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(a * i) * b) tmp = 0.0 if (i <= -1.3e+82) tmp = t_1; elseif (i <= -9e-13) tmp = Float64(Float64(-i) * Float64(j * y)); elseif (i <= 1e-64) tmp = Float64(x * Float64(y * z)); elseif (i <= 3.4e+70) tmp = Float64(Float64(c * t) * j); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (a * i) * b; tmp = 0.0; if (i <= -1.3e+82) tmp = t_1; elseif (i <= -9e-13) tmp = -i * (j * y); elseif (i <= 1e-64) tmp = x * (y * z); elseif (i <= 3.4e+70) tmp = (c * t) * j; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(a * i), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[i, -1.3e+82], t$95$1, If[LessEqual[i, -9e-13], N[((-i) * N[(j * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1e-64], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.4e+70], N[(N[(c * t), $MachinePrecision] * j), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot i\right) \cdot b\\
\mathbf{if}\;i \leq -1.3 \cdot 10^{+82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;i \leq -9 \cdot 10^{-13}:\\
\;\;\;\;\left(-i\right) \cdot \left(j \cdot y\right)\\
\mathbf{elif}\;i \leq 10^{-64}:\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;i \leq 3.4 \cdot 10^{+70}:\\
\;\;\;\;\left(c \cdot t\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if i < -1.2999999999999999e82 or 3.4000000000000001e70 < i Initial program 63.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6455.0
Applied rewrites55.0%
Taylor expanded in z around 0
lower-*.f6447.8
Applied rewrites47.8%
if -1.2999999999999999e82 < i < -9e-13Initial program 61.1%
Taylor expanded in i around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6440.5
Applied rewrites40.5%
Taylor expanded in y around inf
lower-*.f6433.4
Applied rewrites33.4%
if -9e-13 < i < 9.99999999999999965e-65Initial program 80.7%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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
Applied rewrites73.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6436.3
Applied rewrites36.3%
if 9.99999999999999965e-65 < i < 3.4000000000000001e70Initial program 81.8%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6446.5
Applied rewrites46.5%
Taylor expanded in y around 0
lift-*.f6432.7
Applied rewrites32.7%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* (* a i) b)))
(if (<= i -4.8e+80)
t_1
(if (<= i -4e-7)
(* c (* j t))
(if (<= i 1e-64)
(* x (* y z))
(if (<= i 3.4e+70) (* (* c t) j) t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (a * i) * b;
double tmp;
if (i <= -4.8e+80) {
tmp = t_1;
} else if (i <= -4e-7) {
tmp = c * (j * t);
} else if (i <= 1e-64) {
tmp = x * (y * z);
} else if (i <= 3.4e+70) {
tmp = (c * t) * j;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: tmp
t_1 = (a * i) * b
if (i <= (-4.8d+80)) then
tmp = t_1
else if (i <= (-4d-7)) then
tmp = c * (j * t)
else if (i <= 1d-64) then
tmp = x * (y * z)
else if (i <= 3.4d+70) then
tmp = (c * t) * j
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = (a * i) * b;
double tmp;
if (i <= -4.8e+80) {
tmp = t_1;
} else if (i <= -4e-7) {
tmp = c * (j * t);
} else if (i <= 1e-64) {
tmp = x * (y * z);
} else if (i <= 3.4e+70) {
tmp = (c * t) * j;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = (a * i) * b tmp = 0 if i <= -4.8e+80: tmp = t_1 elif i <= -4e-7: tmp = c * (j * t) elif i <= 1e-64: tmp = x * (y * z) elif i <= 3.4e+70: tmp = (c * t) * j else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(a * i) * b) tmp = 0.0 if (i <= -4.8e+80) tmp = t_1; elseif (i <= -4e-7) tmp = Float64(c * Float64(j * t)); elseif (i <= 1e-64) tmp = Float64(x * Float64(y * z)); elseif (i <= 3.4e+70) tmp = Float64(Float64(c * t) * j); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = (a * i) * b; tmp = 0.0; if (i <= -4.8e+80) tmp = t_1; elseif (i <= -4e-7) tmp = c * (j * t); elseif (i <= 1e-64) tmp = x * (y * z); elseif (i <= 3.4e+70) tmp = (c * t) * j; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(a * i), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[i, -4.8e+80], t$95$1, If[LessEqual[i, -4e-7], N[(c * N[(j * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1e-64], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.4e+70], N[(N[(c * t), $MachinePrecision] * j), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot i\right) \cdot b\\
\mathbf{if}\;i \leq -4.8 \cdot 10^{+80}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;i \leq -4 \cdot 10^{-7}:\\
\;\;\;\;c \cdot \left(j \cdot t\right)\\
\mathbf{elif}\;i \leq 10^{-64}:\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;i \leq 3.4 \cdot 10^{+70}:\\
\;\;\;\;\left(c \cdot t\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if i < -4.79999999999999958e80 or 3.4000000000000001e70 < i Initial program 63.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6455.0
Applied rewrites55.0%
Taylor expanded in z around 0
lower-*.f6447.8
Applied rewrites47.8%
if -4.79999999999999958e80 < i < -3.9999999999999998e-7Initial program 59.4%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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
Applied rewrites69.1%
Taylor expanded in c around inf
lower-*.f64N/A
lift-*.f6433.2
Applied rewrites33.2%
if -3.9999999999999998e-7 < i < 9.99999999999999965e-65Initial program 80.9%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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
Applied rewrites72.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6436.0
Applied rewrites36.0%
if 9.99999999999999965e-65 < i < 3.4000000000000001e70Initial program 81.8%
Taylor expanded in j around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f6446.5
Applied rewrites46.5%
Taylor expanded in y around 0
lift-*.f6432.7
Applied rewrites32.7%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* c (* j t))) (t_2 (* (* a i) b)))
(if (<= i -4.8e+80)
t_2
(if (<= i -4e-7)
t_1
(if (<= i 2.05e-35) (* x (* y z)) (if (<= i 3.4e+70) 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 = c * (j * t);
double t_2 = (a * i) * b;
double tmp;
if (i <= -4.8e+80) {
tmp = t_2;
} else if (i <= -4e-7) {
tmp = t_1;
} else if (i <= 2.05e-35) {
tmp = x * (y * z);
} else if (i <= 3.4e+70) {
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 = c * (j * t)
t_2 = (a * i) * b
if (i <= (-4.8d+80)) then
tmp = t_2
else if (i <= (-4d-7)) then
tmp = t_1
else if (i <= 2.05d-35) then
tmp = x * (y * z)
else if (i <= 3.4d+70) 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 = c * (j * t);
double t_2 = (a * i) * b;
double tmp;
if (i <= -4.8e+80) {
tmp = t_2;
} else if (i <= -4e-7) {
tmp = t_1;
} else if (i <= 2.05e-35) {
tmp = x * (y * z);
} else if (i <= 3.4e+70) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = c * (j * t) t_2 = (a * i) * b tmp = 0 if i <= -4.8e+80: tmp = t_2 elif i <= -4e-7: tmp = t_1 elif i <= 2.05e-35: tmp = x * (y * z) elif i <= 3.4e+70: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(c * Float64(j * t)) t_2 = Float64(Float64(a * i) * b) tmp = 0.0 if (i <= -4.8e+80) tmp = t_2; elseif (i <= -4e-7) tmp = t_1; elseif (i <= 2.05e-35) tmp = Float64(x * Float64(y * z)); elseif (i <= 3.4e+70) 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 = c * (j * t); t_2 = (a * i) * b; tmp = 0.0; if (i <= -4.8e+80) tmp = t_2; elseif (i <= -4e-7) tmp = t_1; elseif (i <= 2.05e-35) tmp = x * (y * z); elseif (i <= 3.4e+70) 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[(c * N[(j * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * i), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[i, -4.8e+80], t$95$2, If[LessEqual[i, -4e-7], t$95$1, If[LessEqual[i, 2.05e-35], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.4e+70], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c \cdot \left(j \cdot t\right)\\
t_2 := \left(a \cdot i\right) \cdot b\\
\mathbf{if}\;i \leq -4.8 \cdot 10^{+80}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;i \leq -4 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;i \leq 2.05 \cdot 10^{-35}:\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;i \leq 3.4 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if i < -4.79999999999999958e80 or 3.4000000000000001e70 < i Initial program 63.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6455.0
Applied rewrites55.0%
Taylor expanded in z around 0
lower-*.f6447.8
Applied rewrites47.8%
if -4.79999999999999958e80 < i < -3.9999999999999998e-7 or 2.05000000000000013e-35 < i < 3.4000000000000001e70Initial program 70.9%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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
Applied rewrites62.6%
Taylor expanded in c around inf
lower-*.f64N/A
lift-*.f6431.9
Applied rewrites31.9%
if -3.9999999999999998e-7 < i < 2.05000000000000013e-35Initial program 80.8%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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
Applied rewrites73.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6436.2
Applied rewrites36.2%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* c (* j t))) (t_2 (* a (* b i))))
(if (<= i -4.5e+81)
t_2
(if (<= i -4e-7)
t_1
(if (<= i 2.05e-35) (* x (* y z)) (if (<= i 3.4e+70) 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 = c * (j * t);
double t_2 = a * (b * i);
double tmp;
if (i <= -4.5e+81) {
tmp = t_2;
} else if (i <= -4e-7) {
tmp = t_1;
} else if (i <= 2.05e-35) {
tmp = x * (y * z);
} else if (i <= 3.4e+70) {
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 = c * (j * t)
t_2 = a * (b * i)
if (i <= (-4.5d+81)) then
tmp = t_2
else if (i <= (-4d-7)) then
tmp = t_1
else if (i <= 2.05d-35) then
tmp = x * (y * z)
else if (i <= 3.4d+70) 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 = c * (j * t);
double t_2 = a * (b * i);
double tmp;
if (i <= -4.5e+81) {
tmp = t_2;
} else if (i <= -4e-7) {
tmp = t_1;
} else if (i <= 2.05e-35) {
tmp = x * (y * z);
} else if (i <= 3.4e+70) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = c * (j * t) t_2 = a * (b * i) tmp = 0 if i <= -4.5e+81: tmp = t_2 elif i <= -4e-7: tmp = t_1 elif i <= 2.05e-35: tmp = x * (y * z) elif i <= 3.4e+70: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(c * Float64(j * t)) t_2 = Float64(a * Float64(b * i)) tmp = 0.0 if (i <= -4.5e+81) tmp = t_2; elseif (i <= -4e-7) tmp = t_1; elseif (i <= 2.05e-35) tmp = Float64(x * Float64(y * z)); elseif (i <= 3.4e+70) 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 = c * (j * t); t_2 = a * (b * i); tmp = 0.0; if (i <= -4.5e+81) tmp = t_2; elseif (i <= -4e-7) tmp = t_1; elseif (i <= 2.05e-35) tmp = x * (y * z); elseif (i <= 3.4e+70) 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[(c * N[(j * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(a * N[(b * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -4.5e+81], t$95$2, If[LessEqual[i, -4e-7], t$95$1, If[LessEqual[i, 2.05e-35], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.4e+70], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c \cdot \left(j \cdot t\right)\\
t_2 := a \cdot \left(b \cdot i\right)\\
\mathbf{if}\;i \leq -4.5 \cdot 10^{+81}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;i \leq -4 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;i \leq 2.05 \cdot 10^{-35}:\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;i \leq 3.4 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if i < -4.50000000000000017e81 or 3.4000000000000001e70 < i Initial program 63.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6455.0
Applied rewrites55.0%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f6444.7
Applied rewrites44.7%
if -4.50000000000000017e81 < i < -3.9999999999999998e-7 or 2.05000000000000013e-35 < i < 3.4000000000000001e70Initial program 70.9%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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
Applied rewrites62.6%
Taylor expanded in c around inf
lower-*.f64N/A
lift-*.f6431.9
Applied rewrites31.9%
if -3.9999999999999998e-7 < i < 2.05000000000000013e-35Initial program 80.8%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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
Applied rewrites73.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6436.2
Applied rewrites36.2%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= c -162000.0) (not (<= c 4.2e-36))) (* c (- (* j t) (* b z))) (* (fma (- a) t (* z y)) x)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((c <= -162000.0) || !(c <= 4.2e-36)) {
tmp = c * ((j * t) - (b * z));
} else {
tmp = fma(-a, t, (z * y)) * x;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((c <= -162000.0) || !(c <= 4.2e-36)) tmp = Float64(c * Float64(Float64(j * t) - Float64(b * z))); else tmp = Float64(fma(Float64(-a), t, Float64(z * y)) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[c, -162000.0], N[Not[LessEqual[c, 4.2e-36]], $MachinePrecision]], N[(c * N[(N[(j * t), $MachinePrecision] - N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -162000 \lor \neg \left(c \leq 4.2 \cdot 10^{-36}\right):\\
\;\;\;\;c \cdot \left(j \cdot t - b \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\
\end{array}
\end{array}
if c < -162000 or 4.19999999999999982e-36 < c Initial program 67.5%
Taylor expanded in j around inf
Applied rewrites64.9%
Taylor expanded in c around inf
lower-*.f64N/A
lower--.f64N/A
lift-*.f64N/A
lift-*.f6461.9
Applied rewrites61.9%
if -162000 < c < 4.19999999999999982e-36Initial program 78.7%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/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-*.f6452.7
Applied rewrites52.7%
Final simplification57.4%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= y -1.45e-127) (not (<= y 3.5e-9))) (* z (- (* x y) (* b c))) (* c (- (* j t) (* b z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((y <= -1.45e-127) || !(y <= 3.5e-9)) {
tmp = z * ((x * y) - (b * c));
} else {
tmp = c * ((j * t) - (b * z));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: tmp
if ((y <= (-1.45d-127)) .or. (.not. (y <= 3.5d-9))) then
tmp = z * ((x * y) - (b * c))
else
tmp = c * ((j * t) - (b * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((y <= -1.45e-127) || !(y <= 3.5e-9)) {
tmp = z * ((x * y) - (b * c));
} else {
tmp = c * ((j * t) - (b * z));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (y <= -1.45e-127) or not (y <= 3.5e-9): tmp = z * ((x * y) - (b * c)) else: tmp = c * ((j * t) - (b * z)) return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((y <= -1.45e-127) || !(y <= 3.5e-9)) tmp = Float64(z * Float64(Float64(x * y) - Float64(b * c))); else tmp = Float64(c * Float64(Float64(j * t) - Float64(b * z))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((y <= -1.45e-127) || ~((y <= 3.5e-9))) tmp = z * ((x * y) - (b * c)); else tmp = c * ((j * t) - (b * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[y, -1.45e-127], N[Not[LessEqual[y, 3.5e-9]], $MachinePrecision]], N[(z * N[(N[(x * y), $MachinePrecision] - N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(j * t), $MachinePrecision] - N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{-127} \lor \neg \left(y \leq 3.5 \cdot 10^{-9}\right):\\
\;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(j \cdot t - b \cdot z\right)\\
\end{array}
\end{array}
if y < -1.45e-127 or 3.4999999999999999e-9 < y Initial program 69.4%
Taylor expanded in j around inf
Applied rewrites66.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6450.1
Applied rewrites50.1%
if -1.45e-127 < y < 3.4999999999999999e-9Initial program 78.3%
Taylor expanded in j around inf
Applied rewrites70.1%
Taylor expanded in c around inf
lower-*.f64N/A
lower--.f64N/A
lift-*.f64N/A
lift-*.f6452.3
Applied rewrites52.3%
Final simplification50.9%
(FPCore (x y z t a b c i j) :precision binary64 (if (or (<= i -4.5e+81) (not (<= i 3.4e+70))) (* a (* b i)) (* c (* j t))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((i <= -4.5e+81) || !(i <= 3.4e+70)) {
tmp = a * (b * i);
} else {
tmp = c * (j * t);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: tmp
if ((i <= (-4.5d+81)) .or. (.not. (i <= 3.4d+70))) then
tmp = a * (b * i)
else
tmp = c * (j * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double tmp;
if ((i <= -4.5e+81) || !(i <= 3.4e+70)) {
tmp = a * (b * i);
} else {
tmp = c * (j * t);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): tmp = 0 if (i <= -4.5e+81) or not (i <= 3.4e+70): tmp = a * (b * i) else: tmp = c * (j * t) return tmp
function code(x, y, z, t, a, b, c, i, j) tmp = 0.0 if ((i <= -4.5e+81) || !(i <= 3.4e+70)) tmp = Float64(a * Float64(b * i)); else tmp = Float64(c * Float64(j * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) tmp = 0.0; if ((i <= -4.5e+81) || ~((i <= 3.4e+70))) tmp = a * (b * i); else tmp = c * (j * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[i, -4.5e+81], N[Not[LessEqual[i, 3.4e+70]], $MachinePrecision]], N[(a * N[(b * i), $MachinePrecision]), $MachinePrecision], N[(c * N[(j * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -4.5 \cdot 10^{+81} \lor \neg \left(i \leq 3.4 \cdot 10^{+70}\right):\\
\;\;\;\;a \cdot \left(b \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(j \cdot t\right)\\
\end{array}
\end{array}
if i < -4.50000000000000017e81 or 3.4000000000000001e70 < i Initial program 63.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6455.0
Applied rewrites55.0%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f6444.7
Applied rewrites44.7%
if -4.50000000000000017e81 < i < 3.4000000000000001e70Initial program 78.2%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/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
Applied rewrites70.3%
Taylor expanded in c around inf
lower-*.f64N/A
lift-*.f6424.3
Applied rewrites24.3%
Final simplification31.7%
(FPCore (x y z t a b c i j) :precision binary64 (* a (* b i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return a * (b * 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 = a * (b * 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 a * (b * i);
}
def code(x, y, z, t, a, b, c, i, j): return a * (b * i)
function code(x, y, z, t, a, b, c, i, j) return Float64(a * Float64(b * i)) end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = a * (b * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(a * N[(b * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot \left(b \cdot i\right)
\end{array}
Initial program 73.0%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6437.9
Applied rewrites37.9%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f6420.7
Applied rewrites20.7%
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a))))
(/
(* j (- (pow (* c t) 2.0) (pow (* i y) 2.0)))
(+ (* c t) (* i y)))))
(t_2
(-
(* x (- (* z y) (* a t)))
(- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j)))))
(if (< t -8.120978919195912e-33)
t_2
(if (< t -4.712553818218485e-169)
t_1
(if (< t -7.633533346031584e-308)
t_2
(if (< t 1.0535888557455487e-139) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (pow((c * t), 2.0) - pow((i * y), 2.0))) / ((c * t) + (i * y)));
double t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j));
double tmp;
if (t < -8.120978919195912e-33) {
tmp = t_2;
} else if (t < -4.712553818218485e-169) {
tmp = t_1;
} else if (t < -7.633533346031584e-308) {
tmp = t_2;
} else if (t < 1.0535888557455487e-139) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8), intent (in) :: j
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (((c * t) ** 2.0d0) - ((i * y) ** 2.0d0))) / ((c * t) + (i * y)))
t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j))
if (t < (-8.120978919195912d-33)) then
tmp = t_2
else if (t < (-4.712553818218485d-169)) then
tmp = t_1
else if (t < (-7.633533346031584d-308)) then
tmp = t_2
else if (t < 1.0535888557455487d-139) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (Math.pow((c * t), 2.0) - Math.pow((i * y), 2.0))) / ((c * t) + (i * y)));
double t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j));
double tmp;
if (t < -8.120978919195912e-33) {
tmp = t_2;
} else if (t < -4.712553818218485e-169) {
tmp = t_1;
} else if (t < -7.633533346031584e-308) {
tmp = t_2;
} else if (t < 1.0535888557455487e-139) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (math.pow((c * t), 2.0) - math.pow((i * y), 2.0))) / ((c * t) + (i * y))) t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j)) tmp = 0 if t < -8.120978919195912e-33: tmp = t_2 elif t < -4.712553818218485e-169: tmp = t_1 elif t < -7.633533346031584e-308: tmp = t_2 elif t < 1.0535888557455487e-139: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(i * a)))) + Float64(Float64(j * Float64((Float64(c * t) ^ 2.0) - (Float64(i * y) ^ 2.0))) / Float64(Float64(c * t) + Float64(i * y)))) t_2 = Float64(Float64(x * Float64(Float64(z * y) - Float64(a * t))) - Float64(Float64(b * Float64(Float64(z * c) - Float64(a * i))) - Float64(Float64(Float64(c * t) - Float64(y * i)) * j))) tmp = 0.0 if (t < -8.120978919195912e-33) tmp = t_2; elseif (t < -4.712553818218485e-169) tmp = t_1; elseif (t < -7.633533346031584e-308) tmp = t_2; elseif (t < 1.0535888557455487e-139) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + ((j * (((c * t) ^ 2.0) - ((i * y) ^ 2.0))) / ((c * t) + (i * y))); t_2 = (x * ((z * y) - (a * t))) - ((b * ((z * c) - (a * i))) - (((c * t) - (y * i)) * j)); tmp = 0.0; if (t < -8.120978919195912e-33) tmp = t_2; elseif (t < -4.712553818218485e-169) tmp = t_1; elseif (t < -7.633533346031584e-308) tmp = t_2; elseif (t < 1.0535888557455487e-139) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(j * N[(N[Power[N[(c * t), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[(i * y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(c * t), $MachinePrecision] + N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[(N[(z * y), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(b * N[(N[(z * c), $MachinePrecision] - N[(a * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(c * t), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -8.120978919195912e-33], t$95$2, If[Less[t, -4.712553818218485e-169], t$95$1, If[Less[t, -7.633533346031584e-308], t$95$2, If[Less[t, 1.0535888557455487e-139], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \frac{j \cdot \left({\left(c \cdot t\right)}^{2} - {\left(i \cdot y\right)}^{2}\right)}{c \cdot t + i \cdot y}\\
t_2 := x \cdot \left(z \cdot y - a \cdot t\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) - \left(c \cdot t - y \cdot i\right) \cdot j\right)\\
\mathbf{if}\;t < -8.120978919195912 \cdot 10^{-33}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t < -4.712553818218485 \cdot 10^{-169}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t < -7.633533346031584 \cdot 10^{-308}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t < 1.0535888557455487 \cdot 10^{-139}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2025073
(FPCore (x y z t a b c i j)
:name "Linear.Matrix:det33 from linear-1.19.1.3"
:precision binary64
:alt
(! :herbie-platform default (if (< t -1015122364899489/125000000000000000000000000000000000000000000000) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t -942510763643697/2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2) (pow (* i y) 2))) (+ (* c t) (* i y)))) (if (< t -238547917063487/3125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t 10535888557455487/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2) (pow (* i y) 2))) (+ (* c t) (* i y)))) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))))))))
(+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))