
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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
code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\end{array}
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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
code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\end{array}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 1.3e-58) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b)) (- (+ x x) (fma (* t (* 9.0 y)) z (* (* -27.0 a) b)))))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 1.3e-58) {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
} else {
tmp = (x + x) - fma((t * (9.0 * y)), z, ((-27.0 * a) * b));
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 1.3e-58) tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(t * z)))) + Float64(Float64(a * 27.0) * b)); else tmp = Float64(Float64(x + x) - fma(Float64(t * Float64(9.0 * y)), z, Float64(Float64(-27.0 * a) * b))); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 1.3e-58], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(N[(x + x), $MachinePrecision] - N[(N[(t * N[(9.0 * y), $MachinePrecision]), $MachinePrecision] * z + N[(N[(-27.0 * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.3 \cdot 10^{-58}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(x + x\right) - \mathsf{fma}\left(t \cdot \left(9 \cdot y\right), z, \left(-27 \cdot a\right) \cdot b\right)\\
\end{array}
\end{array}
if z < 1.30000000000000003e-58Initial program 95.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6495.3
Applied rewrites95.3%
if 1.30000000000000003e-58 < z Initial program 95.5%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f64N/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval93.2
Applied rewrites93.2%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= (- (* x 2.0) (* (* (* y 9.0) z) t)) 1e+292) (fma (* b 27.0) a (fma (* -9.0 t) (* y z) (+ x x))) (- (+ x x) (fma (* t (* 9.0 y)) z (* (* -27.0 a) b)))))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * 2.0) - (((y * 9.0) * z) * t)) <= 1e+292) {
tmp = fma((b * 27.0), a, fma((-9.0 * t), (y * z), (x + x)));
} else {
tmp = (x + x) - fma((t * (9.0 * y)), z, ((-27.0 * a) * b));
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) <= 1e+292) tmp = fma(Float64(b * 27.0), a, fma(Float64(-9.0 * t), Float64(y * z), Float64(x + x))); else tmp = Float64(Float64(x + x) - fma(Float64(t * Float64(9.0 * y)), z, Float64(Float64(-27.0 * a) * b))); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], 1e+292], N[(N[(b * 27.0), $MachinePrecision] * a + N[(N[(-9.0 * t), $MachinePrecision] * N[(y * z), $MachinePrecision] + N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + x), $MachinePrecision] - N[(N[(t * N[(9.0 * y), $MachinePrecision]), $MachinePrecision] * z + N[(N[(-27.0 * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t \leq 10^{+292}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot 27, a, \mathsf{fma}\left(-9 \cdot t, y \cdot z, x + x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + x\right) - \mathsf{fma}\left(t \cdot \left(9 \cdot y\right), z, \left(-27 \cdot a\right) \cdot b\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x #s(literal 2 binary64)) (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)) < 1e292Initial program 95.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
Applied rewrites96.3%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6496.3
Applied rewrites96.3%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
count-2-revN/A
lift-+.f64N/A
lower-fma.f64N/A
lower-*.f6496.2
Applied rewrites96.2%
if 1e292 < (-.f64 (*.f64 x #s(literal 2 binary64)) (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)) Initial program 95.5%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f64N/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval93.2
Applied rewrites93.2%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= (* (* y 9.0) z) 1e+81) (fma -9.0 (* t (* y z)) (fma 2.0 x (* 27.0 (* a b)))) (fma (* b 27.0) a (fma x 2.0 (* -9.0 (* (* z t) y))))))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((y * 9.0) * z) <= 1e+81) {
tmp = fma(-9.0, (t * (y * z)), fma(2.0, x, (27.0 * (a * b))));
} else {
tmp = fma((b * 27.0), a, fma(x, 2.0, (-9.0 * ((z * t) * y))));
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(y * 9.0) * z) <= 1e+81) tmp = fma(-9.0, Float64(t * Float64(y * z)), fma(2.0, x, Float64(27.0 * Float64(a * b)))); else tmp = fma(Float64(b * 27.0), a, fma(x, 2.0, Float64(-9.0 * Float64(Float64(z * t) * y)))); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision], 1e+81], N[(-9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(2.0 * x + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * 27.0), $MachinePrecision] * a + N[(x * 2.0 + N[(-9.0 * N[(N[(z * t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(y \cdot 9\right) \cdot z \leq 10^{+81}:\\
\;\;\;\;\mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot 27, a, \mathsf{fma}\left(x, 2, -9 \cdot \left(\left(z \cdot t\right) \cdot y\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y #s(literal 9 binary64)) z) < 9.99999999999999921e80Initial program 95.5%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6495.7
Applied rewrites95.7%
if 9.99999999999999921e80 < (*.f64 (*.f64 y #s(literal 9 binary64)) z) Initial program 95.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
Applied rewrites96.3%
lift--.f64N/A
lift-+.f64N/A
count-2-revN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f6496.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.1
Applied rewrites96.1%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (fma (* b 27.0) a (fma -9.0 (* t (* y z)) (* 2.0 x))))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return fma((b * 27.0), a, fma(-9.0, (t * (y * z)), (2.0 * x)));
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return fma(Float64(b * 27.0), a, fma(-9.0, Float64(t * Float64(y * z)), Float64(2.0 * x))) end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(b * 27.0), $MachinePrecision] * a + N[(-9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\mathsf{fma}\left(b \cdot 27, a, \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 2 \cdot x\right)\right)
\end{array}
Initial program 95.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
Applied rewrites96.3%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6496.3
Applied rewrites96.3%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (fma (* b 27.0) a (fma (* -9.0 t) (* y z) (+ x x))))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return fma((b * 27.0), a, fma((-9.0 * t), (y * z), (x + x)));
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return fma(Float64(b * 27.0), a, fma(Float64(-9.0 * t), Float64(y * z), Float64(x + x))) end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(b * 27.0), $MachinePrecision] * a + N[(N[(-9.0 * t), $MachinePrecision] * N[(y * z), $MachinePrecision] + N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\mathsf{fma}\left(b \cdot 27, a, \mathsf{fma}\left(-9 \cdot t, y \cdot z, x + x\right)\right)
\end{array}
Initial program 95.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
Applied rewrites96.3%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6496.3
Applied rewrites96.3%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
count-2-revN/A
lift-+.f64N/A
lower-fma.f64N/A
lower-*.f6496.2
Applied rewrites96.2%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* (* y 9.0) z) t)))
(if (<= t_1 -2e+92)
(fma (* b 27.0) a (* -9.0 (* t (* y z))))
(if (<= t_1 2e+47)
(fma (* 27.0 b) a (+ x x))
(+ (* (* -9.0 t) (* y z)) (* (* a 27.0) b))))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((y * 9.0) * z) * t;
double tmp;
if (t_1 <= -2e+92) {
tmp = fma((b * 27.0), a, (-9.0 * (t * (y * z))));
} else if (t_1 <= 2e+47) {
tmp = fma((27.0 * b), a, (x + x));
} else {
tmp = ((-9.0 * t) * (y * z)) + ((a * 27.0) * b);
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(y * 9.0) * z) * t) tmp = 0.0 if (t_1 <= -2e+92) tmp = fma(Float64(b * 27.0), a, Float64(-9.0 * Float64(t * Float64(y * z)))); elseif (t_1 <= 2e+47) tmp = fma(Float64(27.0 * b), a, Float64(x + x)); else tmp = Float64(Float64(Float64(-9.0 * t) * Float64(y * z)) + Float64(Float64(a * 27.0) * b)); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+92], N[(N[(b * 27.0), $MachinePrecision] * a + N[(-9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+47], N[(N[(27.0 * b), $MachinePrecision] * a + N[(x + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-9.0 * t), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+92}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot 27, a, -9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot b, a, x + x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-9 \cdot t\right) \cdot \left(y \cdot z\right) + \left(a \cdot 27\right) \cdot b\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -2.0000000000000001e92Initial program 95.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
Applied rewrites96.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6467.8
Applied rewrites67.8%
if -2.0000000000000001e92 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 2.0000000000000001e47Initial program 95.5%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.5
Applied rewrites64.5%
lift-fma.f64N/A
count-2-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6464.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6464.4
Applied rewrites64.4%
if 2.0000000000000001e47 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 95.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6467.1
Applied rewrites67.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6466.9
Applied rewrites66.9%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* -9.0 (* t (* y z)))) (t_2 (* (* (* y 9.0) z) t)))
(if (<= t_2 -2e+92)
(fma (* b 27.0) a t_1)
(if (<= t_2 2e+47) (fma (* 27.0 b) a (+ x x)) (+ t_1 (* (* a 27.0) b))))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -9.0 * (t * (y * z));
double t_2 = ((y * 9.0) * z) * t;
double tmp;
if (t_2 <= -2e+92) {
tmp = fma((b * 27.0), a, t_1);
} else if (t_2 <= 2e+47) {
tmp = fma((27.0 * b), a, (x + x));
} else {
tmp = t_1 + ((a * 27.0) * b);
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(-9.0 * Float64(t * Float64(y * z))) t_2 = Float64(Float64(Float64(y * 9.0) * z) * t) tmp = 0.0 if (t_2 <= -2e+92) tmp = fma(Float64(b * 27.0), a, t_1); elseif (t_2 <= 2e+47) tmp = fma(Float64(27.0 * b), a, Float64(x + x)); else tmp = Float64(t_1 + Float64(Float64(a * 27.0) * b)); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(-9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+92], N[(N[(b * 27.0), $MachinePrecision] * a + t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 2e+47], N[(N[(27.0 * b), $MachinePrecision] * a + N[(x + x), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := -9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
t_2 := \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+92}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot 27, a, t\_1\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot b, a, x + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(a \cdot 27\right) \cdot b\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -2.0000000000000001e92Initial program 95.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
Applied rewrites96.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6467.8
Applied rewrites67.8%
if -2.0000000000000001e92 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 2.0000000000000001e47Initial program 95.5%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.5
Applied rewrites64.5%
lift-fma.f64N/A
count-2-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6464.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6464.4
Applied rewrites64.4%
if 2.0000000000000001e47 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 95.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6467.1
Applied rewrites67.1%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (* b 27.0) a (* -9.0 (* t (* y z)))))
(t_2 (* (* (* y 9.0) z) t)))
(if (<= t_2 -2e+92)
t_1
(if (<= t_2 2e+47) (fma (* 27.0 b) a (+ x x)) t_1))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((b * 27.0), a, (-9.0 * (t * (y * z))));
double t_2 = ((y * 9.0) * z) * t;
double tmp;
if (t_2 <= -2e+92) {
tmp = t_1;
} else if (t_2 <= 2e+47) {
tmp = fma((27.0 * b), a, (x + x));
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = fma(Float64(b * 27.0), a, Float64(-9.0 * Float64(t * Float64(y * z)))) t_2 = Float64(Float64(Float64(y * 9.0) * z) * t) tmp = 0.0 if (t_2 <= -2e+92) tmp = t_1; elseif (t_2 <= 2e+47) tmp = fma(Float64(27.0 * b), a, Float64(x + x)); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b * 27.0), $MachinePrecision] * a + N[(-9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+92], t$95$1, If[LessEqual[t$95$2, 2e+47], N[(N[(27.0 * b), $MachinePrecision] * a + N[(x + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b \cdot 27, a, -9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\right)\\
t_2 := \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+92}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot b, a, x + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -2.0000000000000001e92 or 2.0000000000000001e47 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 95.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.3
Applied rewrites96.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6467.8
Applied rewrites67.8%
if -2.0000000000000001e92 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 2.0000000000000001e47Initial program 95.5%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.5
Applied rewrites64.5%
lift-fma.f64N/A
count-2-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6464.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6464.4
Applied rewrites64.4%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (* 27.0 b) a (* (* y (* t z)) -9.0)))
(t_2 (* (* (* y 9.0) z) t)))
(if (<= t_2 -2e+92)
t_1
(if (<= t_2 2e+166) (fma (* 27.0 b) a (+ x x)) t_1))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((27.0 * b), a, ((y * (t * z)) * -9.0));
double t_2 = ((y * 9.0) * z) * t;
double tmp;
if (t_2 <= -2e+92) {
tmp = t_1;
} else if (t_2 <= 2e+166) {
tmp = fma((27.0 * b), a, (x + x));
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = fma(Float64(27.0 * b), a, Float64(Float64(y * Float64(t * z)) * -9.0)) t_2 = Float64(Float64(Float64(y * 9.0) * z) * t) tmp = 0.0 if (t_2 <= -2e+92) tmp = t_1; elseif (t_2 <= 2e+166) tmp = fma(Float64(27.0 * b), a, Float64(x + x)); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(27.0 * b), $MachinePrecision] * a + N[(N[(y * N[(t * z), $MachinePrecision]), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+92], t$95$1, If[LessEqual[t$95$2, 2e+166], N[(N[(27.0 * b), $MachinePrecision] * a + N[(x + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(27 \cdot b, a, \left(y \cdot \left(t \cdot z\right)\right) \cdot -9\right)\\
t_2 := \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+92}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+166}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot b, a, x + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -2.0000000000000001e92 or 1.99999999999999988e166 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 95.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6467.1
Applied rewrites67.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6465.1
Applied rewrites65.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lower-fma.f6465.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.9
*-commutative65.9
count-2-rev65.9
*-commutative65.9
*-commutative65.9
*-commutative65.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.9
Applied rewrites65.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6467.8
Applied rewrites67.8%
if -2.0000000000000001e92 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.99999999999999988e166Initial program 95.5%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.5
Applied rewrites64.5%
lift-fma.f64N/A
count-2-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6464.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6464.4
Applied rewrites64.4%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (* 27.0 b) a (* (* y t) (* z -9.0))))
(t_2 (* (* (* y 9.0) z) t)))
(if (<= t_2 -1e+120)
t_1
(if (<= t_2 2e+166) (fma (* 27.0 b) a (+ x x)) t_1))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((27.0 * b), a, ((y * t) * (z * -9.0)));
double t_2 = ((y * 9.0) * z) * t;
double tmp;
if (t_2 <= -1e+120) {
tmp = t_1;
} else if (t_2 <= 2e+166) {
tmp = fma((27.0 * b), a, (x + x));
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = fma(Float64(27.0 * b), a, Float64(Float64(y * t) * Float64(z * -9.0))) t_2 = Float64(Float64(Float64(y * 9.0) * z) * t) tmp = 0.0 if (t_2 <= -1e+120) tmp = t_1; elseif (t_2 <= 2e+166) tmp = fma(Float64(27.0 * b), a, Float64(x + x)); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(27.0 * b), $MachinePrecision] * a + N[(N[(y * t), $MachinePrecision] * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+120], t$95$1, If[LessEqual[t$95$2, 2e+166], N[(N[(27.0 * b), $MachinePrecision] * a + N[(x + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(27 \cdot b, a, \left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right)\\
t_2 := \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+120}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+166}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot b, a, x + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -9.9999999999999998e119 or 1.99999999999999988e166 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) Initial program 95.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6467.1
Applied rewrites67.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6465.1
Applied rewrites65.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lower-fma.f6465.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.9
*-commutative65.9
count-2-rev65.9
*-commutative65.9
*-commutative65.9
*-commutative65.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.9
Applied rewrites65.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6465.9
Applied rewrites65.9%
if -9.9999999999999998e119 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 1.99999999999999988e166Initial program 95.5%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.5
Applied rewrites64.5%
lift-fma.f64N/A
count-2-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6464.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6464.4
Applied rewrites64.4%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (fma (* 27.0 b) a (+ x x)))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return fma((27.0 * b), a, (x + x));
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return fma(Float64(27.0 * b), a, Float64(x + x)) end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(27.0 * b), $MachinePrecision] * a + N[(x + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\mathsf{fma}\left(27 \cdot b, a, x + x\right)
\end{array}
Initial program 95.5%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.5
Applied rewrites64.5%
lift-fma.f64N/A
count-2-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6464.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6464.4
Applied rewrites64.4%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (+ (fma (* a 27.0) b x) x))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return fma((a * 27.0), b, x) + x;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(fma(Float64(a * 27.0), b, x) + x) end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(a * 27.0), $MachinePrecision] * b + x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\mathsf{fma}\left(a \cdot 27, b, x\right) + x
\end{array}
Initial program 95.5%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.5
Applied rewrites64.5%
lift-fma.f64N/A
count-2-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6464.5
Applied rewrites64.5%
lift-fma.f64N/A
lift-+.f64N/A
associate-+r+N/A
lower-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lower-fma.f6464.4
lift-*.f64N/A
*-commutativeN/A
lift-*.f6464.4
Applied rewrites64.4%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* a 27.0) b)))
(if (<= t_1 -500000000000.0)
(* (* 27.0 b) a)
(if (<= t_1 1e-27) (* b (* 2.0 (/ x b))) t_1))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * 27.0) * b;
double tmp;
if (t_1 <= -500000000000.0) {
tmp = (27.0 * b) * a;
} else if (t_1 <= 1e-27) {
tmp = b * (2.0 * (x / b));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b 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)
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) :: t_1
real(8) :: tmp
t_1 = (a * 27.0d0) * b
if (t_1 <= (-500000000000.0d0)) then
tmp = (27.0d0 * b) * a
else if (t_1 <= 1d-27) then
tmp = b * (2.0d0 * (x / b))
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * 27.0) * b;
double tmp;
if (t_1 <= -500000000000.0) {
tmp = (27.0 * b) * a;
} else if (t_1 <= 1e-27) {
tmp = b * (2.0 * (x / b));
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): t_1 = (a * 27.0) * b tmp = 0 if t_1 <= -500000000000.0: tmp = (27.0 * b) * a elif t_1 <= 1e-27: tmp = b * (2.0 * (x / b)) else: tmp = t_1 return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * 27.0) * b) tmp = 0.0 if (t_1 <= -500000000000.0) tmp = Float64(Float64(27.0 * b) * a); elseif (t_1 <= 1e-27) tmp = Float64(b * Float64(2.0 * Float64(x / b))); else tmp = t_1; end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = (a * 27.0) * b;
tmp = 0.0;
if (t_1 <= -500000000000.0)
tmp = (27.0 * b) * a;
elseif (t_1 <= 1e-27)
tmp = b * (2.0 * (x / b));
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[t$95$1, -500000000000.0], N[(N[(27.0 * b), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[t$95$1, 1e-27], N[(b * N[(2.0 * N[(x / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \left(a \cdot 27\right) \cdot b\\
\mathbf{if}\;t\_1 \leq -500000000000:\\
\;\;\;\;\left(27 \cdot b\right) \cdot a\\
\mathbf{elif}\;t\_1 \leq 10^{-27}:\\
\;\;\;\;b \cdot \left(2 \cdot \frac{x}{b}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 a #s(literal 27 binary64)) b) < -5e11Initial program 95.5%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.5
Applied rewrites64.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6435.9
Applied rewrites35.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6435.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6435.8
Applied rewrites35.8%
if -5e11 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) < 1e-27Initial program 95.5%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.5
Applied rewrites64.5%
Taylor expanded in b around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6457.2
Applied rewrites57.2%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f6423.4
Applied rewrites23.4%
if 1e-27 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) Initial program 95.5%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.5
Applied rewrites64.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6435.9
Applied rewrites35.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6435.8
Applied rewrites35.8%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (* (* 27.0 b) a))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return (27.0 * b) * a;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b 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)
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
code = (27.0d0 * b) * a
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return (27.0 * b) * a;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): return (27.0 * b) * a
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(Float64(27.0 * b) * a) end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = (27.0 * b) * a;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(27.0 * b), $MachinePrecision] * a), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\left(27 \cdot b\right) \cdot a
\end{array}
Initial program 95.5%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.5
Applied rewrites64.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6435.9
Applied rewrites35.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6435.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6435.8
Applied rewrites35.8%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (* 27.0 (* a b)))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return 27.0 * (a * b);
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b 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)
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
code = 27.0d0 * (a * b)
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return 27.0 * (a * b);
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): return 27.0 * (a * b)
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(27.0 * Float64(a * b)) end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = 27.0 * (a * b);
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
27 \cdot \left(a \cdot b\right)
\end{array}
Initial program 95.5%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6464.5
Applied rewrites64.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6435.9
Applied rewrites35.9%
herbie shell --seed 2025150
(FPCore (x y z t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, A"
:precision binary64
(+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))