
(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 20 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}
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (fma (* y x) 9.0 b)))
(*
c_s
(if (<= c_m 1.2e+96)
(/ (fma (* a t) -4.0 (/ t_1 z)) c_m)
(if (<= c_m 2e+222)
(*
(-
(fma (/ y (* c_m z)) 9.0 (/ b (* (* z x) c_m)))
(* (* a (/ t (* c_m x))) 4.0))
x)
(fma -4.0 (/ (* a t) c_m) (/ (/ t_1 c_m) z)))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = fma((y * x), 9.0, b);
double tmp;
if (c_m <= 1.2e+96) {
tmp = fma((a * t), -4.0, (t_1 / z)) / c_m;
} else if (c_m <= 2e+222) {
tmp = (fma((y / (c_m * z)), 9.0, (b / ((z * x) * c_m))) - ((a * (t / (c_m * x))) * 4.0)) * x;
} else {
tmp = fma(-4.0, ((a * t) / c_m), ((t_1 / c_m) / z));
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = fma(Float64(y * x), 9.0, b) tmp = 0.0 if (c_m <= 1.2e+96) tmp = Float64(fma(Float64(a * t), -4.0, Float64(t_1 / z)) / c_m); elseif (c_m <= 2e+222) tmp = Float64(Float64(fma(Float64(y / Float64(c_m * z)), 9.0, Float64(b / Float64(Float64(z * x) * c_m))) - Float64(Float64(a * Float64(t / Float64(c_m * x))) * 4.0)) * x); else tmp = fma(-4.0, Float64(Float64(a * t) / c_m), Float64(Float64(t_1 / c_m) / z)); end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision]}, N[(c$95$s * If[LessEqual[c$95$m, 1.2e+96], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], If[LessEqual[c$95$m, 2e+222], N[(N[(N[(N[(y / N[(c$95$m * z), $MachinePrecision]), $MachinePrecision] * 9.0 + N[(b / N[(N[(z * x), $MachinePrecision] * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(a * N[(t / N[(c$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c$95$m), $MachinePrecision] + N[(N[(t$95$1 / c$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y \cdot x, 9, b\right)\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;c\_m \leq 1.2 \cdot 10^{+96}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{t\_1}{z}\right)}{c\_m}\\
\mathbf{elif}\;c\_m \leq 2 \cdot 10^{+222}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{y}{c\_m \cdot z}, 9, \frac{b}{\left(z \cdot x\right) \cdot c\_m}\right) - \left(a \cdot \frac{t}{c\_m \cdot x}\right) \cdot 4\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{a \cdot t}{c\_m}, \frac{\frac{t\_1}{c\_m}}{z}\right)\\
\end{array}
\end{array}
\end{array}
if c < 1.19999999999999996e96Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
if 1.19999999999999996e96 < c < 2.0000000000000001e222Initial program 78.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites65.5%
if 2.0000000000000001e222 < c Initial program 78.9%
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.4
Applied rewrites84.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-/r*N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6483.4
Applied rewrites83.4%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(*
c_s
(if (<= z -7.5e+64)
(/ (fma (* a t) -4.0 (/ (fma (* y x) 9.0 b) z)) c_m)
(if (<= z 1.5e-55)
(/ (+ (fma (* 9.0 x) y (* -4.0 (* (* t z) a))) b) (* z c_m))
(/ (fma (* a t) -4.0 (/ (fma x (* y 9.0) b) z)) c_m)))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double tmp;
if (z <= -7.5e+64) {
tmp = fma((a * t), -4.0, (fma((y * x), 9.0, b) / z)) / c_m;
} else if (z <= 1.5e-55) {
tmp = (fma((9.0 * x), y, (-4.0 * ((t * z) * a))) + b) / (z * c_m);
} else {
tmp = fma((a * t), -4.0, (fma(x, (y * 9.0), b) / z)) / c_m;
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) tmp = 0.0 if (z <= -7.5e+64) tmp = Float64(fma(Float64(a * t), -4.0, Float64(fma(Float64(y * x), 9.0, b) / z)) / c_m); elseif (z <= 1.5e-55) tmp = Float64(Float64(fma(Float64(9.0 * x), y, Float64(-4.0 * Float64(Float64(t * z) * a))) + b) / Float64(z * c_m)); else tmp = Float64(fma(Float64(a * t), -4.0, Float64(fma(x, Float64(y * 9.0), b) / z)) / c_m); end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := N[(c$95$s * If[LessEqual[z, -7.5e+64], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], If[LessEqual[z, 1.5e-55], N[(N[(N[(N[(9.0 * x), $MachinePrecision] * y + N[(-4.0 * N[(N[(t * z), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(N[(x * N[(y * 9.0), $MachinePrecision] + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+64}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z}\right)}{c\_m}\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-55}:\\
\;\;\;\;\frac{\mathsf{fma}\left(9 \cdot x, y, -4 \cdot \left(\left(t \cdot z\right) \cdot a\right)\right) + b}{z \cdot c\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{\mathsf{fma}\left(x, y \cdot 9, b\right)}{z}\right)}{c\_m}\\
\end{array}
\end{array}
if z < -7.5000000000000005e64Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
if -7.5000000000000005e64 < z < 1.50000000000000008e-55Initial program 78.9%
Taylor expanded in x around 0
fp-cancel-sub-sign-invN/A
associate-*r*N/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6479.2
Applied rewrites79.2%
if 1.50000000000000008e-55 < z Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.9
Applied rewrites85.9%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (fma (* y x) 9.0 b)))
(*
c_s
(if (<= c_m 5e+92)
(/ (fma (* a t) -4.0 (/ t_1 z)) c_m)
(fma -4.0 (/ (* a t) c_m) (/ (/ t_1 c_m) z))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = fma((y * x), 9.0, b);
double tmp;
if (c_m <= 5e+92) {
tmp = fma((a * t), -4.0, (t_1 / z)) / c_m;
} else {
tmp = fma(-4.0, ((a * t) / c_m), ((t_1 / c_m) / z));
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = fma(Float64(y * x), 9.0, b) tmp = 0.0 if (c_m <= 5e+92) tmp = Float64(fma(Float64(a * t), -4.0, Float64(t_1 / z)) / c_m); else tmp = fma(-4.0, Float64(Float64(a * t) / c_m), Float64(Float64(t_1 / c_m) / z)); end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision]}, N[(c$95$s * If[LessEqual[c$95$m, 5e+92], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c$95$m), $MachinePrecision] + N[(N[(t$95$1 / c$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y \cdot x, 9, b\right)\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;c\_m \leq 5 \cdot 10^{+92}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{t\_1}{z}\right)}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{a \cdot t}{c\_m}, \frac{\frac{t\_1}{c\_m}}{z}\right)\\
\end{array}
\end{array}
\end{array}
if c < 5.00000000000000022e92Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
if 5.00000000000000022e92 < c Initial program 78.9%
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.4
Applied rewrites84.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-/r*N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6483.4
Applied rewrites83.4%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (- (* (/ y c_m) -9.0) (/ b (* c_m x)))) (t_2 (* (* x 9.0) y)))
(*
c_s
(if (<= t_2 -2e+219)
(- (* (/ t_1 z) x))
(if (<= t_2 1e+170)
(/ (fma (* a t) -4.0 (/ (fma (* y x) 9.0 b) z)) c_m)
(- (/ (* t_1 x) z)))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = ((y / c_m) * -9.0) - (b / (c_m * x));
double t_2 = (x * 9.0) * y;
double tmp;
if (t_2 <= -2e+219) {
tmp = -((t_1 / z) * x);
} else if (t_2 <= 1e+170) {
tmp = fma((a * t), -4.0, (fma((y * x), 9.0, b) / z)) / c_m;
} else {
tmp = -((t_1 * x) / z);
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(Float64(Float64(y / c_m) * -9.0) - Float64(b / Float64(c_m * x))) t_2 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_2 <= -2e+219) tmp = Float64(-Float64(Float64(t_1 / z) * x)); elseif (t_2 <= 1e+170) tmp = Float64(fma(Float64(a * t), -4.0, Float64(fma(Float64(y * x), 9.0, b) / z)) / c_m); else tmp = Float64(-Float64(Float64(t_1 * x) / z)); end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(N[(y / c$95$m), $MachinePrecision] * -9.0), $MachinePrecision] - N[(b / N[(c$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, N[(c$95$s * If[LessEqual[t$95$2, -2e+219], (-N[(N[(t$95$1 / z), $MachinePrecision] * x), $MachinePrecision]), If[LessEqual[t$95$2, 1e+170], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], (-N[(N[(t$95$1 * x), $MachinePrecision] / z), $MachinePrecision])]]), $MachinePrecision]]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \frac{y}{c\_m} \cdot -9 - \frac{b}{c\_m \cdot x}\\
t_2 := \left(x \cdot 9\right) \cdot y\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+219}:\\
\;\;\;\;-\frac{t\_1}{z} \cdot x\\
\mathbf{elif}\;t\_2 \leq 10^{+170}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z}\right)}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;-\frac{t\_1 \cdot x}{z}\\
\end{array}
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -1.99999999999999993e219Initial program 78.9%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.8%
Taylor expanded in z around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6454.9
Applied rewrites54.9%
if -1.99999999999999993e219 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.00000000000000003e170Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
if 1.00000000000000003e170 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 78.9%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6455.9
Applied rewrites55.9%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (- (* (/ y c_m) -9.0) (/ b (* c_m x)))) (t_2 (* (* x 9.0) y)))
(*
c_s
(if (<= t_2 -2e+219)
(- (* (/ t_1 z) x))
(if (<= t_2 1e+170)
(/ (fma (* a t) -4.0 (/ (fma x (* y 9.0) b) z)) c_m)
(- (/ (* t_1 x) z)))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = ((y / c_m) * -9.0) - (b / (c_m * x));
double t_2 = (x * 9.0) * y;
double tmp;
if (t_2 <= -2e+219) {
tmp = -((t_1 / z) * x);
} else if (t_2 <= 1e+170) {
tmp = fma((a * t), -4.0, (fma(x, (y * 9.0), b) / z)) / c_m;
} else {
tmp = -((t_1 * x) / z);
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(Float64(Float64(y / c_m) * -9.0) - Float64(b / Float64(c_m * x))) t_2 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_2 <= -2e+219) tmp = Float64(-Float64(Float64(t_1 / z) * x)); elseif (t_2 <= 1e+170) tmp = Float64(fma(Float64(a * t), -4.0, Float64(fma(x, Float64(y * 9.0), b) / z)) / c_m); else tmp = Float64(-Float64(Float64(t_1 * x) / z)); end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(N[(y / c$95$m), $MachinePrecision] * -9.0), $MachinePrecision] - N[(b / N[(c$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, N[(c$95$s * If[LessEqual[t$95$2, -2e+219], (-N[(N[(t$95$1 / z), $MachinePrecision] * x), $MachinePrecision]), If[LessEqual[t$95$2, 1e+170], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(N[(x * N[(y * 9.0), $MachinePrecision] + b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], (-N[(N[(t$95$1 * x), $MachinePrecision] / z), $MachinePrecision])]]), $MachinePrecision]]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \frac{y}{c\_m} \cdot -9 - \frac{b}{c\_m \cdot x}\\
t_2 := \left(x \cdot 9\right) \cdot y\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+219}:\\
\;\;\;\;-\frac{t\_1}{z} \cdot x\\
\mathbf{elif}\;t\_2 \leq 10^{+170}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{\mathsf{fma}\left(x, y \cdot 9, b\right)}{z}\right)}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;-\frac{t\_1 \cdot x}{z}\\
\end{array}
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -1.99999999999999993e219Initial program 78.9%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.8%
Taylor expanded in z around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6454.9
Applied rewrites54.9%
if -1.99999999999999993e219 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.00000000000000003e170Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.9
Applied rewrites85.9%
if 1.00000000000000003e170 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 78.9%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6455.9
Applied rewrites55.9%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (fma (* y x) 9.0 b)))
(*
c_s
(if (<= c_m 7.1e+117)
(/ (fma (* a t) -4.0 (/ t_1 z)) c_m)
(fma -4.0 (* a (/ t c_m)) (/ t_1 (* c_m z)))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = fma((y * x), 9.0, b);
double tmp;
if (c_m <= 7.1e+117) {
tmp = fma((a * t), -4.0, (t_1 / z)) / c_m;
} else {
tmp = fma(-4.0, (a * (t / c_m)), (t_1 / (c_m * z)));
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = fma(Float64(y * x), 9.0, b) tmp = 0.0 if (c_m <= 7.1e+117) tmp = Float64(fma(Float64(a * t), -4.0, Float64(t_1 / z)) / c_m); else tmp = fma(-4.0, Float64(a * Float64(t / c_m)), Float64(t_1 / Float64(c_m * z))); end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision]}, N[(c$95$s * If[LessEqual[c$95$m, 7.1e+117], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], N[(-4.0 * N[(a * N[(t / c$95$m), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 / N[(c$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y \cdot x, 9, b\right)\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;c\_m \leq 7.1 \cdot 10^{+117}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{t\_1}{z}\right)}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4, a \cdot \frac{t}{c\_m}, \frac{t\_1}{c\_m \cdot z}\right)\\
\end{array}
\end{array}
\end{array}
if c < 7.09999999999999995e117Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
if 7.09999999999999995e117 < c Initial program 78.9%
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.4
Applied rewrites84.4%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6483.9
Applied rewrites83.9%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (- (* (/ y c_m) -9.0) (/ b (* c_m x)))) (t_2 (* (* x 9.0) y)))
(*
c_s
(if (<= t_2 -2e+84)
(- (* (/ t_1 z) x))
(if (<= t_2 -2e-93)
(/ (fma (* a t) -4.0 (/ (* (* y 9.0) x) z)) c_m)
(if (<= t_2 100000.0)
(/ (fma (* a t) -4.0 (/ b z)) c_m)
(if (<= t_2 1e+170)
(/ (fma (* a t) -4.0 (/ (* (* y x) 9.0) z)) c_m)
(- (/ (* t_1 x) z)))))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = ((y / c_m) * -9.0) - (b / (c_m * x));
double t_2 = (x * 9.0) * y;
double tmp;
if (t_2 <= -2e+84) {
tmp = -((t_1 / z) * x);
} else if (t_2 <= -2e-93) {
tmp = fma((a * t), -4.0, (((y * 9.0) * x) / z)) / c_m;
} else if (t_2 <= 100000.0) {
tmp = fma((a * t), -4.0, (b / z)) / c_m;
} else if (t_2 <= 1e+170) {
tmp = fma((a * t), -4.0, (((y * x) * 9.0) / z)) / c_m;
} else {
tmp = -((t_1 * x) / z);
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(Float64(Float64(y / c_m) * -9.0) - Float64(b / Float64(c_m * x))) t_2 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_2 <= -2e+84) tmp = Float64(-Float64(Float64(t_1 / z) * x)); elseif (t_2 <= -2e-93) tmp = Float64(fma(Float64(a * t), -4.0, Float64(Float64(Float64(y * 9.0) * x) / z)) / c_m); elseif (t_2 <= 100000.0) tmp = Float64(fma(Float64(a * t), -4.0, Float64(b / z)) / c_m); elseif (t_2 <= 1e+170) tmp = Float64(fma(Float64(a * t), -4.0, Float64(Float64(Float64(y * x) * 9.0) / z)) / c_m); else tmp = Float64(-Float64(Float64(t_1 * x) / z)); end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(N[(y / c$95$m), $MachinePrecision] * -9.0), $MachinePrecision] - N[(b / N[(c$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, N[(c$95$s * If[LessEqual[t$95$2, -2e+84], (-N[(N[(t$95$1 / z), $MachinePrecision] * x), $MachinePrecision]), If[LessEqual[t$95$2, -2e-93], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(N[(N[(y * 9.0), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], If[LessEqual[t$95$2, 100000.0], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(b / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], If[LessEqual[t$95$2, 1e+170], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(N[(N[(y * x), $MachinePrecision] * 9.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], (-N[(N[(t$95$1 * x), $MachinePrecision] / z), $MachinePrecision])]]]]), $MachinePrecision]]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \frac{y}{c\_m} \cdot -9 - \frac{b}{c\_m \cdot x}\\
t_2 := \left(x \cdot 9\right) \cdot y\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+84}:\\
\;\;\;\;-\frac{t\_1}{z} \cdot x\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-93}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{\left(y \cdot 9\right) \cdot x}{z}\right)}{c\_m}\\
\mathbf{elif}\;t\_2 \leq 100000:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{b}{z}\right)}{c\_m}\\
\mathbf{elif}\;t\_2 \leq 10^{+170}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{\left(y \cdot x\right) \cdot 9}{z}\right)}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;-\frac{t\_1 \cdot x}{z}\\
\end{array}
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.00000000000000012e84Initial program 78.9%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.8%
Taylor expanded in z around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6454.9
Applied rewrites54.9%
if -2.00000000000000012e84 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -1.9999999999999998e-93Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6463.7
Applied rewrites63.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6463.6
Applied rewrites63.6%
if -1.9999999999999998e-93 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1e5Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
Taylor expanded in x around 0
Applied rewrites63.3%
if 1e5 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.00000000000000003e170Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6463.7
Applied rewrites63.7%
if 1.00000000000000003e170 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 78.9%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6455.9
Applied rewrites55.9%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (- (/ (* (- (* (/ y c_m) -9.0) (/ b (* c_m x))) x) z)))
(t_2 (* (* x 9.0) y)))
(*
c_s
(if (<= t_2 -2e+84)
t_1
(if (<= t_2 -2e-93)
(/ (fma (* a t) -4.0 (/ (* (* y 9.0) x) z)) c_m)
(if (<= t_2 100000.0)
(/ (fma (* a t) -4.0 (/ b z)) c_m)
(if (<= t_2 1e+170)
(/ (fma (* a t) -4.0 (/ (* (* y x) 9.0) z)) c_m)
t_1)))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = -(((((y / c_m) * -9.0) - (b / (c_m * x))) * x) / z);
double t_2 = (x * 9.0) * y;
double tmp;
if (t_2 <= -2e+84) {
tmp = t_1;
} else if (t_2 <= -2e-93) {
tmp = fma((a * t), -4.0, (((y * 9.0) * x) / z)) / c_m;
} else if (t_2 <= 100000.0) {
tmp = fma((a * t), -4.0, (b / z)) / c_m;
} else if (t_2 <= 1e+170) {
tmp = fma((a * t), -4.0, (((y * x) * 9.0) / z)) / c_m;
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(-Float64(Float64(Float64(Float64(Float64(y / c_m) * -9.0) - Float64(b / Float64(c_m * x))) * x) / z)) t_2 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_2 <= -2e+84) tmp = t_1; elseif (t_2 <= -2e-93) tmp = Float64(fma(Float64(a * t), -4.0, Float64(Float64(Float64(y * 9.0) * x) / z)) / c_m); elseif (t_2 <= 100000.0) tmp = Float64(fma(Float64(a * t), -4.0, Float64(b / z)) / c_m); elseif (t_2 <= 1e+170) tmp = Float64(fma(Float64(a * t), -4.0, Float64(Float64(Float64(y * x) * 9.0) / z)) / c_m); else tmp = t_1; end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = (-N[(N[(N[(N[(N[(y / c$95$m), $MachinePrecision] * -9.0), $MachinePrecision] - N[(b / N[(c$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision])}, Block[{t$95$2 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, N[(c$95$s * If[LessEqual[t$95$2, -2e+84], t$95$1, If[LessEqual[t$95$2, -2e-93], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(N[(N[(y * 9.0), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], If[LessEqual[t$95$2, 100000.0], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(b / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], If[LessEqual[t$95$2, 1e+170], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(N[(N[(y * x), $MachinePrecision] * 9.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], t$95$1]]]]), $MachinePrecision]]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := -\frac{\left(\frac{y}{c\_m} \cdot -9 - \frac{b}{c\_m \cdot x}\right) \cdot x}{z}\\
t_2 := \left(x \cdot 9\right) \cdot y\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-93}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{\left(y \cdot 9\right) \cdot x}{z}\right)}{c\_m}\\
\mathbf{elif}\;t\_2 \leq 100000:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{b}{z}\right)}{c\_m}\\
\mathbf{elif}\;t\_2 \leq 10^{+170}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{\left(y \cdot x\right) \cdot 9}{z}\right)}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2.00000000000000012e84 or 1.00000000000000003e170 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 78.9%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6455.9
Applied rewrites55.9%
if -2.00000000000000012e84 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -1.9999999999999998e-93Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6463.7
Applied rewrites63.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6463.6
Applied rewrites63.6%
if -1.9999999999999998e-93 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1e5Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
Taylor expanded in x around 0
Applied rewrites63.3%
if 1e5 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.00000000000000003e170Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6463.7
Applied rewrites63.7%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(*
c_s
(if (<= z -5.3e-42)
(/ (fma (* a t) -4.0 (/ (* (* y x) 9.0) z)) c_m)
(if (<= z 3e-32)
(/ (fma (* y x) 9.0 b) (* z c_m))
(/ (fma (* a t) -4.0 (/ b z)) c_m)))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double tmp;
if (z <= -5.3e-42) {
tmp = fma((a * t), -4.0, (((y * x) * 9.0) / z)) / c_m;
} else if (z <= 3e-32) {
tmp = fma((y * x), 9.0, b) / (z * c_m);
} else {
tmp = fma((a * t), -4.0, (b / z)) / c_m;
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) tmp = 0.0 if (z <= -5.3e-42) tmp = Float64(fma(Float64(a * t), -4.0, Float64(Float64(Float64(y * x) * 9.0) / z)) / c_m); elseif (z <= 3e-32) tmp = Float64(fma(Float64(y * x), 9.0, b) / Float64(z * c_m)); else tmp = Float64(fma(Float64(a * t), -4.0, Float64(b / z)) / c_m); end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := N[(c$95$s * If[LessEqual[z, -5.3e-42], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(N[(N[(y * x), $MachinePrecision] * 9.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], If[LessEqual[z, 3e-32], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(z * c$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(b / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -5.3 \cdot 10^{-42}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{\left(y \cdot x\right) \cdot 9}{z}\right)}{c\_m}\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-32}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z \cdot c\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{b}{z}\right)}{c\_m}\\
\end{array}
\end{array}
if z < -5.3e-42Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6463.7
Applied rewrites63.7%
if -5.3e-42 < z < 3e-32Initial program 78.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6459.7
Applied rewrites59.7%
if 3e-32 < z Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
Taylor expanded in x around 0
Applied rewrites63.3%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(*
c_s
(if (<= z -5.3e-42)
(/ (fma (* a t) -4.0 (/ (* (* y 9.0) x) z)) c_m)
(if (<= z 3e-32)
(/ (fma (* y x) 9.0 b) (* z c_m))
(/ (fma (* a t) -4.0 (/ b z)) c_m)))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double tmp;
if (z <= -5.3e-42) {
tmp = fma((a * t), -4.0, (((y * 9.0) * x) / z)) / c_m;
} else if (z <= 3e-32) {
tmp = fma((y * x), 9.0, b) / (z * c_m);
} else {
tmp = fma((a * t), -4.0, (b / z)) / c_m;
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) tmp = 0.0 if (z <= -5.3e-42) tmp = Float64(fma(Float64(a * t), -4.0, Float64(Float64(Float64(y * 9.0) * x) / z)) / c_m); elseif (z <= 3e-32) tmp = Float64(fma(Float64(y * x), 9.0, b) / Float64(z * c_m)); else tmp = Float64(fma(Float64(a * t), -4.0, Float64(b / z)) / c_m); end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := N[(c$95$s * If[LessEqual[z, -5.3e-42], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(N[(N[(y * 9.0), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], If[LessEqual[z, 3e-32], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(z * c$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(b / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -5.3 \cdot 10^{-42}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{\left(y \cdot 9\right) \cdot x}{z}\right)}{c\_m}\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-32}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z \cdot c\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{b}{z}\right)}{c\_m}\\
\end{array}
\end{array}
if z < -5.3e-42Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6463.7
Applied rewrites63.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6463.6
Applied rewrites63.6%
if -5.3e-42 < z < 3e-32Initial program 78.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6459.7
Applied rewrites59.7%
if 3e-32 < z Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
Taylor expanded in x around 0
Applied rewrites63.3%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)))
(*
c_s
(if (<= t_1 -5e-43)
(/ (fma (* 9.0 x) y b) (* z c_m))
(if (<= t_1 40.0)
(/ (fma (* a t) -4.0 (/ b z)) c_m)
(/ (fma (/ (* y x) c_m) 9.0 (/ b c_m)) z))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = (x * 9.0) * y;
double tmp;
if (t_1 <= -5e-43) {
tmp = fma((9.0 * x), y, b) / (z * c_m);
} else if (t_1 <= 40.0) {
tmp = fma((a * t), -4.0, (b / z)) / c_m;
} else {
tmp = fma(((y * x) / c_m), 9.0, (b / c_m)) / z;
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_1 <= -5e-43) tmp = Float64(fma(Float64(9.0 * x), y, b) / Float64(z * c_m)); elseif (t_1 <= 40.0) tmp = Float64(fma(Float64(a * t), -4.0, Float64(b / z)) / c_m); else tmp = Float64(fma(Float64(Float64(y * x) / c_m), 9.0, Float64(b / c_m)) / z); end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, N[(c$95$s * If[LessEqual[t$95$1, -5e-43], N[(N[(N[(9.0 * x), $MachinePrecision] * y + b), $MachinePrecision] / N[(z * c$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 40.0], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(b / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], N[(N[(N[(N[(y * x), $MachinePrecision] / c$95$m), $MachinePrecision] * 9.0 + N[(b / c$95$m), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-43}:\\
\;\;\;\;\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z \cdot c\_m}\\
\mathbf{elif}\;t\_1 \leq 40:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{b}{z}\right)}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y \cdot x}{c\_m}, 9, \frac{b}{c\_m}\right)}{z}\\
\end{array}
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -5.00000000000000019e-43Initial program 78.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6459.7
Applied rewrites59.7%
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6459.7
Applied rewrites59.7%
if -5.00000000000000019e-43 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 40Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
Taylor expanded in x around 0
Applied rewrites63.3%
if 40 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 78.9%
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.4
Applied rewrites84.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-/.f6458.8
Applied rewrites58.8%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (/ (fma (* 9.0 x) y b) (* z c_m))) (t_2 (* (* x 9.0) y)))
(*
c_s
(if (<= t_2 -5e-43)
t_1
(if (<= t_2 1e-32) (/ (fma (* a t) -4.0 (/ b z)) c_m) t_1)))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = fma((9.0 * x), y, b) / (z * c_m);
double t_2 = (x * 9.0) * y;
double tmp;
if (t_2 <= -5e-43) {
tmp = t_1;
} else if (t_2 <= 1e-32) {
tmp = fma((a * t), -4.0, (b / z)) / c_m;
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(fma(Float64(9.0 * x), y, b) / Float64(z * c_m)) t_2 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_2 <= -5e-43) tmp = t_1; elseif (t_2 <= 1e-32) tmp = Float64(fma(Float64(a * t), -4.0, Float64(b / z)) / c_m); else tmp = t_1; end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(N[(9.0 * x), $MachinePrecision] * y + b), $MachinePrecision] / N[(z * c$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, N[(c$95$s * If[LessEqual[t$95$2, -5e-43], t$95$1, If[LessEqual[t$95$2, 1e-32], N[(N[(N[(a * t), $MachinePrecision] * -4.0 + N[(b / z), $MachinePrecision]), $MachinePrecision] / c$95$m), $MachinePrecision], t$95$1]]), $MachinePrecision]]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z \cdot c\_m}\\
t_2 := \left(x \cdot 9\right) \cdot y\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{-32}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot t, -4, \frac{b}{z}\right)}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -5.00000000000000019e-43 or 1.00000000000000006e-32 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 78.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6459.7
Applied rewrites59.7%
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6459.7
Applied rewrites59.7%
if -5.00000000000000019e-43 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.00000000000000006e-32Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in c around 0
lower-/.f64N/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-*.f6486.0
Applied rewrites86.0%
Taylor expanded in x around 0
Applied rewrites63.3%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(*
c_s
(if (<= a -6.5e-78)
(* (* a (/ t c_m)) -4.0)
(if (<= a 3.6e+177)
(/ (fma (* y x) 9.0 b) (* z c_m))
(* -4.0 (/ (* a t) c_m))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double tmp;
if (a <= -6.5e-78) {
tmp = (a * (t / c_m)) * -4.0;
} else if (a <= 3.6e+177) {
tmp = fma((y * x), 9.0, b) / (z * c_m);
} else {
tmp = -4.0 * ((a * t) / c_m);
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) tmp = 0.0 if (a <= -6.5e-78) tmp = Float64(Float64(a * Float64(t / c_m)) * -4.0); elseif (a <= 3.6e+177) tmp = Float64(fma(Float64(y * x), 9.0, b) / Float64(z * c_m)); else tmp = Float64(-4.0 * Float64(Float64(a * t) / c_m)); end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := N[(c$95$s * If[LessEqual[a, -6.5e-78], N[(N[(a * N[(t / c$95$m), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision], If[LessEqual[a, 3.6e+177], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(z * c$95$m), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c$95$m), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;a \leq -6.5 \cdot 10^{-78}:\\
\;\;\;\;\left(a \cdot \frac{t}{c\_m}\right) \cdot -4\\
\mathbf{elif}\;a \leq 3.6 \cdot 10^{+177}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z \cdot c\_m}\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c\_m}\\
\end{array}
\end{array}
if a < -6.5000000000000003e-78Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6438.8
Applied rewrites38.8%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6440.8
Applied rewrites40.8%
if -6.5000000000000003e-78 < a < 3.60000000000000003e177Initial program 78.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6459.7
Applied rewrites59.7%
if 3.60000000000000003e177 < a Initial program 78.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6438.8
Applied rewrites38.8%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(*
c_s
(if (<= a -6.5e-78)
(* (* a (/ t c_m)) -4.0)
(if (<= a 3.6e+177)
(/ (fma (* 9.0 x) y b) (* z c_m))
(* -4.0 (/ (* a t) c_m))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double tmp;
if (a <= -6.5e-78) {
tmp = (a * (t / c_m)) * -4.0;
} else if (a <= 3.6e+177) {
tmp = fma((9.0 * x), y, b) / (z * c_m);
} else {
tmp = -4.0 * ((a * t) / c_m);
}
return c_s * tmp;
}
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) tmp = 0.0 if (a <= -6.5e-78) tmp = Float64(Float64(a * Float64(t / c_m)) * -4.0); elseif (a <= 3.6e+177) tmp = Float64(fma(Float64(9.0 * x), y, b) / Float64(z * c_m)); else tmp = Float64(-4.0 * Float64(Float64(a * t) / c_m)); end return Float64(c_s * tmp) end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := N[(c$95$s * If[LessEqual[a, -6.5e-78], N[(N[(a * N[(t / c$95$m), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision], If[LessEqual[a, 3.6e+177], N[(N[(N[(9.0 * x), $MachinePrecision] * y + b), $MachinePrecision] / N[(z * c$95$m), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c$95$m), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;a \leq -6.5 \cdot 10^{-78}:\\
\;\;\;\;\left(a \cdot \frac{t}{c\_m}\right) \cdot -4\\
\mathbf{elif}\;a \leq 3.6 \cdot 10^{+177}:\\
\;\;\;\;\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z \cdot c\_m}\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c\_m}\\
\end{array}
\end{array}
if a < -6.5000000000000003e-78Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6438.8
Applied rewrites38.8%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6440.8
Applied rewrites40.8%
if -6.5000000000000003e-78 < a < 3.60000000000000003e177Initial program 78.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6459.7
Applied rewrites59.7%
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6459.7
Applied rewrites59.7%
if 3.60000000000000003e177 < a Initial program 78.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6438.8
Applied rewrites38.8%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (- (* (* (/ y (* c_m z)) -9.0) x)))
(t_2 (/ (/ b c_m) z))
(t_3 (* (* x 9.0) y)))
(*
c_s
(if (<= t_3 -5e-43)
t_1
(if (<= t_3 -5e-314)
(* -4.0 (/ (* a t) c_m))
(if (<= t_3 2e-295)
t_2
(if (<= t_3 2e-110)
(* (* a (/ t c_m)) -4.0)
(if (<= t_3 100000.0) t_2 t_1))))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = -(((y / (c_m * z)) * -9.0) * x);
double t_2 = (b / c_m) / z;
double t_3 = (x * 9.0) * y;
double tmp;
if (t_3 <= -5e-43) {
tmp = t_1;
} else if (t_3 <= -5e-314) {
tmp = -4.0 * ((a * t) / c_m);
} else if (t_3 <= 2e-295) {
tmp = t_2;
} else if (t_3 <= 2e-110) {
tmp = (a * (t / c_m)) * -4.0;
} else if (t_3 <= 100000.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = private
c\_s = private
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m 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(c_s, x, y, z, t, a, b, c_m)
use fmin_fmax_functions
real(8), intent (in) :: c_s
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_m
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = -(((y / (c_m * z)) * (-9.0d0)) * x)
t_2 = (b / c_m) / z
t_3 = (x * 9.0d0) * y
if (t_3 <= (-5d-43)) then
tmp = t_1
else if (t_3 <= (-5d-314)) then
tmp = (-4.0d0) * ((a * t) / c_m)
else if (t_3 <= 2d-295) then
tmp = t_2
else if (t_3 <= 2d-110) then
tmp = (a * (t / c_m)) * (-4.0d0)
else if (t_3 <= 100000.0d0) then
tmp = t_2
else
tmp = t_1
end if
code = c_s * tmp
end function
c\_m = Math.abs(c);
c\_s = Math.copySign(1.0, c);
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
public static double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = -(((y / (c_m * z)) * -9.0) * x);
double t_2 = (b / c_m) / z;
double t_3 = (x * 9.0) * y;
double tmp;
if (t_3 <= -5e-43) {
tmp = t_1;
} else if (t_3 <= -5e-314) {
tmp = -4.0 * ((a * t) / c_m);
} else if (t_3 <= 2e-295) {
tmp = t_2;
} else if (t_3 <= 2e-110) {
tmp = (a * (t / c_m)) * -4.0;
} else if (t_3 <= 100000.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = math.fabs(c) c\_s = math.copysign(1.0, c) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) def code(c_s, x, y, z, t, a, b, c_m): t_1 = -(((y / (c_m * z)) * -9.0) * x) t_2 = (b / c_m) / z t_3 = (x * 9.0) * y tmp = 0 if t_3 <= -5e-43: tmp = t_1 elif t_3 <= -5e-314: tmp = -4.0 * ((a * t) / c_m) elif t_3 <= 2e-295: tmp = t_2 elif t_3 <= 2e-110: tmp = (a * (t / c_m)) * -4.0 elif t_3 <= 100000.0: tmp = t_2 else: tmp = t_1 return c_s * tmp
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(-Float64(Float64(Float64(y / Float64(c_m * z)) * -9.0) * x)) t_2 = Float64(Float64(b / c_m) / z) t_3 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_3 <= -5e-43) tmp = t_1; elseif (t_3 <= -5e-314) tmp = Float64(-4.0 * Float64(Float64(a * t) / c_m)); elseif (t_3 <= 2e-295) tmp = t_2; elseif (t_3 <= 2e-110) tmp = Float64(Float64(a * Float64(t / c_m)) * -4.0); elseif (t_3 <= 100000.0) tmp = t_2; else tmp = t_1; end return Float64(c_s * tmp) end
c\_m = abs(c);
c\_s = sign(c) * abs(1.0);
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
function tmp_2 = code(c_s, x, y, z, t, a, b, c_m)
t_1 = -(((y / (c_m * z)) * -9.0) * x);
t_2 = (b / c_m) / z;
t_3 = (x * 9.0) * y;
tmp = 0.0;
if (t_3 <= -5e-43)
tmp = t_1;
elseif (t_3 <= -5e-314)
tmp = -4.0 * ((a * t) / c_m);
elseif (t_3 <= 2e-295)
tmp = t_2;
elseif (t_3 <= 2e-110)
tmp = (a * (t / c_m)) * -4.0;
elseif (t_3 <= 100000.0)
tmp = t_2;
else
tmp = t_1;
end
tmp_2 = c_s * tmp;
end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = (-N[(N[(N[(y / N[(c$95$m * z), $MachinePrecision]), $MachinePrecision] * -9.0), $MachinePrecision] * x), $MachinePrecision])}, Block[{t$95$2 = N[(N[(b / c$95$m), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, N[(c$95$s * If[LessEqual[t$95$3, -5e-43], t$95$1, If[LessEqual[t$95$3, -5e-314], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e-295], t$95$2, If[LessEqual[t$95$3, 2e-110], N[(N[(a * N[(t / c$95$m), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision], If[LessEqual[t$95$3, 100000.0], t$95$2, t$95$1]]]]]), $MachinePrecision]]]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := -\left(\frac{y}{c\_m \cdot z} \cdot -9\right) \cdot x\\
t_2 := \frac{\frac{b}{c\_m}}{z}\\
t_3 := \left(x \cdot 9\right) \cdot y\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq -5 \cdot 10^{-314}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c\_m}\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-295}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-110}:\\
\;\;\;\;\left(a \cdot \frac{t}{c\_m}\right) \cdot -4\\
\mathbf{elif}\;t\_3 \leq 100000:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -5.00000000000000019e-43 or 1e5 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 78.9%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6437.7
Applied rewrites37.7%
if -5.00000000000000019e-43 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -4.99999999982e-314Initial program 78.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6438.8
Applied rewrites38.8%
if -4.99999999982e-314 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 2.00000000000000012e-295 or 2.0000000000000001e-110 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1e5Initial program 78.9%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6434.6
Applied rewrites34.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6434.3
Applied rewrites34.3%
if 2.00000000000000012e-295 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 2.0000000000000001e-110Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6438.8
Applied rewrites38.8%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6440.8
Applied rewrites40.8%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (/ (* (* y x) 9.0) (* c_m z)))
(t_2 (/ (/ b c_m) z))
(t_3 (* (* x 9.0) y)))
(*
c_s
(if (<= t_3 -5e-43)
t_1
(if (<= t_3 -5e-314)
(* -4.0 (/ (* a t) c_m))
(if (<= t_3 2e-295)
t_2
(if (<= t_3 2e-110)
(* (* a (/ t c_m)) -4.0)
(if (<= t_3 100000.0) t_2 t_1))))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = ((y * x) * 9.0) / (c_m * z);
double t_2 = (b / c_m) / z;
double t_3 = (x * 9.0) * y;
double tmp;
if (t_3 <= -5e-43) {
tmp = t_1;
} else if (t_3 <= -5e-314) {
tmp = -4.0 * ((a * t) / c_m);
} else if (t_3 <= 2e-295) {
tmp = t_2;
} else if (t_3 <= 2e-110) {
tmp = (a * (t / c_m)) * -4.0;
} else if (t_3 <= 100000.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = private
c\_s = private
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m 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(c_s, x, y, z, t, a, b, c_m)
use fmin_fmax_functions
real(8), intent (in) :: c_s
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_m
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = ((y * x) * 9.0d0) / (c_m * z)
t_2 = (b / c_m) / z
t_3 = (x * 9.0d0) * y
if (t_3 <= (-5d-43)) then
tmp = t_1
else if (t_3 <= (-5d-314)) then
tmp = (-4.0d0) * ((a * t) / c_m)
else if (t_3 <= 2d-295) then
tmp = t_2
else if (t_3 <= 2d-110) then
tmp = (a * (t / c_m)) * (-4.0d0)
else if (t_3 <= 100000.0d0) then
tmp = t_2
else
tmp = t_1
end if
code = c_s * tmp
end function
c\_m = Math.abs(c);
c\_s = Math.copySign(1.0, c);
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
public static double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = ((y * x) * 9.0) / (c_m * z);
double t_2 = (b / c_m) / z;
double t_3 = (x * 9.0) * y;
double tmp;
if (t_3 <= -5e-43) {
tmp = t_1;
} else if (t_3 <= -5e-314) {
tmp = -4.0 * ((a * t) / c_m);
} else if (t_3 <= 2e-295) {
tmp = t_2;
} else if (t_3 <= 2e-110) {
tmp = (a * (t / c_m)) * -4.0;
} else if (t_3 <= 100000.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = math.fabs(c) c\_s = math.copysign(1.0, c) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) def code(c_s, x, y, z, t, a, b, c_m): t_1 = ((y * x) * 9.0) / (c_m * z) t_2 = (b / c_m) / z t_3 = (x * 9.0) * y tmp = 0 if t_3 <= -5e-43: tmp = t_1 elif t_3 <= -5e-314: tmp = -4.0 * ((a * t) / c_m) elif t_3 <= 2e-295: tmp = t_2 elif t_3 <= 2e-110: tmp = (a * (t / c_m)) * -4.0 elif t_3 <= 100000.0: tmp = t_2 else: tmp = t_1 return c_s * tmp
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(Float64(Float64(y * x) * 9.0) / Float64(c_m * z)) t_2 = Float64(Float64(b / c_m) / z) t_3 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_3 <= -5e-43) tmp = t_1; elseif (t_3 <= -5e-314) tmp = Float64(-4.0 * Float64(Float64(a * t) / c_m)); elseif (t_3 <= 2e-295) tmp = t_2; elseif (t_3 <= 2e-110) tmp = Float64(Float64(a * Float64(t / c_m)) * -4.0); elseif (t_3 <= 100000.0) tmp = t_2; else tmp = t_1; end return Float64(c_s * tmp) end
c\_m = abs(c);
c\_s = sign(c) * abs(1.0);
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
function tmp_2 = code(c_s, x, y, z, t, a, b, c_m)
t_1 = ((y * x) * 9.0) / (c_m * z);
t_2 = (b / c_m) / z;
t_3 = (x * 9.0) * y;
tmp = 0.0;
if (t_3 <= -5e-43)
tmp = t_1;
elseif (t_3 <= -5e-314)
tmp = -4.0 * ((a * t) / c_m);
elseif (t_3 <= 2e-295)
tmp = t_2;
elseif (t_3 <= 2e-110)
tmp = (a * (t / c_m)) * -4.0;
elseif (t_3 <= 100000.0)
tmp = t_2;
else
tmp = t_1;
end
tmp_2 = c_s * tmp;
end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(N[(y * x), $MachinePrecision] * 9.0), $MachinePrecision] / N[(c$95$m * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b / c$95$m), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, N[(c$95$s * If[LessEqual[t$95$3, -5e-43], t$95$1, If[LessEqual[t$95$3, -5e-314], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e-295], t$95$2, If[LessEqual[t$95$3, 2e-110], N[(N[(a * N[(t / c$95$m), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision], If[LessEqual[t$95$3, 100000.0], t$95$2, t$95$1]]]]]), $MachinePrecision]]]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \frac{\left(y \cdot x\right) \cdot 9}{c\_m \cdot z}\\
t_2 := \frac{\frac{b}{c\_m}}{z}\\
t_3 := \left(x \cdot 9\right) \cdot y\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq -5 \cdot 10^{-314}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c\_m}\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-295}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-110}:\\
\;\;\;\;\left(a \cdot \frac{t}{c\_m}\right) \cdot -4\\
\mathbf{elif}\;t\_3 \leq 100000:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -5.00000000000000019e-43 or 1e5 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 78.9%
Taylor expanded in x around inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6435.8
Applied rewrites35.8%
if -5.00000000000000019e-43 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -4.99999999982e-314Initial program 78.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6438.8
Applied rewrites38.8%
if -4.99999999982e-314 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 2.00000000000000012e-295 or 2.0000000000000001e-110 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1e5Initial program 78.9%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6434.6
Applied rewrites34.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6434.3
Applied rewrites34.3%
if 2.00000000000000012e-295 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 2.0000000000000001e-110Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6438.8
Applied rewrites38.8%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6440.8
Applied rewrites40.8%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (/ (* (* 9.0 x) y) (* c_m z)))
(t_2 (/ (/ b c_m) z))
(t_3 (* (* x 9.0) y)))
(*
c_s
(if (<= t_3 -5e-43)
t_1
(if (<= t_3 -5e-314)
(* -4.0 (/ (* a t) c_m))
(if (<= t_3 2e-295)
t_2
(if (<= t_3 2e-110)
(* (* a (/ t c_m)) -4.0)
(if (<= t_3 1e-32) t_2 t_1))))))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = ((9.0 * x) * y) / (c_m * z);
double t_2 = (b / c_m) / z;
double t_3 = (x * 9.0) * y;
double tmp;
if (t_3 <= -5e-43) {
tmp = t_1;
} else if (t_3 <= -5e-314) {
tmp = -4.0 * ((a * t) / c_m);
} else if (t_3 <= 2e-295) {
tmp = t_2;
} else if (t_3 <= 2e-110) {
tmp = (a * (t / c_m)) * -4.0;
} else if (t_3 <= 1e-32) {
tmp = t_2;
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = private
c\_s = private
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m 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(c_s, x, y, z, t, a, b, c_m)
use fmin_fmax_functions
real(8), intent (in) :: c_s
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_m
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = ((9.0d0 * x) * y) / (c_m * z)
t_2 = (b / c_m) / z
t_3 = (x * 9.0d0) * y
if (t_3 <= (-5d-43)) then
tmp = t_1
else if (t_3 <= (-5d-314)) then
tmp = (-4.0d0) * ((a * t) / c_m)
else if (t_3 <= 2d-295) then
tmp = t_2
else if (t_3 <= 2d-110) then
tmp = (a * (t / c_m)) * (-4.0d0)
else if (t_3 <= 1d-32) then
tmp = t_2
else
tmp = t_1
end if
code = c_s * tmp
end function
c\_m = Math.abs(c);
c\_s = Math.copySign(1.0, c);
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
public static double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = ((9.0 * x) * y) / (c_m * z);
double t_2 = (b / c_m) / z;
double t_3 = (x * 9.0) * y;
double tmp;
if (t_3 <= -5e-43) {
tmp = t_1;
} else if (t_3 <= -5e-314) {
tmp = -4.0 * ((a * t) / c_m);
} else if (t_3 <= 2e-295) {
tmp = t_2;
} else if (t_3 <= 2e-110) {
tmp = (a * (t / c_m)) * -4.0;
} else if (t_3 <= 1e-32) {
tmp = t_2;
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = math.fabs(c) c\_s = math.copysign(1.0, c) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) def code(c_s, x, y, z, t, a, b, c_m): t_1 = ((9.0 * x) * y) / (c_m * z) t_2 = (b / c_m) / z t_3 = (x * 9.0) * y tmp = 0 if t_3 <= -5e-43: tmp = t_1 elif t_3 <= -5e-314: tmp = -4.0 * ((a * t) / c_m) elif t_3 <= 2e-295: tmp = t_2 elif t_3 <= 2e-110: tmp = (a * (t / c_m)) * -4.0 elif t_3 <= 1e-32: tmp = t_2 else: tmp = t_1 return c_s * tmp
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(Float64(Float64(9.0 * x) * y) / Float64(c_m * z)) t_2 = Float64(Float64(b / c_m) / z) t_3 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (t_3 <= -5e-43) tmp = t_1; elseif (t_3 <= -5e-314) tmp = Float64(-4.0 * Float64(Float64(a * t) / c_m)); elseif (t_3 <= 2e-295) tmp = t_2; elseif (t_3 <= 2e-110) tmp = Float64(Float64(a * Float64(t / c_m)) * -4.0); elseif (t_3 <= 1e-32) tmp = t_2; else tmp = t_1; end return Float64(c_s * tmp) end
c\_m = abs(c);
c\_s = sign(c) * abs(1.0);
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
function tmp_2 = code(c_s, x, y, z, t, a, b, c_m)
t_1 = ((9.0 * x) * y) / (c_m * z);
t_2 = (b / c_m) / z;
t_3 = (x * 9.0) * y;
tmp = 0.0;
if (t_3 <= -5e-43)
tmp = t_1;
elseif (t_3 <= -5e-314)
tmp = -4.0 * ((a * t) / c_m);
elseif (t_3 <= 2e-295)
tmp = t_2;
elseif (t_3 <= 2e-110)
tmp = (a * (t / c_m)) * -4.0;
elseif (t_3 <= 1e-32)
tmp = t_2;
else
tmp = t_1;
end
tmp_2 = c_s * tmp;
end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(N[(9.0 * x), $MachinePrecision] * y), $MachinePrecision] / N[(c$95$m * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b / c$95$m), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, N[(c$95$s * If[LessEqual[t$95$3, -5e-43], t$95$1, If[LessEqual[t$95$3, -5e-314], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e-295], t$95$2, If[LessEqual[t$95$3, 2e-110], N[(N[(a * N[(t / c$95$m), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision], If[LessEqual[t$95$3, 1e-32], t$95$2, t$95$1]]]]]), $MachinePrecision]]]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \frac{\left(9 \cdot x\right) \cdot y}{c\_m \cdot z}\\
t_2 := \frac{\frac{b}{c\_m}}{z}\\
t_3 := \left(x \cdot 9\right) \cdot y\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq -5 \cdot 10^{-314}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c\_m}\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-295}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-110}:\\
\;\;\;\;\left(a \cdot \frac{t}{c\_m}\right) \cdot -4\\
\mathbf{elif}\;t\_3 \leq 10^{-32}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -5.00000000000000019e-43 or 1.00000000000000006e-32 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in x around inf
associate-*r/N/A
associate-*r*N/A
*-commutativeN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6435.8
Applied rewrites35.8%
if -5.00000000000000019e-43 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -4.99999999982e-314Initial program 78.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6438.8
Applied rewrites38.8%
if -4.99999999982e-314 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 2.00000000000000012e-295 or 2.0000000000000001e-110 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.00000000000000006e-32Initial program 78.9%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6434.6
Applied rewrites34.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6434.3
Applied rewrites34.3%
if 2.00000000000000012e-295 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 2.0000000000000001e-110Initial program 78.9%
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.4
Applied rewrites84.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6438.8
Applied rewrites38.8%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6440.8
Applied rewrites40.8%
c\_m = (fabs.f64 c)
c\_s = (copysign.f64 #s(literal 1 binary64) c)
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
(FPCore (c_s x y z t a b c_m)
:precision binary64
(let* ((t_1 (/ (/ b c_m) z)))
(*
c_s
(if (<= b -1.3e-50)
t_1
(if (<= b 3.5e+49) (* -4.0 (/ (* a t) c_m)) t_1)))))c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = (b / c_m) / z;
double tmp;
if (b <= -1.3e-50) {
tmp = t_1;
} else if (b <= 3.5e+49) {
tmp = -4.0 * ((a * t) / c_m);
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = private
c\_s = private
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m 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(c_s, x, y, z, t, a, b, c_m)
use fmin_fmax_functions
real(8), intent (in) :: c_s
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_m
real(8) :: t_1
real(8) :: tmp
t_1 = (b / c_m) / z
if (b <= (-1.3d-50)) then
tmp = t_1
else if (b <= 3.5d+49) then
tmp = (-4.0d0) * ((a * t) / c_m)
else
tmp = t_1
end if
code = c_s * tmp
end function
c\_m = Math.abs(c);
c\_s = Math.copySign(1.0, c);
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
public static double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
double t_1 = (b / c_m) / z;
double tmp;
if (b <= -1.3e-50) {
tmp = t_1;
} else if (b <= 3.5e+49) {
tmp = -4.0 * ((a * t) / c_m);
} else {
tmp = t_1;
}
return c_s * tmp;
}
c\_m = math.fabs(c) c\_s = math.copysign(1.0, c) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) def code(c_s, x, y, z, t, a, b, c_m): t_1 = (b / c_m) / z tmp = 0 if b <= -1.3e-50: tmp = t_1 elif b <= 3.5e+49: tmp = -4.0 * ((a * t) / c_m) else: tmp = t_1 return c_s * tmp
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) t_1 = Float64(Float64(b / c_m) / z) tmp = 0.0 if (b <= -1.3e-50) tmp = t_1; elseif (b <= 3.5e+49) tmp = Float64(-4.0 * Float64(Float64(a * t) / c_m)); else tmp = t_1; end return Float64(c_s * tmp) end
c\_m = abs(c);
c\_s = sign(c) * abs(1.0);
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
function tmp_2 = code(c_s, x, y, z, t, a, b, c_m)
t_1 = (b / c_m) / z;
tmp = 0.0;
if (b <= -1.3e-50)
tmp = t_1;
elseif (b <= 3.5e+49)
tmp = -4.0 * ((a * t) / c_m);
else
tmp = t_1;
end
tmp_2 = c_s * tmp;
end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := Block[{t$95$1 = N[(N[(b / c$95$m), $MachinePrecision] / z), $MachinePrecision]}, N[(c$95$s * If[LessEqual[b, -1.3e-50], t$95$1, If[LessEqual[b, 3.5e+49], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c$95$m), $MachinePrecision]), $MachinePrecision], t$95$1]]), $MachinePrecision]]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
\begin{array}{l}
t_1 := \frac{\frac{b}{c\_m}}{z}\\
c\_s \cdot \begin{array}{l}
\mathbf{if}\;b \leq -1.3 \cdot 10^{-50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 3.5 \cdot 10^{+49}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c\_m}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if b < -1.3000000000000001e-50 or 3.49999999999999975e49 < b Initial program 78.9%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6434.6
Applied rewrites34.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6434.3
Applied rewrites34.3%
if -1.3000000000000001e-50 < b < 3.49999999999999975e49Initial program 78.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6438.8
Applied rewrites38.8%
c\_m = (fabs.f64 c) c\_s = (copysign.f64 #s(literal 1 binary64) c) NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function. (FPCore (c_s x y z t a b c_m) :precision binary64 (* c_s (/ (/ b c_m) z)))
c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
return c_s * ((b / c_m) / z);
}
c\_m = private
c\_s = private
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m 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(c_s, x, y, z, t, a, b, c_m)
use fmin_fmax_functions
real(8), intent (in) :: c_s
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_m
code = c_s * ((b / c_m) / z)
end function
c\_m = Math.abs(c);
c\_s = Math.copySign(1.0, c);
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
public static double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
return c_s * ((b / c_m) / z);
}
c\_m = math.fabs(c) c\_s = math.copysign(1.0, c) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) def code(c_s, x, y, z, t, a, b, c_m): return c_s * ((b / c_m) / z)
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) return Float64(c_s * Float64(Float64(b / c_m) / z)) end
c\_m = abs(c);
c\_s = sign(c) * abs(1.0);
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
function tmp = code(c_s, x, y, z, t, a, b, c_m)
tmp = c_s * ((b / c_m) / z);
end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := N[(c$95$s * N[(N[(b / c$95$m), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
c\_s \cdot \frac{\frac{b}{c\_m}}{z}
\end{array}
Initial program 78.9%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6434.6
Applied rewrites34.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6434.3
Applied rewrites34.3%
c\_m = (fabs.f64 c) c\_s = (copysign.f64 #s(literal 1 binary64) c) NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function. (FPCore (c_s x y z t a b c_m) :precision binary64 (* c_s (/ b (* c_m z))))
c\_m = fabs(c);
c\_s = copysign(1.0, c);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
assert(x < y && y < z && z < t && t < a && a < b && b < c_m);
double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
return c_s * (b / (c_m * z));
}
c\_m = private
c\_s = private
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m 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(c_s, x, y, z, t, a, b, c_m)
use fmin_fmax_functions
real(8), intent (in) :: c_s
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_m
code = c_s * (b / (c_m * z))
end function
c\_m = Math.abs(c);
c\_s = Math.copySign(1.0, c);
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
assert x < y && y < z && z < t && t < a && a < b && b < c_m;
public static double code(double c_s, double x, double y, double z, double t, double a, double b, double c_m) {
return c_s * (b / (c_m * z));
}
c\_m = math.fabs(c) c\_s = math.copysign(1.0, c) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) [x, y, z, t, a, b, c_m] = sort([x, y, z, t, a, b, c_m]) def code(c_s, x, y, z, t, a, b, c_m): return c_s * (b / (c_m * z))
c\_m = abs(c) c\_s = copysign(1.0, c) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) x, y, z, t, a, b, c_m = sort([x, y, z, t, a, b, c_m]) function code(c_s, x, y, z, t, a, b, c_m) return Float64(c_s * Float64(b / Float64(c_m * z))) end
c\_m = abs(c);
c\_s = sign(c) * abs(1.0);
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
x, y, z, t, a, b, c_m = num2cell(sort([x, y, z, t, a, b, c_m])){:}
function tmp = code(c_s, x, y, z, t, a, b, c_m)
tmp = c_s * (b / (c_m * z));
end
c\_m = N[Abs[c], $MachinePrecision]
c\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c_m should be sorted in increasing order before calling this function.
code[c$95$s_, x_, y_, z_, t_, a_, b_, c$95$m_] := N[(c$95$s * N[(b / N[(c$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c\_m = \left|c\right|
\\
c\_s = \mathsf{copysign}\left(1, c\right)
\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\\\
[x, y, z, t, a, b, c_m] = \mathsf{sort}([x, y, z, t, a, b, c_m])\\
\\
c\_s \cdot \frac{b}{c\_m \cdot z}
\end{array}
Initial program 78.9%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f6434.6
Applied rewrites34.6%
herbie shell --seed 2025142
(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)))