
(FPCore (x y z t a b c i j k) :precision binary64 (- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
}
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, k)
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), intent (in) :: k
code = (((((((x * 18.0d0) * y) * z) * t) - ((a * 4.0d0) * t)) + (b * c)) - ((x * 4.0d0) * i)) - ((j * 27.0d0) * k)
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 k) {
return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
}
def code(x, y, z, t, a, b, c, i, j, k): return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k)
function code(x, y, z, t, a, b, c, i, j, k) return Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * 18.0) * y) * z) * t) - Float64(Float64(a * 4.0) * t)) + Float64(b * c)) - Float64(Float64(x * 4.0) * i)) - Float64(Float64(j * 27.0) * k)) end
function tmp = code(x, y, z, t, a, b, c, i, j, k) tmp = (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := N[(N[(N[(N[(N[(N[(N[(N[(x * 18.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - N[(N[(x * 4.0), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] - N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k
\end{array}
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i j k) :precision binary64 (- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
}
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, k)
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), intent (in) :: k
code = (((((((x * 18.0d0) * y) * z) * t) - ((a * 4.0d0) * t)) + (b * c)) - ((x * 4.0d0) * i)) - ((j * 27.0d0) * k)
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 k) {
return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
}
def code(x, y, z, t, a, b, c, i, j, k): return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k)
function code(x, y, z, t, a, b, c, i, j, k) return Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * 18.0) * y) * z) * t) - Float64(Float64(a * 4.0) * t)) + Float64(b * c)) - Float64(Float64(x * 4.0) * i)) - Float64(Float64(j * 27.0) * k)) end
function tmp = code(x, y, z, t, a, b, c, i, j, k) tmp = (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k); end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := N[(N[(N[(N[(N[(N[(N[(N[(x * 18.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - N[(N[(x * 4.0), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] - N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k
\end{array}
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1
(-
(*
(- (fma (* (* z y) t) 18.0 (/ (* c b) x)) (* 4.0 (fma a (/ t x) i)))
x)
(* j (* k 27.0)))))
(if (<= x -7e+63)
t_1
(if (<= x 1.36e-68)
(-
(-
(+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c))
(* (* x 4.0) i))
(* (* j 27.0) k))
t_1))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = ((fma(((z * y) * t), 18.0, ((c * b) / x)) - (4.0 * fma(a, (t / x), i))) * x) - (j * (k * 27.0));
double tmp;
if (x <= -7e+63) {
tmp = t_1;
} else if (x <= 1.36e-68) {
tmp = (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(Float64(Float64(fma(Float64(Float64(z * y) * t), 18.0, Float64(Float64(c * b) / x)) - Float64(4.0 * fma(a, Float64(t / x), i))) * x) - Float64(j * Float64(k * 27.0))) tmp = 0.0 if (x <= -7e+63) tmp = t_1; elseif (x <= 1.36e-68) tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * 18.0) * y) * z) * t) - Float64(Float64(a * 4.0) * t)) + Float64(b * c)) - Float64(Float64(x * 4.0) * i)) - Float64(Float64(j * 27.0) * k)); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(N[(N[(N[(N[(z * y), $MachinePrecision] * t), $MachinePrecision] * 18.0 + N[(N[(c * b), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - N[(4.0 * N[(a * N[(t / x), $MachinePrecision] + i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] - N[(j * N[(k * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7e+63], t$95$1, If[LessEqual[x, 1.36e-68], N[(N[(N[(N[(N[(N[(N[(N[(x * 18.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - N[(N[(x * 4.0), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] - N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := \left(\mathsf{fma}\left(\left(z \cdot y\right) \cdot t, 18, \frac{c \cdot b}{x}\right) - 4 \cdot \mathsf{fma}\left(a, \frac{t}{x}, i\right)\right) \cdot x - j \cdot \left(k \cdot 27\right)\\
\mathbf{if}\;x \leq -7 \cdot 10^{+63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.36 \cdot 10^{-68}:\\
\;\;\;\;\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -7.00000000000000059e63 or 1.36000000000000003e-68 < x Initial program 76.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6476.4
Applied rewrites76.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.9%
if -7.00000000000000059e63 < x < 1.36000000000000003e-68Initial program 93.8%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1
(-
(+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c))
(* (* x 4.0) i))))
(if (<= (- t_1 (* (* j 27.0) k)) INFINITY)
(- t_1 (* j (* k 27.0)))
(fma c b (* -4.0 (fma i x (* a t)))))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = ((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i);
double tmp;
if ((t_1 - ((j * 27.0) * k)) <= ((double) INFINITY)) {
tmp = t_1 - (j * (k * 27.0));
} else {
tmp = fma(c, b, (-4.0 * fma(i, x, (a * t))));
}
return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * 18.0) * y) * z) * t) - Float64(Float64(a * 4.0) * t)) + Float64(b * c)) - Float64(Float64(x * 4.0) * i)) tmp = 0.0 if (Float64(t_1 - Float64(Float64(j * 27.0) * k)) <= Inf) tmp = Float64(t_1 - Float64(j * Float64(k * 27.0))); else tmp = fma(c, b, Float64(-4.0 * fma(i, x, Float64(a * t)))); end return tmp end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(N[(N[(N[(N[(N[(x * 18.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - N[(N[(x * 4.0), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$1 - N[(j * N[(k * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * b + N[(-4.0 * N[(i * x + N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := \left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\\
\mathbf{if}\;t\_1 - \left(j \cdot 27\right) \cdot k \leq \infty:\\
\;\;\;\;t\_1 - j \cdot \left(k \cdot 27\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, b, -4 \cdot \mathsf{fma}\left(i, x, a \cdot t\right)\right)\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 (-.f64 (*.f64 (*.f64 (*.f64 (*.f64 x #s(literal 18 binary64)) y) z) t) (*.f64 (*.f64 a #s(literal 4 binary64)) t)) (*.f64 b c)) (*.f64 (*.f64 x #s(literal 4 binary64)) i)) (*.f64 (*.f64 j #s(literal 27 binary64)) k)) < +inf.0Initial program 94.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6494.9
Applied rewrites94.9%
if +inf.0 < (-.f64 (-.f64 (+.f64 (-.f64 (*.f64 (*.f64 (*.f64 (*.f64 x #s(literal 18 binary64)) y) z) t) (*.f64 (*.f64 a #s(literal 4 binary64)) t)) (*.f64 b c)) (*.f64 (*.f64 x #s(literal 4 binary64)) i)) (*.f64 (*.f64 j #s(literal 27 binary64)) k)) Initial program 0.0%
Taylor expanded in y around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6432.0
Applied rewrites32.0%
Taylor expanded in j around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6442.5
Applied rewrites42.5%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (* x 4.0) i)))
(if (<=
(-
(- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) t_1)
(* (* j 27.0) k))
INFINITY)
(-
(- (+ (fma (* a t) -4.0 (* (* (* y x) 18.0) (* z t))) (* b c)) t_1)
(* j (* k 27.0)))
(fma c b (* -4.0 (fma i x (* a t)))))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = (x * 4.0) * i;
double tmp;
if (((((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - t_1) - ((j * 27.0) * k)) <= ((double) INFINITY)) {
tmp = ((fma((a * t), -4.0, (((y * x) * 18.0) * (z * t))) + (b * c)) - t_1) - (j * (k * 27.0));
} else {
tmp = fma(c, b, (-4.0 * fma(i, x, (a * t))));
}
return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(Float64(x * 4.0) * i) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * 18.0) * y) * z) * t) - Float64(Float64(a * 4.0) * t)) + Float64(b * c)) - t_1) - Float64(Float64(j * 27.0) * k)) <= Inf) tmp = Float64(Float64(Float64(fma(Float64(a * t), -4.0, Float64(Float64(Float64(y * x) * 18.0) * Float64(z * t))) + Float64(b * c)) - t_1) - Float64(j * Float64(k * 27.0))); else tmp = fma(c, b, Float64(-4.0 * fma(i, x, Float64(a * t)))); end return tmp end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(x * 4.0), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(N[(N[(N[(N[(x * 18.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] - N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(N[(N[(y * x), $MachinePrecision] * 18.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] - N[(j * N[(k * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * b + N[(-4.0 * N[(i * x + N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 4\right) \cdot i\\
\mathbf{if}\;\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - t\_1\right) - \left(j \cdot 27\right) \cdot k \leq \infty:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(a \cdot t, -4, \left(\left(y \cdot x\right) \cdot 18\right) \cdot \left(z \cdot t\right)\right) + b \cdot c\right) - t\_1\right) - j \cdot \left(k \cdot 27\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, b, -4 \cdot \mathsf{fma}\left(i, x, a \cdot t\right)\right)\\
\end{array}
\end{array}
if (-.f64 (-.f64 (+.f64 (-.f64 (*.f64 (*.f64 (*.f64 (*.f64 x #s(literal 18 binary64)) y) z) t) (*.f64 (*.f64 a #s(literal 4 binary64)) t)) (*.f64 b c)) (*.f64 (*.f64 x #s(literal 4 binary64)) i)) (*.f64 (*.f64 j #s(literal 27 binary64)) k)) < +inf.0Initial program 94.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6494.9
Applied rewrites94.9%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*r*N/A
*-commutativeN/A
Applied rewrites92.7%
if +inf.0 < (-.f64 (-.f64 (+.f64 (-.f64 (*.f64 (*.f64 (*.f64 (*.f64 x #s(literal 18 binary64)) y) z) t) (*.f64 (*.f64 a #s(literal 4 binary64)) t)) (*.f64 b c)) (*.f64 (*.f64 x #s(literal 4 binary64)) i)) (*.f64 (*.f64 j #s(literal 27 binary64)) k)) Initial program 0.0%
Taylor expanded in y around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6432.0
Applied rewrites32.0%
Taylor expanded in j around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6442.5
Applied rewrites42.5%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(if (<= y -12500.0)
(-
(*
(fma
(* -18.0 t)
(* z x)
(- (/ (- (* c b) (fma 4.0 (fma a t (* i x)) (* (* k j) 27.0))) y)))
y))
(-
(-
(+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c))
(* (* x 4.0) i))
(* j (* k 27.0)))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double tmp;
if (y <= -12500.0) {
tmp = -(fma((-18.0 * t), (z * x), -(((c * b) - fma(4.0, fma(a, t, (i * x)), ((k * j) * 27.0))) / y)) * y);
} else {
tmp = (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - (j * (k * 27.0));
}
return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) tmp = 0.0 if (y <= -12500.0) tmp = Float64(-Float64(fma(Float64(-18.0 * t), Float64(z * x), Float64(-Float64(Float64(Float64(c * b) - fma(4.0, fma(a, t, Float64(i * x)), Float64(Float64(k * j) * 27.0))) / y))) * y)); else tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * 18.0) * y) * z) * t) - Float64(Float64(a * 4.0) * t)) + Float64(b * c)) - Float64(Float64(x * 4.0) * i)) - Float64(j * Float64(k * 27.0))); end return tmp end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := If[LessEqual[y, -12500.0], (-N[(N[(N[(-18.0 * t), $MachinePrecision] * N[(z * x), $MachinePrecision] + (-N[(N[(N[(c * b), $MachinePrecision] - N[(4.0 * N[(a * t + N[(i * x), $MachinePrecision]), $MachinePrecision] + N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision])), $MachinePrecision] * y), $MachinePrecision]), N[(N[(N[(N[(N[(N[(N[(N[(x * 18.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(b * c), $MachinePrecision]), $MachinePrecision] - N[(N[(x * 4.0), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] - N[(j * N[(k * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -12500:\\
\;\;\;\;-\mathsf{fma}\left(-18 \cdot t, z \cdot x, -\frac{c \cdot b - \mathsf{fma}\left(4, \mathsf{fma}\left(a, t, i \cdot x\right), \left(k \cdot j\right) \cdot 27\right)}{y}\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - j \cdot \left(k \cdot 27\right)\\
\end{array}
\end{array}
if y < -12500Initial program 78.5%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites89.1%
if -12500 < y Initial program 87.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6487.4
Applied rewrites87.4%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1
(fma (* -4.0 i) x (- (fma (* a t) -4.0 (* c b)) (* (* k j) 27.0)))))
(if (<= a -5.8e+24)
t_1
(if (<= a 2.55e-172)
(-
(fma (* -4.0 i) x (fma (* (* (* z y) x) t) 18.0 (* c b)))
(* (* j 27.0) k))
t_1))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = fma((-4.0 * i), x, (fma((a * t), -4.0, (c * b)) - ((k * j) * 27.0)));
double tmp;
if (a <= -5.8e+24) {
tmp = t_1;
} else if (a <= 2.55e-172) {
tmp = fma((-4.0 * i), x, fma((((z * y) * x) * t), 18.0, (c * b))) - ((j * 27.0) * k);
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = fma(Float64(-4.0 * i), x, Float64(fma(Float64(a * t), -4.0, Float64(c * b)) - Float64(Float64(k * j) * 27.0))) tmp = 0.0 if (a <= -5.8e+24) tmp = t_1; elseif (a <= 2.55e-172) tmp = Float64(fma(Float64(-4.0 * i), x, fma(Float64(Float64(Float64(z * y) * x) * t), 18.0, Float64(c * b))) - Float64(Float64(j * 27.0) * k)); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(-4.0 * i), $MachinePrecision] * x + N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(c * b), $MachinePrecision]), $MachinePrecision] - N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -5.8e+24], t$95$1, If[LessEqual[a, 2.55e-172], N[(N[(N[(-4.0 * i), $MachinePrecision] * x + N[(N[(N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision] * t), $MachinePrecision] * 18.0 + N[(c * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(a \cdot t, -4, c \cdot b\right) - \left(k \cdot j\right) \cdot 27\right)\\
\mathbf{if}\;a \leq -5.8 \cdot 10^{+24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.55 \cdot 10^{-172}:\\
\;\;\;\;\mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t, 18, c \cdot b\right)\right) - \left(j \cdot 27\right) \cdot k\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -5.79999999999999958e24 or 2.5499999999999999e-172 < a Initial program 84.1%
Taylor expanded in y around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.9
Applied rewrites78.9%
Taylor expanded in x around 0
associate--l+N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate--r+N/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6479.4
Applied rewrites79.4%
if -5.79999999999999958e24 < a < 2.5499999999999999e-172Initial program 87.1%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6485.7
Applied rewrites85.7%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (* j 27.0) k)))
(if (<= t_1 -5e+248)
(- (* c b) t_1)
(if (<= t_1 2e+52)
(fma c b (* -4.0 (fma i x (* a t))))
(- (* (* a t) -4.0) (* j (* k 27.0)))))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = (j * 27.0) * k;
double tmp;
if (t_1 <= -5e+248) {
tmp = (c * b) - t_1;
} else if (t_1 <= 2e+52) {
tmp = fma(c, b, (-4.0 * fma(i, x, (a * t))));
} else {
tmp = ((a * t) * -4.0) - (j * (k * 27.0));
}
return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_1 <= -5e+248) tmp = Float64(Float64(c * b) - t_1); elseif (t_1 <= 2e+52) tmp = fma(c, b, Float64(-4.0 * fma(i, x, Float64(a * t)))); else tmp = Float64(Float64(Float64(a * t) * -4.0) - Float64(j * Float64(k * 27.0))); end return tmp end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+248], N[(N[(c * b), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[t$95$1, 2e+52], N[(c * b + N[(-4.0 * N[(i * x + N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * t), $MachinePrecision] * -4.0), $MachinePrecision] - N[(j * N[(k * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+248}:\\
\;\;\;\;c \cdot b - t\_1\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(c, b, -4 \cdot \mathsf{fma}\left(i, x, a \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot t\right) \cdot -4 - j \cdot \left(k \cdot 27\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -4.9999999999999996e248Initial program 74.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6477.5
Applied rewrites77.5%
if -4.9999999999999996e248 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 2e52Initial program 87.7%
Taylor expanded in y around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6476.1
Applied rewrites76.1%
Taylor expanded in j around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6468.8
Applied rewrites68.8%
if 2e52 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 82.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6482.0
Applied rewrites82.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6459.8
Applied rewrites59.8%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (* j 27.0) k)))
(if (<= t_1 -5e+248)
(- (* c b) t_1)
(if (<= t_1 2e+52)
(fma c b (* -4.0 (fma i x (* a t))))
(- (* -4.0 (* a t)) t_1)))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = (j * 27.0) * k;
double tmp;
if (t_1 <= -5e+248) {
tmp = (c * b) - t_1;
} else if (t_1 <= 2e+52) {
tmp = fma(c, b, (-4.0 * fma(i, x, (a * t))));
} else {
tmp = (-4.0 * (a * t)) - t_1;
}
return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_1 <= -5e+248) tmp = Float64(Float64(c * b) - t_1); elseif (t_1 <= 2e+52) tmp = fma(c, b, Float64(-4.0 * fma(i, x, Float64(a * t)))); else tmp = Float64(Float64(-4.0 * Float64(a * t)) - t_1); end return tmp end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+248], N[(N[(c * b), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[t$95$1, 2e+52], N[(c * b + N[(-4.0 * N[(i * x + N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+248}:\\
\;\;\;\;c \cdot b - t\_1\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(c, b, -4 \cdot \mathsf{fma}\left(i, x, a \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(a \cdot t\right) - t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -4.9999999999999996e248Initial program 74.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6477.5
Applied rewrites77.5%
if -4.9999999999999996e248 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 2e52Initial program 87.7%
Taylor expanded in y around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6476.1
Applied rewrites76.1%
Taylor expanded in j around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6468.8
Applied rewrites68.8%
if 2e52 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 82.1%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6459.7
Applied rewrites59.7%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(if (<= (* b c) -2e+242)
(* c b)
(if (<= (* b c) -1e-10)
(* (* -27.0 k) j)
(if (<= (* b c) 2e-245)
(* -4.0 (* a t))
(if (<= (* b c) 5e+59) (* -27.0 (* k j)) (* c b))))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double tmp;
if ((b * c) <= -2e+242) {
tmp = c * b;
} else if ((b * c) <= -1e-10) {
tmp = (-27.0 * k) * j;
} else if ((b * c) <= 2e-245) {
tmp = -4.0 * (a * t);
} else if ((b * c) <= 5e+59) {
tmp = -27.0 * (k * j);
} else {
tmp = c * b;
}
return tmp;
}
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
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, k)
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), intent (in) :: k
real(8) :: tmp
if ((b * c) <= (-2d+242)) then
tmp = c * b
else if ((b * c) <= (-1d-10)) then
tmp = ((-27.0d0) * k) * j
else if ((b * c) <= 2d-245) then
tmp = (-4.0d0) * (a * t)
else if ((b * c) <= 5d+59) then
tmp = (-27.0d0) * (k * j)
else
tmp = c * b
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double tmp;
if ((b * c) <= -2e+242) {
tmp = c * b;
} else if ((b * c) <= -1e-10) {
tmp = (-27.0 * k) * j;
} else if ((b * c) <= 2e-245) {
tmp = -4.0 * (a * t);
} else if ((b * c) <= 5e+59) {
tmp = -27.0 * (k * j);
} else {
tmp = c * b;
}
return tmp;
}
[x, y, z, t, a, b, c, i, j, k] = sort([x, y, z, t, a, b, c, i, j, k]) def code(x, y, z, t, a, b, c, i, j, k): tmp = 0 if (b * c) <= -2e+242: tmp = c * b elif (b * c) <= -1e-10: tmp = (-27.0 * k) * j elif (b * c) <= 2e-245: tmp = -4.0 * (a * t) elif (b * c) <= 5e+59: tmp = -27.0 * (k * j) else: tmp = c * b return tmp
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) tmp = 0.0 if (Float64(b * c) <= -2e+242) tmp = Float64(c * b); elseif (Float64(b * c) <= -1e-10) tmp = Float64(Float64(-27.0 * k) * j); elseif (Float64(b * c) <= 2e-245) tmp = Float64(-4.0 * Float64(a * t)); elseif (Float64(b * c) <= 5e+59) tmp = Float64(-27.0 * Float64(k * j)); else tmp = Float64(c * b); end return tmp end
x, y, z, t, a, b, c, i, j, k = num2cell(sort([x, y, z, t, a, b, c, i, j, k])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k)
tmp = 0.0;
if ((b * c) <= -2e+242)
tmp = c * b;
elseif ((b * c) <= -1e-10)
tmp = (-27.0 * k) * j;
elseif ((b * c) <= 2e-245)
tmp = -4.0 * (a * t);
elseif ((b * c) <= 5e+59)
tmp = -27.0 * (k * j);
else
tmp = c * b;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := If[LessEqual[N[(b * c), $MachinePrecision], -2e+242], N[(c * b), $MachinePrecision], If[LessEqual[N[(b * c), $MachinePrecision], -1e-10], N[(N[(-27.0 * k), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[N[(b * c), $MachinePrecision], 2e-245], N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(b * c), $MachinePrecision], 5e+59], N[(-27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision], N[(c * b), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
\mathbf{if}\;b \cdot c \leq -2 \cdot 10^{+242}:\\
\;\;\;\;c \cdot b\\
\mathbf{elif}\;b \cdot c \leq -1 \cdot 10^{-10}:\\
\;\;\;\;\left(-27 \cdot k\right) \cdot j\\
\mathbf{elif}\;b \cdot c \leq 2 \cdot 10^{-245}:\\
\;\;\;\;-4 \cdot \left(a \cdot t\right)\\
\mathbf{elif}\;b \cdot c \leq 5 \cdot 10^{+59}:\\
\;\;\;\;-27 \cdot \left(k \cdot j\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot b\\
\end{array}
\end{array}
if (*.f64 b c) < -2.0000000000000001e242 or 4.9999999999999997e59 < (*.f64 b c) Initial program 81.2%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6456.3
Applied rewrites56.3%
if -2.0000000000000001e242 < (*.f64 b c) < -1.00000000000000004e-10Initial program 87.3%
Taylor expanded in j around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6422.9
Applied rewrites22.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6422.9
Applied rewrites22.9%
if -1.00000000000000004e-10 < (*.f64 b c) < 1.9999999999999999e-245Initial program 87.1%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6425.6
Applied rewrites25.6%
if 1.9999999999999999e-245 < (*.f64 b c) < 4.9999999999999997e59Initial program 86.6%
Taylor expanded in j around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6427.8
Applied rewrites27.8%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* -27.0 (* k j))))
(if (<= (* b c) -2e+242)
(* c b)
(if (<= (* b c) -1e-10)
t_1
(if (<= (* b c) 2e-245)
(* -4.0 (* a t))
(if (<= (* b c) 5e+59) t_1 (* c b)))))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = -27.0 * (k * j);
double tmp;
if ((b * c) <= -2e+242) {
tmp = c * b;
} else if ((b * c) <= -1e-10) {
tmp = t_1;
} else if ((b * c) <= 2e-245) {
tmp = -4.0 * (a * t);
} else if ((b * c) <= 5e+59) {
tmp = t_1;
} else {
tmp = c * b;
}
return tmp;
}
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
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, k)
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), intent (in) :: k
real(8) :: t_1
real(8) :: tmp
t_1 = (-27.0d0) * (k * j)
if ((b * c) <= (-2d+242)) then
tmp = c * b
else if ((b * c) <= (-1d-10)) then
tmp = t_1
else if ((b * c) <= 2d-245) then
tmp = (-4.0d0) * (a * t)
else if ((b * c) <= 5d+59) then
tmp = t_1
else
tmp = c * b
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = -27.0 * (k * j);
double tmp;
if ((b * c) <= -2e+242) {
tmp = c * b;
} else if ((b * c) <= -1e-10) {
tmp = t_1;
} else if ((b * c) <= 2e-245) {
tmp = -4.0 * (a * t);
} else if ((b * c) <= 5e+59) {
tmp = t_1;
} else {
tmp = c * b;
}
return tmp;
}
[x, y, z, t, a, b, c, i, j, k] = sort([x, y, z, t, a, b, c, i, j, k]) def code(x, y, z, t, a, b, c, i, j, k): t_1 = -27.0 * (k * j) tmp = 0 if (b * c) <= -2e+242: tmp = c * b elif (b * c) <= -1e-10: tmp = t_1 elif (b * c) <= 2e-245: tmp = -4.0 * (a * t) elif (b * c) <= 5e+59: tmp = t_1 else: tmp = c * b return tmp
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(-27.0 * Float64(k * j)) tmp = 0.0 if (Float64(b * c) <= -2e+242) tmp = Float64(c * b); elseif (Float64(b * c) <= -1e-10) tmp = t_1; elseif (Float64(b * c) <= 2e-245) tmp = Float64(-4.0 * Float64(a * t)); elseif (Float64(b * c) <= 5e+59) tmp = t_1; else tmp = Float64(c * b); end return tmp end
x, y, z, t, a, b, c, i, j, k = num2cell(sort([x, y, z, t, a, b, c, i, j, k])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k)
t_1 = -27.0 * (k * j);
tmp = 0.0;
if ((b * c) <= -2e+242)
tmp = c * b;
elseif ((b * c) <= -1e-10)
tmp = t_1;
elseif ((b * c) <= 2e-245)
tmp = -4.0 * (a * t);
elseif ((b * c) <= 5e+59)
tmp = t_1;
else
tmp = c * b;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(-27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(b * c), $MachinePrecision], -2e+242], N[(c * b), $MachinePrecision], If[LessEqual[N[(b * c), $MachinePrecision], -1e-10], t$95$1, If[LessEqual[N[(b * c), $MachinePrecision], 2e-245], N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(b * c), $MachinePrecision], 5e+59], t$95$1, N[(c * b), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := -27 \cdot \left(k \cdot j\right)\\
\mathbf{if}\;b \cdot c \leq -2 \cdot 10^{+242}:\\
\;\;\;\;c \cdot b\\
\mathbf{elif}\;b \cdot c \leq -1 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \cdot c \leq 2 \cdot 10^{-245}:\\
\;\;\;\;-4 \cdot \left(a \cdot t\right)\\
\mathbf{elif}\;b \cdot c \leq 5 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;c \cdot b\\
\end{array}
\end{array}
if (*.f64 b c) < -2.0000000000000001e242 or 4.9999999999999997e59 < (*.f64 b c) Initial program 81.2%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6456.3
Applied rewrites56.3%
if -2.0000000000000001e242 < (*.f64 b c) < -1.00000000000000004e-10 or 1.9999999999999999e-245 < (*.f64 b c) < 4.9999999999999997e59Initial program 87.0%
Taylor expanded in j around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6425.5
Applied rewrites25.5%
if -1.00000000000000004e-10 < (*.f64 b c) < 1.9999999999999999e-245Initial program 87.1%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6425.6
Applied rewrites25.6%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (* j 27.0) k)))
(if (<= t_1 -5e+248)
(- (* c b) t_1)
(if (<= t_1 1e+296)
(fma c b (* -4.0 (fma i x (* a t))))
(* -27.0 (* k j))))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = (j * 27.0) * k;
double tmp;
if (t_1 <= -5e+248) {
tmp = (c * b) - t_1;
} else if (t_1 <= 1e+296) {
tmp = fma(c, b, (-4.0 * fma(i, x, (a * t))));
} else {
tmp = -27.0 * (k * j);
}
return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_1 <= -5e+248) tmp = Float64(Float64(c * b) - t_1); elseif (t_1 <= 1e+296) tmp = fma(c, b, Float64(-4.0 * fma(i, x, Float64(a * t)))); else tmp = Float64(-27.0 * Float64(k * j)); end return tmp end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+248], N[(N[(c * b), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[t$95$1, 1e+296], N[(c * b + N[(-4.0 * N[(i * x + N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+248}:\\
\;\;\;\;c \cdot b - t\_1\\
\mathbf{elif}\;t\_1 \leq 10^{+296}:\\
\;\;\;\;\mathsf{fma}\left(c, b, -4 \cdot \mathsf{fma}\left(i, x, a \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-27 \cdot \left(k \cdot j\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -4.9999999999999996e248Initial program 74.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6477.5
Applied rewrites77.5%
if -4.9999999999999996e248 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 9.99999999999999981e295Initial program 87.4%
Taylor expanded in y around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6476.6
Applied rewrites76.6%
Taylor expanded in j around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6465.3
Applied rewrites65.3%
if 9.99999999999999981e295 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 74.1%
Taylor expanded in j around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6485.2
Applied rewrites85.2%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (fma (* 18.0 t) (* z y) (* -4.0 i)) x)))
(if (<= x -7.2e+230)
t_1
(if (<= x 1.85e+208)
(fma (* -4.0 i) x (- (fma (* a t) -4.0 (* c b)) (* (* k j) 27.0)))
t_1))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = fma((18.0 * t), (z * y), (-4.0 * i)) * x;
double tmp;
if (x <= -7.2e+230) {
tmp = t_1;
} else if (x <= 1.85e+208) {
tmp = fma((-4.0 * i), x, (fma((a * t), -4.0, (c * b)) - ((k * j) * 27.0)));
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(fma(Float64(18.0 * t), Float64(z * y), Float64(-4.0 * i)) * x) tmp = 0.0 if (x <= -7.2e+230) tmp = t_1; elseif (x <= 1.85e+208) tmp = fma(Float64(-4.0 * i), x, Float64(fma(Float64(a * t), -4.0, Float64(c * b)) - Float64(Float64(k * j) * 27.0))); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(N[(18.0 * t), $MachinePrecision] * N[(z * y), $MachinePrecision] + N[(-4.0 * i), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -7.2e+230], t$95$1, If[LessEqual[x, 1.85e+208], N[(N[(-4.0 * i), $MachinePrecision] * x + N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(c * b), $MachinePrecision]), $MachinePrecision] - N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right) \cdot x\\
\mathbf{if}\;x \leq -7.2 \cdot 10^{+230}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{+208}:\\
\;\;\;\;\mathsf{fma}\left(-4 \cdot i, x, \mathsf{fma}\left(a \cdot t, -4, c \cdot b\right) - \left(k \cdot j\right) \cdot 27\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -7.20000000000000037e230 or 1.84999999999999994e208 < x Initial program 67.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6479.9
Applied rewrites79.9%
if -7.20000000000000037e230 < x < 1.84999999999999994e208Initial program 88.2%
Taylor expanded in y around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6479.4
Applied rewrites79.4%
Taylor expanded in x around 0
associate--l+N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate--r+N/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6479.9
Applied rewrites79.9%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (* j 27.0) k)))
(if (<= t_1 -5e+248)
(- (* c b) t_1)
(if (<= t_1 2e+52)
(fma (* -4.0 i) x (* c b))
(- (* c b) (* (* k j) 27.0))))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = (j * 27.0) * k;
double tmp;
if (t_1 <= -5e+248) {
tmp = (c * b) - t_1;
} else if (t_1 <= 2e+52) {
tmp = fma((-4.0 * i), x, (c * b));
} else {
tmp = (c * b) - ((k * j) * 27.0);
}
return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_1 <= -5e+248) tmp = Float64(Float64(c * b) - t_1); elseif (t_1 <= 2e+52) tmp = fma(Float64(-4.0 * i), x, Float64(c * b)); else tmp = Float64(Float64(c * b) - Float64(Float64(k * j) * 27.0)); end return tmp end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+248], N[(N[(c * b), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[t$95$1, 2e+52], N[(N[(-4.0 * i), $MachinePrecision] * x + N[(c * b), $MachinePrecision]), $MachinePrecision], N[(N[(c * b), $MachinePrecision] - N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+248}:\\
\;\;\;\;c \cdot b - t\_1\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(-4 \cdot i, x, c \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot b - \left(k \cdot j\right) \cdot 27\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -4.9999999999999996e248Initial program 74.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6477.5
Applied rewrites77.5%
if -4.9999999999999996e248 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 2e52Initial program 87.7%
Taylor expanded in y around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6476.1
Applied rewrites76.1%
Taylor expanded in x around 0
associate--l+N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate--r+N/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6476.3
Applied rewrites76.3%
Taylor expanded in b around inf
*-commutativeN/A
lift-*.f6447.3
Applied rewrites47.3%
if 2e52 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 82.1%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6461.9
Applied rewrites61.9%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6462.0
Applied rewrites62.0%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (* j 27.0) k)) (t_2 (- (* c b) t_1)))
(if (<= t_1 -5e+248)
t_2
(if (<= t_1 2e+52) (fma (* -4.0 i) x (* c b)) t_2))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = (j * 27.0) * k;
double t_2 = (c * b) - t_1;
double tmp;
if (t_1 <= -5e+248) {
tmp = t_2;
} else if (t_1 <= 2e+52) {
tmp = fma((-4.0 * i), x, (c * b));
} else {
tmp = t_2;
}
return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(Float64(j * 27.0) * k) t_2 = Float64(Float64(c * b) - t_1) tmp = 0.0 if (t_1 <= -5e+248) tmp = t_2; elseif (t_1 <= 2e+52) tmp = fma(Float64(-4.0 * i), x, Float64(c * b)); else tmp = t_2; end return tmp end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * b), $MachinePrecision] - t$95$1), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+248], t$95$2, If[LessEqual[t$95$1, 2e+52], N[(N[(-4.0 * i), $MachinePrecision] * x + N[(c * b), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := \left(j \cdot 27\right) \cdot k\\
t_2 := c \cdot b - t\_1\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+248}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(-4 \cdot i, x, c \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -4.9999999999999996e248 or 2e52 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 79.7%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6466.6
Applied rewrites66.6%
if -4.9999999999999996e248 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 2e52Initial program 87.7%
Taylor expanded in y around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6476.1
Applied rewrites76.1%
Taylor expanded in x around 0
associate--l+N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate--r+N/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6476.3
Applied rewrites76.3%
Taylor expanded in b around inf
*-commutativeN/A
lift-*.f6447.3
Applied rewrites47.3%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (* j 27.0) k)))
(if (<= t_1 -5e+248)
(* (* -27.0 j) k)
(if (<= t_1 2e+52) (fma (* -4.0 i) x (* c b)) (* -27.0 (* k j))))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = (j * 27.0) * k;
double tmp;
if (t_1 <= -5e+248) {
tmp = (-27.0 * j) * k;
} else if (t_1 <= 2e+52) {
tmp = fma((-4.0 * i), x, (c * b));
} else {
tmp = -27.0 * (k * j);
}
return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_1 <= -5e+248) tmp = Float64(Float64(-27.0 * j) * k); elseif (t_1 <= 2e+52) tmp = fma(Float64(-4.0 * i), x, Float64(c * b)); else tmp = Float64(-27.0 * Float64(k * j)); end return tmp end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+248], N[(N[(-27.0 * j), $MachinePrecision] * k), $MachinePrecision], If[LessEqual[t$95$1, 2e+52], N[(N[(-4.0 * i), $MachinePrecision] * x + N[(c * b), $MachinePrecision]), $MachinePrecision], N[(-27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+248}:\\
\;\;\;\;\left(-27 \cdot j\right) \cdot k\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(-4 \cdot i, x, c \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;-27 \cdot \left(k \cdot j\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -4.9999999999999996e248Initial program 74.3%
Taylor expanded in j around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.6
Applied rewrites77.6%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6477.5
Applied rewrites77.5%
if -4.9999999999999996e248 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 2e52Initial program 87.7%
Taylor expanded in y around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6476.1
Applied rewrites76.1%
Taylor expanded in x around 0
associate--l+N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate--r+N/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6476.3
Applied rewrites76.3%
Taylor expanded in b around inf
*-commutativeN/A
lift-*.f6447.3
Applied rewrites47.3%
if 2e52 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 82.1%
Taylor expanded in j around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.3
Applied rewrites49.3%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (fma (* 18.0 t) (* z y) (* -4.0 i)) x)))
(if (<= x -7.2e+230)
t_1
(if (<= x 2.2e+204)
(- (* c b) (fma 4.0 (fma a t (* i x)) (* (* k j) 27.0)))
t_1))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = fma((18.0 * t), (z * y), (-4.0 * i)) * x;
double tmp;
if (x <= -7.2e+230) {
tmp = t_1;
} else if (x <= 2.2e+204) {
tmp = (c * b) - fma(4.0, fma(a, t, (i * x)), ((k * j) * 27.0));
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(fma(Float64(18.0 * t), Float64(z * y), Float64(-4.0 * i)) * x) tmp = 0.0 if (x <= -7.2e+230) tmp = t_1; elseif (x <= 2.2e+204) tmp = Float64(Float64(c * b) - fma(4.0, fma(a, t, Float64(i * x)), Float64(Float64(k * j) * 27.0))); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(N[(18.0 * t), $MachinePrecision] * N[(z * y), $MachinePrecision] + N[(-4.0 * i), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -7.2e+230], t$95$1, If[LessEqual[x, 2.2e+204], N[(N[(c * b), $MachinePrecision] - N[(4.0 * N[(a * t + N[(i * x), $MachinePrecision]), $MachinePrecision] + N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right) \cdot x\\
\mathbf{if}\;x \leq -7.2 \cdot 10^{+230}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+204}:\\
\;\;\;\;c \cdot b - \mathsf{fma}\left(4, \mathsf{fma}\left(a, t, i \cdot x\right), \left(k \cdot j\right) \cdot 27\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -7.20000000000000037e230 or 2.20000000000000011e204 < x Initial program 67.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6479.7
Applied rewrites79.7%
if -7.20000000000000037e230 < x < 2.20000000000000011e204Initial program 88.3%
Taylor expanded in y around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6479.5
Applied rewrites79.5%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (fma (* -4.0 i) x (* -4.0 (* a t)))))
(if (<= t -1e-67)
t_1
(if (<= t 4e-185)
(fma (* -4.0 i) x (* c b))
(if (<= t 1.7e+72)
(- (* c b) (* (* j 27.0) k))
(if (<= t 8e+133) (* (* (* (* z y) x) t) 18.0) t_1))))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = fma((-4.0 * i), x, (-4.0 * (a * t)));
double tmp;
if (t <= -1e-67) {
tmp = t_1;
} else if (t <= 4e-185) {
tmp = fma((-4.0 * i), x, (c * b));
} else if (t <= 1.7e+72) {
tmp = (c * b) - ((j * 27.0) * k);
} else if (t <= 8e+133) {
tmp = (((z * y) * x) * t) * 18.0;
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = fma(Float64(-4.0 * i), x, Float64(-4.0 * Float64(a * t))) tmp = 0.0 if (t <= -1e-67) tmp = t_1; elseif (t <= 4e-185) tmp = fma(Float64(-4.0 * i), x, Float64(c * b)); elseif (t <= 1.7e+72) tmp = Float64(Float64(c * b) - Float64(Float64(j * 27.0) * k)); elseif (t <= 8e+133) tmp = Float64(Float64(Float64(Float64(z * y) * x) * t) * 18.0); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(-4.0 * i), $MachinePrecision] * x + N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1e-67], t$95$1, If[LessEqual[t, 4e-185], N[(N[(-4.0 * i), $MachinePrecision] * x + N[(c * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.7e+72], N[(N[(c * b), $MachinePrecision] - N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8e+133], N[(N[(N[(N[(z * y), $MachinePrecision] * x), $MachinePrecision] * t), $MachinePrecision] * 18.0), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-4 \cdot i, x, -4 \cdot \left(a \cdot t\right)\right)\\
\mathbf{if}\;t \leq -1 \cdot 10^{-67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4 \cdot 10^{-185}:\\
\;\;\;\;\mathsf{fma}\left(-4 \cdot i, x, c \cdot b\right)\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{+72}:\\
\;\;\;\;c \cdot b - \left(j \cdot 27\right) \cdot k\\
\mathbf{elif}\;t \leq 8 \cdot 10^{+133}:\\
\;\;\;\;\left(\left(\left(z \cdot y\right) \cdot x\right) \cdot t\right) \cdot 18\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.99999999999999943e-68 or 8.0000000000000002e133 < t Initial program 84.4%
Taylor expanded in y around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6469.5
Applied rewrites69.5%
Taylor expanded in x around 0
associate--l+N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate--r+N/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6470.1
Applied rewrites70.1%
Taylor expanded in t around inf
lower-*.f64N/A
lift-*.f6445.7
Applied rewrites45.7%
if -9.99999999999999943e-68 < t < 4e-185Initial program 84.8%
Taylor expanded in y around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6488.0
Applied rewrites88.0%
Taylor expanded in x around 0
associate--l+N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate--r+N/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6488.6
Applied rewrites88.6%
Taylor expanded in b around inf
*-commutativeN/A
lift-*.f6456.3
Applied rewrites56.3%
if 4e-185 < t < 1.6999999999999999e72Initial program 87.8%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6450.3
Applied rewrites50.3%
if 1.6999999999999999e72 < t < 8.0000000000000002e133Initial program 84.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6433.5
Applied rewrites33.5%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i j k) :precision binary64 (let* ((t_1 (* -27.0 (* k j))) (t_2 (* (* j 27.0) k))) (if (<= t_2 -4e+40) t_1 (if (<= t_2 1e+19) (* c b) t_1))))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = -27.0 * (k * j);
double t_2 = (j * 27.0) * k;
double tmp;
if (t_2 <= -4e+40) {
tmp = t_1;
} else if (t_2 <= 1e+19) {
tmp = c * b;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
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, k)
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), intent (in) :: k
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-27.0d0) * (k * j)
t_2 = (j * 27.0d0) * k
if (t_2 <= (-4d+40)) then
tmp = t_1
else if (t_2 <= 1d+19) then
tmp = c * b
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = -27.0 * (k * j);
double t_2 = (j * 27.0) * k;
double tmp;
if (t_2 <= -4e+40) {
tmp = t_1;
} else if (t_2 <= 1e+19) {
tmp = c * b;
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t, a, b, c, i, j, k] = sort([x, y, z, t, a, b, c, i, j, k]) def code(x, y, z, t, a, b, c, i, j, k): t_1 = -27.0 * (k * j) t_2 = (j * 27.0) * k tmp = 0 if t_2 <= -4e+40: tmp = t_1 elif t_2 <= 1e+19: tmp = c * b else: tmp = t_1 return tmp
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(-27.0 * Float64(k * j)) t_2 = Float64(Float64(j * 27.0) * k) tmp = 0.0 if (t_2 <= -4e+40) tmp = t_1; elseif (t_2 <= 1e+19) tmp = Float64(c * b); else tmp = t_1; end return tmp end
x, y, z, t, a, b, c, i, j, k = num2cell(sort([x, y, z, t, a, b, c, i, j, k])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k)
t_1 = -27.0 * (k * j);
t_2 = (j * 27.0) * k;
tmp = 0.0;
if (t_2 <= -4e+40)
tmp = t_1;
elseif (t_2 <= 1e+19)
tmp = c * b;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(-27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(j * 27.0), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+40], t$95$1, If[LessEqual[t$95$2, 1e+19], N[(c * b), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := -27 \cdot \left(k \cdot j\right)\\
t_2 := \left(j \cdot 27\right) \cdot k\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+19}:\\
\;\;\;\;c \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 j #s(literal 27 binary64)) k) < -4.00000000000000012e40 or 1e19 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) Initial program 83.0%
Taylor expanded in j around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6447.4
Applied rewrites47.4%
if -4.00000000000000012e40 < (*.f64 (*.f64 j #s(literal 27 binary64)) k) < 1e19Initial program 87.1%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6428.4
Applied rewrites28.4%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (fma (* 18.0 t) (* z y) (* -4.0 i)) x)))
(if (<= x -5.8e+126)
t_1
(if (<= x 2.85e+20) (fma (* -27.0 j) k (fma -4.0 (* a t) (* c b))) t_1))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = fma((18.0 * t), (z * y), (-4.0 * i)) * x;
double tmp;
if (x <= -5.8e+126) {
tmp = t_1;
} else if (x <= 2.85e+20) {
tmp = fma((-27.0 * j), k, fma(-4.0, (a * t), (c * b)));
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(fma(Float64(18.0 * t), Float64(z * y), Float64(-4.0 * i)) * x) tmp = 0.0 if (x <= -5.8e+126) tmp = t_1; elseif (x <= 2.85e+20) tmp = fma(Float64(-27.0 * j), k, fma(-4.0, Float64(a * t), Float64(c * b))); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(N[(18.0 * t), $MachinePrecision] * N[(z * y), $MachinePrecision] + N[(-4.0 * i), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -5.8e+126], t$95$1, If[LessEqual[x, 2.85e+20], N[(N[(-27.0 * j), $MachinePrecision] * k + N[(-4.0 * N[(a * t), $MachinePrecision] + N[(c * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(18 \cdot t, z \cdot y, -4 \cdot i\right) \cdot x\\
\mathbf{if}\;x \leq -5.8 \cdot 10^{+126}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.85 \cdot 10^{+20}:\\
\;\;\;\;\mathsf{fma}\left(-27 \cdot j, k, \mathsf{fma}\left(-4, a \cdot t, c \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -5.79999999999999971e126 or 2.85e20 < x Initial program 72.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r*N/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6467.2
Applied rewrites67.2%
if -5.79999999999999971e126 < x < 2.85e20Initial program 92.5%
Taylor expanded in y around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6483.4
Applied rewrites83.4%
Taylor expanded in x around 0
associate--l+N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate--r+N/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6483.6
Applied rewrites83.6%
Taylor expanded in x around 0
associate--r+N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6474.6
Applied rewrites74.6%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* -4.0 (* a t))))
(if (<= t -1e-67)
t_1
(if (<= t -2.6e-177)
(* c b)
(if (<= t -6e-267)
(* (* -4.0 i) x)
(if (<= t 7.5e+119) (* (* -27.0 k) j) t_1))))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = -4.0 * (a * t);
double tmp;
if (t <= -1e-67) {
tmp = t_1;
} else if (t <= -2.6e-177) {
tmp = c * b;
} else if (t <= -6e-267) {
tmp = (-4.0 * i) * x;
} else if (t <= 7.5e+119) {
tmp = (-27.0 * k) * j;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
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, k)
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), intent (in) :: k
real(8) :: t_1
real(8) :: tmp
t_1 = (-4.0d0) * (a * t)
if (t <= (-1d-67)) then
tmp = t_1
else if (t <= (-2.6d-177)) then
tmp = c * b
else if (t <= (-6d-267)) then
tmp = ((-4.0d0) * i) * x
else if (t <= 7.5d+119) then
tmp = ((-27.0d0) * k) * j
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = -4.0 * (a * t);
double tmp;
if (t <= -1e-67) {
tmp = t_1;
} else if (t <= -2.6e-177) {
tmp = c * b;
} else if (t <= -6e-267) {
tmp = (-4.0 * i) * x;
} else if (t <= 7.5e+119) {
tmp = (-27.0 * k) * j;
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t, a, b, c, i, j, k] = sort([x, y, z, t, a, b, c, i, j, k]) def code(x, y, z, t, a, b, c, i, j, k): t_1 = -4.0 * (a * t) tmp = 0 if t <= -1e-67: tmp = t_1 elif t <= -2.6e-177: tmp = c * b elif t <= -6e-267: tmp = (-4.0 * i) * x elif t <= 7.5e+119: tmp = (-27.0 * k) * j else: tmp = t_1 return tmp
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(-4.0 * Float64(a * t)) tmp = 0.0 if (t <= -1e-67) tmp = t_1; elseif (t <= -2.6e-177) tmp = Float64(c * b); elseif (t <= -6e-267) tmp = Float64(Float64(-4.0 * i) * x); elseif (t <= 7.5e+119) tmp = Float64(Float64(-27.0 * k) * j); else tmp = t_1; end return tmp end
x, y, z, t, a, b, c, i, j, k = num2cell(sort([x, y, z, t, a, b, c, i, j, k])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k)
t_1 = -4.0 * (a * t);
tmp = 0.0;
if (t <= -1e-67)
tmp = t_1;
elseif (t <= -2.6e-177)
tmp = c * b;
elseif (t <= -6e-267)
tmp = (-4.0 * i) * x;
elseif (t <= 7.5e+119)
tmp = (-27.0 * k) * j;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(-4.0 * N[(a * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1e-67], t$95$1, If[LessEqual[t, -2.6e-177], N[(c * b), $MachinePrecision], If[LessEqual[t, -6e-267], N[(N[(-4.0 * i), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 7.5e+119], N[(N[(-27.0 * k), $MachinePrecision] * j), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
\begin{array}{l}
t_1 := -4 \cdot \left(a \cdot t\right)\\
\mathbf{if}\;t \leq -1 \cdot 10^{-67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -2.6 \cdot 10^{-177}:\\
\;\;\;\;c \cdot b\\
\mathbf{elif}\;t \leq -6 \cdot 10^{-267}:\\
\;\;\;\;\left(-4 \cdot i\right) \cdot x\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{+119}:\\
\;\;\;\;\left(-27 \cdot k\right) \cdot j\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.99999999999999943e-68 or 7.500000000000001e119 < t Initial program 84.4%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6435.0
Applied rewrites35.0%
if -9.99999999999999943e-68 < t < -2.6000000000000001e-177Initial program 86.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6428.9
Applied rewrites28.9%
if -2.6000000000000001e-177 < t < -5.9999999999999999e-267Initial program 86.3%
Taylor expanded in i around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f6429.4
Applied rewrites29.4%
if -5.9999999999999999e-267 < t < 7.500000000000001e119Initial program 85.8%
Taylor expanded in j around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6429.7
Applied rewrites29.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6429.7
Applied rewrites29.7%
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i j k) :precision binary64 (* c b))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k);
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
return c * b;
}
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function.
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, k)
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), intent (in) :: k
code = c * b
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i && i < j && j < k;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
return c * b;
}
[x, y, z, t, a, b, c, i, j, k] = sort([x, y, z, t, a, b, c, i, j, k]) def code(x, y, z, t, a, b, c, i, j, k): return c * b
x, y, z, t, a, b, c, i, j, k = sort([x, y, z, t, a, b, c, i, j, k]) function code(x, y, z, t, a, b, c, i, j, k) return Float64(c * b) end
x, y, z, t, a, b, c, i, j, k = num2cell(sort([x, y, z, t, a, b, c, i, j, k])){:}
function tmp = code(x, y, z, t, a, b, c, i, j, k)
tmp = c * b;
end
NOTE: x, y, z, t, a, b, c, i, j, and k should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := N[(c * b), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b, c, i, j, k] = \mathsf{sort}([x, y, z, t, a, b, c, i, j, k])\\
\\
c \cdot b
\end{array}
Initial program 85.2%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6423.8
Applied rewrites23.8%
(FPCore (x y z t a b c i j k)
:precision binary64
(let* ((t_1 (* (+ (* a t) (* i x)) 4.0))
(t_2
(-
(- (* (* 18.0 t) (* (* x y) z)) t_1)
(- (* (* k j) 27.0) (* c b)))))
(if (< t -1.6210815397541398e-69)
t_2
(if (< t 165.68027943805222)
(+ (- (* (* 18.0 y) (* x (* z t))) t_1) (- (* c b) (* 27.0 (* k j))))
t_2))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double t_1 = ((a * t) + (i * x)) * 4.0;
double t_2 = (((18.0 * t) * ((x * y) * z)) - t_1) - (((k * j) * 27.0) - (c * b));
double tmp;
if (t < -1.6210815397541398e-69) {
tmp = t_2;
} else if (t < 165.68027943805222) {
tmp = (((18.0 * y) * (x * (z * t))) - t_1) + ((c * b) - (27.0 * (k * j)));
} 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, k)
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), intent (in) :: k
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ((a * t) + (i * x)) * 4.0d0
t_2 = (((18.0d0 * t) * ((x * y) * z)) - t_1) - (((k * j) * 27.0d0) - (c * b))
if (t < (-1.6210815397541398d-69)) then
tmp = t_2
else if (t < 165.68027943805222d0) then
tmp = (((18.0d0 * y) * (x * (z * t))) - t_1) + ((c * b) - (27.0d0 * (k * j)))
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 k) {
double t_1 = ((a * t) + (i * x)) * 4.0;
double t_2 = (((18.0 * t) * ((x * y) * z)) - t_1) - (((k * j) * 27.0) - (c * b));
double tmp;
if (t < -1.6210815397541398e-69) {
tmp = t_2;
} else if (t < 165.68027943805222) {
tmp = (((18.0 * y) * (x * (z * t))) - t_1) + ((c * b) - (27.0 * (k * j)));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j, k): t_1 = ((a * t) + (i * x)) * 4.0 t_2 = (((18.0 * t) * ((x * y) * z)) - t_1) - (((k * j) * 27.0) - (c * b)) tmp = 0 if t < -1.6210815397541398e-69: tmp = t_2 elif t < 165.68027943805222: tmp = (((18.0 * y) * (x * (z * t))) - t_1) + ((c * b) - (27.0 * (k * j))) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i, j, k) t_1 = Float64(Float64(Float64(a * t) + Float64(i * x)) * 4.0) t_2 = Float64(Float64(Float64(Float64(18.0 * t) * Float64(Float64(x * y) * z)) - t_1) - Float64(Float64(Float64(k * j) * 27.0) - Float64(c * b))) tmp = 0.0 if (t < -1.6210815397541398e-69) tmp = t_2; elseif (t < 165.68027943805222) tmp = Float64(Float64(Float64(Float64(18.0 * y) * Float64(x * Float64(z * t))) - t_1) + Float64(Float64(c * b) - Float64(27.0 * Float64(k * j)))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i, j, k) t_1 = ((a * t) + (i * x)) * 4.0; t_2 = (((18.0 * t) * ((x * y) * z)) - t_1) - (((k * j) * 27.0) - (c * b)); tmp = 0.0; if (t < -1.6210815397541398e-69) tmp = t_2; elseif (t < 165.68027943805222) tmp = (((18.0 * y) * (x * (z * t))) - t_1) + ((c * b) - (27.0 * (k * j))); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_, k_] := Block[{t$95$1 = N[(N[(N[(a * t), $MachinePrecision] + N[(i * x), $MachinePrecision]), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(18.0 * t), $MachinePrecision] * N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] - N[(N[(N[(k * j), $MachinePrecision] * 27.0), $MachinePrecision] - N[(c * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -1.6210815397541398e-69], t$95$2, If[Less[t, 165.68027943805222], N[(N[(N[(N[(18.0 * y), $MachinePrecision] * N[(x * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] + N[(N[(c * b), $MachinePrecision] - N[(27.0 * N[(k * j), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot t + i \cdot x\right) \cdot 4\\
t_2 := \left(\left(18 \cdot t\right) \cdot \left(\left(x \cdot y\right) \cdot z\right) - t\_1\right) - \left(\left(k \cdot j\right) \cdot 27 - c \cdot b\right)\\
\mathbf{if}\;t < -1.6210815397541398 \cdot 10^{-69}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t < 165.68027943805222:\\
\;\;\;\;\left(\left(18 \cdot y\right) \cdot \left(x \cdot \left(z \cdot t\right)\right) - t\_1\right) + \left(c \cdot b - 27 \cdot \left(k \cdot j\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2025095
(FPCore (x y z t a b c i j k)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, E"
:precision binary64
:alt
(! :herbie-platform default (if (< t -8105407698770699/5000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (- (* (* 18 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4)) (- (* (* k j) 27) (* c b))) (if (< t 8284013971902611/50000000000000) (+ (- (* (* 18 y) (* x (* z t))) (* (+ (* a t) (* i x)) 4)) (- (* c b) (* 27 (* k j)))) (- (- (* (* 18 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4)) (- (* (* k j) 27) (* c b))))))
(- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)))