
(FPCore (x y z t a b c) :precision binary64 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
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)
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
code = ((((x * 9.0d0) * y) - (((z * 4.0d0) * t) * a)) + b) / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
def code(x, y, z, t, a, b, c): return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\end{array}
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c) :precision binary64 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
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)
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
code = ((((x * 9.0d0) * y) - (((z * 4.0d0) * t) * a)) + b) / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
def code(x, y, z, t, a, b, c): return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\end{array}
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma (* y x) 9.0 b)) (t_2 (* (* x 9.0) y)))
(if (<= t_2 (- INFINITY))
(- (* (/ (/ (- (* -9.0 x) (/ b y)) c) z) y))
(if (<= t_2 2e-93)
(/ (fma (* a t) -4.0 (/ t_1 z)) c)
(if (<= t_2 5e+185)
(fma -4.0 (* a (/ t c)) (/ t_1 (* c z)))
(/
(- (* (fma (/ x z) -9.0 (- (/ (fma (* a t) -4.0 (/ b z)) y))) y))
c))))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma((y * x), 9.0, b);
double t_2 = (x * 9.0) * y;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = -(((((-9.0 * x) - (b / y)) / c) / z) * y);
} else if (t_2 <= 2e-93) {
tmp = fma((a * t), -4.0, (t_1 / z)) / c;
} else if (t_2 <= 5e+185) {
tmp = fma(-4.0, (a * (t / c)), (t_1 / (c * z)));
} else {
tmp = -(fma((x / z), -9.0, -(fma((a * t), -4.0, (b / z)) / y)) * y) / c;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = fma(Float64(y * x), 9.0, b) t_2 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(-Float64(Float64(Float64(Float64(Float64(-9.0 * x) - Float64(b / y)) / c) / z) * y)); elseif (t_2 <= 2e-93) tmp = Float64(fma(Float64(a * t), -4.0, Float64(t_1 / z)) / c); elseif (t_2 <= 5e+185) tmp = fma(-4.0, Float64(a * Float64(t / c)), Float64(t_1 / Float64(c * z))); else tmp = Float64(Float64(-Float64(fma(Float64(x / z), -9.0, Float64(-Float64(fma(Float64(a * t), -4.0, Float64(b / z)) / y))) * y)) / c); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], (-N[(N[(N[(N[(N[(-9.0 * x), $MachinePrecision] - N[(b / y), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision]), If[LessEqual[t$95$2, 2e-93], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[t$95$2, 5e+185], N[(-4.0 * N[(a * N[(t / c), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 / N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[(N[(N[(x / z), $MachinePrecision] * -9.0 + (-N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(b / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision])), $MachinePrecision] * y), $MachinePrecision]) / c), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y \cdot x, 9, b\right)\\
t_2 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;-\frac{\frac{-9 \cdot x - \frac{b}{y}}{c}}{z} \cdot y\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-93}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{t\_1}{z}\right)}{c}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+185}:\\
\;\;\;\;\mathsf{fma}\left(-4, a \cdot \frac{t}{c}, \frac{t\_1}{c \cdot z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\frac{x}{z}, -9, -\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{b}{z}\right)}{y}\right) \cdot y}{c}\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -inf.0Initial program 59.1%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites72.0%
Taylor expanded in z around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6489.5
Applied rewrites89.5%
Taylor expanded in c around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6489.7
Applied rewrites89.7%
if -inf.0 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.9999999999999998e-93Initial program 81.2%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.8%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6490.4
Applied rewrites90.4%
if 1.9999999999999998e-93 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 4.9999999999999999e185Initial program 83.8%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6488.3
Applied rewrites88.3%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6488.2
Applied rewrites88.2%
if 4.9999999999999999e185 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 73.1%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites71.7%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.8%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (- (* (/ (/ (- (* -9.0 x) (/ b y)) c) z) y)))
(t_2 (fma (* y x) 9.0 b))
(t_3 (* (* x 9.0) y)))
(if (<= t_3 (- INFINITY))
t_1
(if (<= t_3 2e-93)
(/ (fma (* a t) -4.0 (/ t_2 z)) c)
(if (<= t_3 1e+281) (fma -4.0 (* a (/ t c)) (/ t_2 (* c z))) t_1)))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -(((((-9.0 * x) - (b / y)) / c) / z) * y);
double t_2 = fma((y * x), 9.0, b);
double t_3 = (x * 9.0) * y;
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_3 <= 2e-93) {
tmp = fma((a * t), -4.0, (t_2 / z)) / c;
} else if (t_3 <= 1e+281) {
tmp = fma(-4.0, (a * (t / c)), (t_2 / (c * z)));
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(-Float64(Float64(Float64(Float64(Float64(-9.0 * x) - Float64(b / y)) / c) / z) * y)) t_2 = fma(Float64(y * x), 9.0, b) t_3 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_1; elseif (t_3 <= 2e-93) tmp = Float64(fma(Float64(a * t), -4.0, Float64(t_2 / z)) / c); elseif (t_3 <= 1e+281) tmp = fma(-4.0, Float64(a * Float64(t / c)), Float64(t_2 / Float64(c * z))); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = (-N[(N[(N[(N[(N[(-9.0 * x), $MachinePrecision] - N[(b / y), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision])}, Block[{t$95$2 = N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$1, If[LessEqual[t$95$3, 2e-93], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(t$95$2 / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[t$95$3, 1e+281], N[(-4.0 * N[(a * N[(t / c), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 / N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := -\frac{\frac{-9 \cdot x - \frac{b}{y}}{c}}{z} \cdot y\\
t_2 := \mathsf{fma}\left(y \cdot x, 9, b\right)\\
t_3 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-93}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{t\_2}{z}\right)}{c}\\
\mathbf{elif}\;t\_3 \leq 10^{+281}:\\
\;\;\;\;\mathsf{fma}\left(-4, a \cdot \frac{t}{c}, \frac{t\_2}{c \cdot z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -inf.0 or 1e281 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 63.6%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6487.2
Applied rewrites87.2%
Taylor expanded in c around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6488.1
Applied rewrites88.1%
if -inf.0 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.9999999999999998e-93Initial program 81.2%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.8%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6490.4
Applied rewrites90.4%
if 1.9999999999999998e-93 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1e281Initial program 83.5%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6488.0
Applied rewrites88.0%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.4
Applied rewrites87.4%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (- (* (/ (/ (- (* -9.0 x) (/ b y)) c) z) y)))
(t_2 (* (* x 9.0) y)))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 1e+281)
(/ (fma (* a t) -4.0 (/ (fma (* y x) 9.0 b) z)) c)
t_1))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -(((((-9.0 * x) - (b / y)) / c) / z) * y);
double t_2 = (x * 9.0) * y;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 1e+281) {
tmp = fma((a * t), -4.0, (fma((y * x), 9.0, b) / z)) / c;
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(-Float64(Float64(Float64(Float64(Float64(-9.0 * x) - Float64(b / y)) / c) / z) * y)) t_2 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 1e+281) tmp = Float64(fma(Float64(a * t), -4.0, Float64(fma(Float64(y * x), 9.0, b) / z)) / c); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = (-N[(N[(N[(N[(N[(-9.0 * x), $MachinePrecision] - N[(b / y), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision])}, Block[{t$95$2 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 1e+281], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := -\frac{\frac{-9 \cdot x - \frac{b}{y}}{c}}{z} \cdot y\\
t_2 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+281}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -inf.0 or 1e281 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 63.6%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6487.2
Applied rewrites87.2%
Taylor expanded in c around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6488.1
Applied rewrites88.1%
if -inf.0 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1e281Initial program 81.9%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites80.9%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6489.9
Applied rewrites89.9%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y))
(t_2 (- (* (/ (/ (- (* -9.0 x) (/ b y)) c) z) y))))
(if (<= t_1 -1e+112)
t_2
(if (<= t_1 -2e-72)
(/ (fma (* a t) -4.0 (* (/ (* x y) z) 9.0)) c)
(if (<= t_1 2e+111) (/ (fma (* a t) -4.0 (/ b z)) c) t_2)))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = -(((((-9.0 * x) - (b / y)) / c) / z) * y);
double tmp;
if (t_1 <= -1e+112) {
tmp = t_2;
} else if (t_1 <= -2e-72) {
tmp = fma((a * t), -4.0, (((x * y) / z) * 9.0)) / c;
} else if (t_1 <= 2e+111) {
tmp = fma((a * t), -4.0, (b / z)) / c;
} else {
tmp = t_2;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(-Float64(Float64(Float64(Float64(Float64(-9.0 * x) - Float64(b / y)) / c) / z) * y)) tmp = 0.0 if (t_1 <= -1e+112) tmp = t_2; elseif (t_1 <= -2e-72) tmp = Float64(fma(Float64(a * t), -4.0, Float64(Float64(Float64(x * y) / z) * 9.0)) / c); elseif (t_1 <= 2e+111) tmp = Float64(fma(Float64(a * t), -4.0, Float64(b / z)) / c); else tmp = t_2; end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = (-N[(N[(N[(N[(N[(-9.0 * x), $MachinePrecision] - N[(b / y), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision])}, If[LessEqual[t$95$1, -1e+112], t$95$2, If[LessEqual[t$95$1, -2e-72], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[t$95$1, 2e+111], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := -\frac{\frac{-9 \cdot x - \frac{b}{y}}{c}}{z} \cdot y\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+112}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-72}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{x \cdot y}{z} \cdot 9\right)}{c}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+111}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{b}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -9.9999999999999993e111 or 1.99999999999999991e111 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 73.7%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites73.4%
Taylor expanded in z around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6472.1
Applied rewrites72.1%
Taylor expanded in c around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6475.6
Applied rewrites75.6%
if -9.9999999999999993e111 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -1.9999999999999999e-72Initial program 83.2%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites81.1%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6490.3
Applied rewrites90.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.0
Applied rewrites68.0%
if -1.9999999999999999e-72 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.99999999999999991e111Initial program 81.9%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites82.2%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6491.1
Applied rewrites91.1%
Taylor expanded in x around 0
Applied rewrites81.9%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y))
(t_2 (/ (/ (fma (* x y) 9.0 b) c) z))
(t_3 (- (* (/ (* (/ x c) -9.0) z) y))))
(if (<= t_1 -5e+289)
t_3
(if (<= t_1 -5e+25)
t_2
(if (<= t_1 4e+25)
(/ (fma (* a t) -4.0 (/ b z)) c)
(if (<= t_1 2e+220) t_2 t_3))))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = (fma((x * y), 9.0, b) / c) / z;
double t_3 = -((((x / c) * -9.0) / z) * y);
double tmp;
if (t_1 <= -5e+289) {
tmp = t_3;
} else if (t_1 <= -5e+25) {
tmp = t_2;
} else if (t_1 <= 4e+25) {
tmp = fma((a * t), -4.0, (b / z)) / c;
} else if (t_1 <= 2e+220) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(Float64(fma(Float64(x * y), 9.0, b) / c) / z) t_3 = Float64(-Float64(Float64(Float64(Float64(x / c) * -9.0) / z) * y)) tmp = 0.0 if (t_1 <= -5e+289) tmp = t_3; elseif (t_1 <= -5e+25) tmp = t_2; elseif (t_1 <= 4e+25) tmp = Float64(fma(Float64(a * t), -4.0, Float64(b / z)) / c); elseif (t_1 <= 2e+220) tmp = t_2; else tmp = t_3; end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(x * y), $MachinePrecision] * 9.0 + b), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$3 = (-N[(N[(N[(N[(x / c), $MachinePrecision] * -9.0), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision])}, If[LessEqual[t$95$1, -5e+289], t$95$3, If[LessEqual[t$95$1, -5e+25], t$95$2, If[LessEqual[t$95$1, 4e+25], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[t$95$1, 2e+220], t$95$2, t$95$3]]]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := \frac{\frac{\mathsf{fma}\left(x \cdot y, 9, b\right)}{c}}{z}\\
t_3 := -\frac{\frac{x}{c} \cdot -9}{z} \cdot y\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+289}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{+25}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+25}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{b}{z}\right)}{c}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+220}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -5.00000000000000031e289 or 2e220 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 67.1%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites72.6%
Taylor expanded in z around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6484.1
Applied rewrites84.1%
Taylor expanded in x around inf
*-commutativeN/A
lift-/.f64N/A
lift-*.f6484.8
Applied rewrites84.8%
if -5.00000000000000031e289 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -5.00000000000000024e25 or 4.00000000000000036e25 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 2e220Initial program 82.5%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6487.4
Applied rewrites87.4%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6465.2
Applied rewrites65.2%
lift-/.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
*-commutativeN/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6468.1
Applied rewrites68.1%
if -5.00000000000000024e25 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 4.00000000000000036e25Initial program 81.7%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites82.0%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6491.4
Applied rewrites91.4%
Taylor expanded in x around 0
Applied rewrites83.2%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y))
(t_2 (- (* (/ (/ (- (* -9.0 x) (/ b y)) c) z) y))))
(if (<= t_1 -5e+25)
t_2
(if (<= t_1 2e+111) (/ (fma (* a t) -4.0 (/ b z)) c) t_2))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = -(((((-9.0 * x) - (b / y)) / c) / z) * y);
double tmp;
if (t_1 <= -5e+25) {
tmp = t_2;
} else if (t_1 <= 2e+111) {
tmp = fma((a * t), -4.0, (b / z)) / c;
} else {
tmp = t_2;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(-Float64(Float64(Float64(Float64(Float64(-9.0 * x) - Float64(b / y)) / c) / z) * y)) tmp = 0.0 if (t_1 <= -5e+25) tmp = t_2; elseif (t_1 <= 2e+111) tmp = Float64(fma(Float64(a * t), -4.0, Float64(b / z)) / c); else tmp = t_2; end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = (-N[(N[(N[(N[(N[(-9.0 * x), $MachinePrecision] - N[(b / y), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision])}, If[LessEqual[t$95$1, -5e+25], t$95$2, If[LessEqual[t$95$1, 2e+111], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(b / z), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := -\frac{\frac{-9 \cdot x - \frac{b}{y}}{c}}{z} \cdot y\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+25}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+111}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{b}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -5.00000000000000024e25 or 1.99999999999999991e111 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 75.3%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites73.7%
Taylor expanded in z around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6469.0
Applied rewrites69.0%
Taylor expanded in c around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6472.7
Applied rewrites72.7%
if -5.00000000000000024e25 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.99999999999999991e111Initial program 82.0%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites82.1%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6491.1
Applied rewrites91.1%
Taylor expanded in x around 0
Applied rewrites80.6%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* -4.0 (/ (* a t) c))))
(if (<= z -2.6e+207)
t_1
(if (<= z 2.7e+103) (/ (fma x (* 9.0 y) b) (* z c)) t_1))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * ((a * t) / c);
double tmp;
if (z <= -2.6e+207) {
tmp = t_1;
} else if (z <= 2.7e+103) {
tmp = fma(x, (9.0 * y), b) / (z * c);
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(-4.0 * Float64(Float64(a * t) / c)) tmp = 0.0 if (z <= -2.6e+207) tmp = t_1; elseif (z <= 2.7e+103) tmp = Float64(fma(x, Float64(9.0 * y), b) / Float64(z * c)); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.6e+207], t$95$1, If[LessEqual[z, 2.7e+103], N[(N[(x * N[(9.0 * y), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := -4 \cdot \frac{a \cdot t}{c}\\
\mathbf{if}\;z \leq -2.6 \cdot 10^{+207}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+103}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.5999999999999998e207 or 2.69999999999999993e103 < z Initial program 52.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6462.2
Applied rewrites62.2%
if -2.5999999999999998e207 < z < 2.69999999999999993e103Initial program 88.5%
Taylor expanded in b around inf
Applied rewrites39.7%
Taylor expanded in z around 0
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate--r-N/A
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6469.0
Applied rewrites69.0%
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6469.0
Applied rewrites69.0%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* -4.0 (/ (* a t) c))))
(if (<= z -2.6e+207)
t_1
(if (<= z 2.7e+103) (/ (fma (* y x) 9.0 b) (* z c)) t_1))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * ((a * t) / c);
double tmp;
if (z <= -2.6e+207) {
tmp = t_1;
} else if (z <= 2.7e+103) {
tmp = fma((y * x), 9.0, b) / (z * c);
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(-4.0 * Float64(Float64(a * t) / c)) tmp = 0.0 if (z <= -2.6e+207) tmp = t_1; elseif (z <= 2.7e+103) tmp = Float64(fma(Float64(y * x), 9.0, b) / Float64(z * c)); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.6e+207], t$95$1, If[LessEqual[z, 2.7e+103], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := -4 \cdot \frac{a \cdot t}{c}\\
\mathbf{if}\;z \leq -2.6 \cdot 10^{+207}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+103}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.5999999999999998e207 or 2.69999999999999993e103 < z Initial program 52.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6462.2
Applied rewrites62.2%
if -2.5999999999999998e207 < z < 2.69999999999999993e103Initial program 88.5%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (- (* (/ (* (/ x c) -9.0) z) y))))
(if (<= t_1 -1e-98)
t_2
(if (<= t_1 5e-230)
(/ (/ b z) c)
(if (<= t_1 2e+111) (* -4.0 (/ (* a t) c)) t_2)))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = -((((x / c) * -9.0) / z) * y);
double tmp;
if (t_1 <= -1e-98) {
tmp = t_2;
} else if (t_1 <= 5e-230) {
tmp = (b / z) / c;
} else if (t_1 <= 2e+111) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = t_2;
}
return tmp;
}
NOTE: x, y, z, t, a, b, and c 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)
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * 9.0d0) * y
t_2 = -((((x / c) * (-9.0d0)) / z) * y)
if (t_1 <= (-1d-98)) then
tmp = t_2
else if (t_1 <= 5d-230) then
tmp = (b / z) / c
else if (t_1 <= 2d+111) then
tmp = (-4.0d0) * ((a * t) / c)
else
tmp = t_2
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = -((((x / c) * -9.0) / z) * y);
double tmp;
if (t_1 <= -1e-98) {
tmp = t_2;
} else if (t_1 <= 5e-230) {
tmp = (b / z) / c;
} else if (t_1 <= 2e+111) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = t_2;
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): t_1 = (x * 9.0) * y t_2 = -((((x / c) * -9.0) / z) * y) tmp = 0 if t_1 <= -1e-98: tmp = t_2 elif t_1 <= 5e-230: tmp = (b / z) / c elif t_1 <= 2e+111: tmp = -4.0 * ((a * t) / c) else: tmp = t_2 return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(-Float64(Float64(Float64(Float64(x / c) * -9.0) / z) * y)) tmp = 0.0 if (t_1 <= -1e-98) tmp = t_2; elseif (t_1 <= 5e-230) tmp = Float64(Float64(b / z) / c); elseif (t_1 <= 2e+111) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); else tmp = t_2; end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (x * 9.0) * y;
t_2 = -((((x / c) * -9.0) / z) * y);
tmp = 0.0;
if (t_1 <= -1e-98)
tmp = t_2;
elseif (t_1 <= 5e-230)
tmp = (b / z) / c;
elseif (t_1 <= 2e+111)
tmp = -4.0 * ((a * t) / c);
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = (-N[(N[(N[(N[(x / c), $MachinePrecision] * -9.0), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision])}, If[LessEqual[t$95$1, -1e-98], t$95$2, If[LessEqual[t$95$1, 5e-230], N[(N[(b / z), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[t$95$1, 2e+111], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := -\frac{\frac{x}{c} \cdot -9}{z} \cdot y\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-98}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-230}:\\
\;\;\;\;\frac{\frac{b}{z}}{c}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+111}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -9.99999999999999939e-99 or 1.99999999999999991e111 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 76.4%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites73.4%
Taylor expanded in z around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6464.3
Applied rewrites64.3%
Taylor expanded in x around inf
*-commutativeN/A
lift-/.f64N/A
lift-*.f6457.5
Applied rewrites57.5%
if -9.99999999999999939e-99 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 5.00000000000000035e-230Initial program 81.1%
Taylor expanded in b around inf
Applied rewrites50.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites48.9%
if 5.00000000000000035e-230 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.99999999999999991e111Initial program 83.5%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6444.4
Applied rewrites44.4%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (- (* (* (/ x (* c z)) -9.0) y))))
(if (<= t_1 -1e+296)
t_2
(if (<= t_1 -1e-98)
(/ (* (/ (* y x) c) 9.0) z)
(if (<= t_1 5e-230)
(/ (/ b z) c)
(if (<= t_1 2e+111) (* -4.0 (/ (* a t) c)) t_2))))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = -(((x / (c * z)) * -9.0) * y);
double tmp;
if (t_1 <= -1e+296) {
tmp = t_2;
} else if (t_1 <= -1e-98) {
tmp = (((y * x) / c) * 9.0) / z;
} else if (t_1 <= 5e-230) {
tmp = (b / z) / c;
} else if (t_1 <= 2e+111) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = t_2;
}
return tmp;
}
NOTE: x, y, z, t, a, b, and c 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)
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * 9.0d0) * y
t_2 = -(((x / (c * z)) * (-9.0d0)) * y)
if (t_1 <= (-1d+296)) then
tmp = t_2
else if (t_1 <= (-1d-98)) then
tmp = (((y * x) / c) * 9.0d0) / z
else if (t_1 <= 5d-230) then
tmp = (b / z) / c
else if (t_1 <= 2d+111) then
tmp = (-4.0d0) * ((a * t) / c)
else
tmp = t_2
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = -(((x / (c * z)) * -9.0) * y);
double tmp;
if (t_1 <= -1e+296) {
tmp = t_2;
} else if (t_1 <= -1e-98) {
tmp = (((y * x) / c) * 9.0) / z;
} else if (t_1 <= 5e-230) {
tmp = (b / z) / c;
} else if (t_1 <= 2e+111) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = t_2;
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): t_1 = (x * 9.0) * y t_2 = -(((x / (c * z)) * -9.0) * y) tmp = 0 if t_1 <= -1e+296: tmp = t_2 elif t_1 <= -1e-98: tmp = (((y * x) / c) * 9.0) / z elif t_1 <= 5e-230: tmp = (b / z) / c elif t_1 <= 2e+111: tmp = -4.0 * ((a * t) / c) else: tmp = t_2 return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(-Float64(Float64(Float64(x / Float64(c * z)) * -9.0) * y)) tmp = 0.0 if (t_1 <= -1e+296) tmp = t_2; elseif (t_1 <= -1e-98) tmp = Float64(Float64(Float64(Float64(y * x) / c) * 9.0) / z); elseif (t_1 <= 5e-230) tmp = Float64(Float64(b / z) / c); elseif (t_1 <= 2e+111) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); else tmp = t_2; end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (x * 9.0) * y;
t_2 = -(((x / (c * z)) * -9.0) * y);
tmp = 0.0;
if (t_1 <= -1e+296)
tmp = t_2;
elseif (t_1 <= -1e-98)
tmp = (((y * x) / c) * 9.0) / z;
elseif (t_1 <= 5e-230)
tmp = (b / z) / c;
elseif (t_1 <= 2e+111)
tmp = -4.0 * ((a * t) / c);
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = (-N[(N[(N[(x / N[(c * z), $MachinePrecision]), $MachinePrecision] * -9.0), $MachinePrecision] * y), $MachinePrecision])}, If[LessEqual[t$95$1, -1e+296], t$95$2, If[LessEqual[t$95$1, -1e-98], N[(N[(N[(N[(y * x), $MachinePrecision] / c), $MachinePrecision] * 9.0), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, 5e-230], N[(N[(b / z), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[t$95$1, 2e+111], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := -\left(\frac{x}{c \cdot z} \cdot -9\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+296}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-98}:\\
\;\;\;\;\frac{\frac{y \cdot x}{c} \cdot 9}{z}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-230}:\\
\;\;\;\;\frac{\frac{b}{z}}{c}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+111}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -9.99999999999999981e295 or 1.99999999999999991e111 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 71.3%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites72.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6471.0
Applied rewrites71.0%
if -9.99999999999999981e295 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -9.99999999999999939e-99Initial program 81.2%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6487.9
Applied rewrites87.9%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6462.2
Applied rewrites62.2%
Taylor expanded in x around 0
lift-/.f6430.3
Applied rewrites30.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f6443.5
Applied rewrites43.5%
if -9.99999999999999939e-99 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 5.00000000000000035e-230Initial program 81.1%
Taylor expanded in b around inf
Applied rewrites50.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites48.9%
if 5.00000000000000035e-230 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.99999999999999991e111Initial program 83.5%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6444.4
Applied rewrites44.4%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)))
(if (<= t_1 -1e-98)
(/ (* (/ (* y x) c) 9.0) z)
(if (<= t_1 5e-230)
(/ (/ b z) c)
(if (<= t_1 2e+111)
(* -4.0 (/ (* a t) c))
(/ (* (/ (* y x) z) 9.0) c))))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double tmp;
if (t_1 <= -1e-98) {
tmp = (((y * x) / c) * 9.0) / z;
} else if (t_1 <= 5e-230) {
tmp = (b / z) / c;
} else if (t_1 <= 2e+111) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = (((y * x) / z) * 9.0) / c;
}
return tmp;
}
NOTE: x, y, z, t, a, b, and c 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)
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) :: t_1
real(8) :: tmp
t_1 = (x * 9.0d0) * y
if (t_1 <= (-1d-98)) then
tmp = (((y * x) / c) * 9.0d0) / z
else if (t_1 <= 5d-230) then
tmp = (b / z) / c
else if (t_1 <= 2d+111) then
tmp = (-4.0d0) * ((a * t) / c)
else
tmp = (((y * x) / z) * 9.0d0) / c
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double tmp;
if (t_1 <= -1e-98) {
tmp = (((y * x) / c) * 9.0) / z;
} else if (t_1 <= 5e-230) {
tmp = (b / z) / c;
} else if (t_1 <= 2e+111) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = (((y * x) / z) * 9.0) / c;
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): t_1 = (x * 9.0) * y tmp = 0 if t_1 <= -1e-98: tmp = (((y * x) / c) * 9.0) / z elif t_1 <= 5e-230: tmp = (b / z) / c elif t_1 <= 2e+111: tmp = -4.0 * ((a * t) / c) else: tmp = (((y * x) / z) * 9.0) / c return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_1 <= -1e-98) tmp = Float64(Float64(Float64(Float64(y * x) / c) * 9.0) / z); elseif (t_1 <= 5e-230) tmp = Float64(Float64(b / z) / c); elseif (t_1 <= 2e+111) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); else tmp = Float64(Float64(Float64(Float64(y * x) / z) * 9.0) / c); end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (x * 9.0) * y;
tmp = 0.0;
if (t_1 <= -1e-98)
tmp = (((y * x) / c) * 9.0) / z;
elseif (t_1 <= 5e-230)
tmp = (b / z) / c;
elseif (t_1 <= 2e+111)
tmp = -4.0 * ((a * t) / c);
else
tmp = (((y * x) / z) * 9.0) / c;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-98], N[(N[(N[(N[(y * x), $MachinePrecision] / c), $MachinePrecision] * 9.0), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, 5e-230], N[(N[(b / z), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[t$95$1, 2e+111], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] * 9.0), $MachinePrecision] / c), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-98}:\\
\;\;\;\;\frac{\frac{y \cdot x}{c} \cdot 9}{z}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-230}:\\
\;\;\;\;\frac{\frac{b}{z}}{c}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+111}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y \cdot x}{z} \cdot 9}{c}\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -9.99999999999999939e-99Initial program 77.0%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6481.5
Applied rewrites81.5%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6461.8
Applied rewrites61.8%
Taylor expanded in x around 0
lift-/.f6426.3
Applied rewrites26.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f6447.8
Applied rewrites47.8%
if -9.99999999999999939e-99 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 5.00000000000000035e-230Initial program 81.1%
Taylor expanded in b around inf
Applied rewrites50.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites48.9%
if 5.00000000000000035e-230 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.99999999999999991e111Initial program 83.5%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6444.4
Applied rewrites44.4%
if 1.99999999999999991e111 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 75.2%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f6462.4
Applied rewrites62.4%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)) (t_2 (/ (* (/ (* y x) c) 9.0) z)))
(if (<= t_1 -1e-98)
t_2
(if (<= t_1 5e-230)
(/ (/ b z) c)
(if (<= t_1 2e+111) (* -4.0 (/ (* a t) c)) t_2)))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = (((y * x) / c) * 9.0) / z;
double tmp;
if (t_1 <= -1e-98) {
tmp = t_2;
} else if (t_1 <= 5e-230) {
tmp = (b / z) / c;
} else if (t_1 <= 2e+111) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = t_2;
}
return tmp;
}
NOTE: x, y, z, t, a, b, and c 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)
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * 9.0d0) * y
t_2 = (((y * x) / c) * 9.0d0) / z
if (t_1 <= (-1d-98)) then
tmp = t_2
else if (t_1 <= 5d-230) then
tmp = (b / z) / c
else if (t_1 <= 2d+111) then
tmp = (-4.0d0) * ((a * t) / c)
else
tmp = t_2
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double t_2 = (((y * x) / c) * 9.0) / z;
double tmp;
if (t_1 <= -1e-98) {
tmp = t_2;
} else if (t_1 <= 5e-230) {
tmp = (b / z) / c;
} else if (t_1 <= 2e+111) {
tmp = -4.0 * ((a * t) / c);
} else {
tmp = t_2;
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): t_1 = (x * 9.0) * y t_2 = (((y * x) / c) * 9.0) / z tmp = 0 if t_1 <= -1e-98: tmp = t_2 elif t_1 <= 5e-230: tmp = (b / z) / c elif t_1 <= 2e+111: tmp = -4.0 * ((a * t) / c) else: tmp = t_2 return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) t_2 = Float64(Float64(Float64(Float64(y * x) / c) * 9.0) / z) tmp = 0.0 if (t_1 <= -1e-98) tmp = t_2; elseif (t_1 <= 5e-230) tmp = Float64(Float64(b / z) / c); elseif (t_1 <= 2e+111) tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); else tmp = t_2; end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (x * 9.0) * y;
t_2 = (((y * x) / c) * 9.0) / z;
tmp = 0.0;
if (t_1 <= -1e-98)
tmp = t_2;
elseif (t_1 <= 5e-230)
tmp = (b / z) / c;
elseif (t_1 <= 2e+111)
tmp = -4.0 * ((a * t) / c);
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(y * x), $MachinePrecision] / c), $MachinePrecision] * 9.0), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-98], t$95$2, If[LessEqual[t$95$1, 5e-230], N[(N[(b / z), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[t$95$1, 2e+111], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
t_2 := \frac{\frac{y \cdot x}{c} \cdot 9}{z}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-98}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-230}:\\
\;\;\;\;\frac{\frac{b}{z}}{c}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+111}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -9.99999999999999939e-99 or 1.99999999999999991e111 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 76.4%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6479.8
Applied rewrites79.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6463.4
Applied rewrites63.4%
Taylor expanded in x around 0
lift-/.f6423.4
Applied rewrites23.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f6454.1
Applied rewrites54.1%
if -9.99999999999999939e-99 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 5.00000000000000035e-230Initial program 81.1%
Taylor expanded in b around inf
Applied rewrites50.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites48.9%
if 5.00000000000000035e-230 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.99999999999999991e111Initial program 83.5%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6444.4
Applied rewrites44.4%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* -4.0 (/ (* a t) c))))
(if (<= z -2e-82)
t_1
(if (<= z -7e-233)
(/ (/ b c) z)
(if (<= z 2e+103) (/ (* (* y x) 9.0) (* z c)) t_1)))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * ((a * t) / c);
double tmp;
if (z <= -2e-82) {
tmp = t_1;
} else if (z <= -7e-233) {
tmp = (b / c) / z;
} else if (z <= 2e+103) {
tmp = ((y * x) * 9.0) / (z * c);
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, t, a, b, and c 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)
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) :: t_1
real(8) :: tmp
t_1 = (-4.0d0) * ((a * t) / c)
if (z <= (-2d-82)) then
tmp = t_1
else if (z <= (-7d-233)) then
tmp = (b / c) / z
else if (z <= 2d+103) then
tmp = ((y * x) * 9.0d0) / (z * c)
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * ((a * t) / c);
double tmp;
if (z <= -2e-82) {
tmp = t_1;
} else if (z <= -7e-233) {
tmp = (b / c) / z;
} else if (z <= 2e+103) {
tmp = ((y * x) * 9.0) / (z * c);
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): t_1 = -4.0 * ((a * t) / c) tmp = 0 if z <= -2e-82: tmp = t_1 elif z <= -7e-233: tmp = (b / c) / z elif z <= 2e+103: tmp = ((y * x) * 9.0) / (z * c) else: tmp = t_1 return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(-4.0 * Float64(Float64(a * t) / c)) tmp = 0.0 if (z <= -2e-82) tmp = t_1; elseif (z <= -7e-233) tmp = Float64(Float64(b / c) / z); elseif (z <= 2e+103) tmp = Float64(Float64(Float64(y * x) * 9.0) / Float64(z * c)); else tmp = t_1; end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = -4.0 * ((a * t) / c);
tmp = 0.0;
if (z <= -2e-82)
tmp = t_1;
elseif (z <= -7e-233)
tmp = (b / c) / z;
elseif (z <= 2e+103)
tmp = ((y * x) * 9.0) / (z * c);
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2e-82], t$95$1, If[LessEqual[z, -7e-233], N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 2e+103], N[(N[(N[(y * x), $MachinePrecision] * 9.0), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := -4 \cdot \frac{a \cdot t}{c}\\
\mathbf{if}\;z \leq -2 \cdot 10^{-82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -7 \cdot 10^{-233}:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+103}:\\
\;\;\;\;\frac{\left(y \cdot x\right) \cdot 9}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2e-82 or 2e103 < z Initial program 64.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6453.3
Applied rewrites53.3%
if -2e-82 < z < -6.99999999999999982e-233Initial program 96.6%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6486.0
Applied rewrites86.0%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6478.2
Applied rewrites78.2%
Taylor expanded in x around 0
lift-/.f6447.5
Applied rewrites47.5%
if -6.99999999999999982e-233 < z < 2e103Initial program 91.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6444.4
Applied rewrites44.4%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* -4.0 (/ (* a t) c)))) (if (<= z -2e-82) t_1 (if (<= z 5.2e+148) (/ (/ b c) z) t_1))))
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * ((a * t) / c);
double tmp;
if (z <= -2e-82) {
tmp = t_1;
} else if (z <= 5.2e+148) {
tmp = (b / c) / z;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, t, a, b, and c 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)
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) :: t_1
real(8) :: tmp
t_1 = (-4.0d0) * ((a * t) / c)
if (z <= (-2d-82)) then
tmp = t_1
else if (z <= 5.2d+148) then
tmp = (b / c) / z
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * ((a * t) / c);
double tmp;
if (z <= -2e-82) {
tmp = t_1;
} else if (z <= 5.2e+148) {
tmp = (b / c) / z;
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): t_1 = -4.0 * ((a * t) / c) tmp = 0 if z <= -2e-82: tmp = t_1 elif z <= 5.2e+148: tmp = (b / c) / z else: tmp = t_1 return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(-4.0 * Float64(Float64(a * t) / c)) tmp = 0.0 if (z <= -2e-82) tmp = t_1; elseif (z <= 5.2e+148) tmp = Float64(Float64(b / c) / z); else tmp = t_1; end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = -4.0 * ((a * t) / c);
tmp = 0.0;
if (z <= -2e-82)
tmp = t_1;
elseif (z <= 5.2e+148)
tmp = (b / c) / z;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2e-82], t$95$1, If[LessEqual[z, 5.2e+148], N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := -4 \cdot \frac{a \cdot t}{c}\\
\mathbf{if}\;z \leq -2 \cdot 10^{-82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+148}:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2e-82 or 5.2e148 < z Initial program 64.5%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6453.3
Applied rewrites53.3%
if -2e-82 < z < 5.2e148Initial program 91.3%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6485.7
Applied rewrites85.7%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6471.9
Applied rewrites71.9%
Taylor expanded in x around 0
lift-/.f6441.7
Applied rewrites41.7%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (if (<= z -1e-145) (/ b (* z c)) (/ (/ b c) z)))
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (z <= -1e-145) {
tmp = b / (z * c);
} else {
tmp = (b / c) / z;
}
return tmp;
}
NOTE: x, y, z, t, a, b, and c 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)
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) :: tmp
if (z <= (-1d-145)) then
tmp = b / (z * c)
else
tmp = (b / c) / z
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (z <= -1e-145) {
tmp = b / (z * c);
} else {
tmp = (b / c) / z;
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): tmp = 0 if z <= -1e-145: tmp = b / (z * c) else: tmp = (b / c) / z return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) tmp = 0.0 if (z <= -1e-145) tmp = Float64(b / Float64(z * c)); else tmp = Float64(Float64(b / c) / z); end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
tmp = 0.0;
if (z <= -1e-145)
tmp = b / (z * c);
else
tmp = (b / c) / z;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[z, -1e-145], N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision], N[(N[(b / c), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-145}:\\
\;\;\;\;\frac{b}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{b}{c}}{z}\\
\end{array}
\end{array}
if z < -9.99999999999999915e-146Initial program 73.9%
Taylor expanded in b around inf
Applied rewrites28.5%
if -9.99999999999999915e-146 < z Initial program 82.3%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6484.9
Applied rewrites84.9%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6463.4
Applied rewrites63.4%
Taylor expanded in x around 0
lift-/.f6437.0
Applied rewrites37.0%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (/ b (* z c)))
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
return b / (z * c);
}
NOTE: x, y, z, t, a, b, and c 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)
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
code = b / (z * c)
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return b / (z * c);
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): return b / (z * c)
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) return Float64(b / Float64(z * c)) end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp = code(x, y, z, t, a, b, c)
tmp = b / (z * c);
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\frac{b}{z \cdot c}
\end{array}
Initial program 79.3%
Taylor expanded in b around inf
Applied rewrites34.6%
herbie shell --seed 2025120
(FPCore (x y z t a b c)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, J"
:precision binary64
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))