
(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}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c) :precision binary64 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = ((((x * 9.0d0) * y) - (((z * 4.0d0) * t) * a)) + b) / (z * c)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
def code(x, y, z, t, a, b, c): return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision] - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\end{array}
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (* a t) c)) (t_2 (/ b (* c z))))
(if (<= z -2.4e+95)
(* (fma -9.0 (/ y (* c z)) (/ (fma t_1 -4.0 t_2) (- x))) (- x))
(if (<= z 9.2e+91)
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))
(* (fma (/ -9.0 z) (/ y c) (/ (- t_2 (* t_1 4.0)) (- x))) (- x))))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (a * t) / c;
double t_2 = b / (c * z);
double tmp;
if (z <= -2.4e+95) {
tmp = fma(-9.0, (y / (c * z)), (fma(t_1, -4.0, t_2) / -x)) * -x;
} else if (z <= 9.2e+91) {
tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
} else {
tmp = fma((-9.0 / z), (y / c), ((t_2 - (t_1 * 4.0)) / -x)) * -x;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(a * t) / c) t_2 = Float64(b / Float64(c * z)) tmp = 0.0 if (z <= -2.4e+95) tmp = Float64(fma(-9.0, Float64(y / Float64(c * z)), Float64(fma(t_1, -4.0, t_2) / Float64(-x))) * Float64(-x)); elseif (z <= 9.2e+91) tmp = Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)); else tmp = Float64(fma(Float64(-9.0 / z), Float64(y / c), Float64(Float64(t_2 - Float64(t_1 * 4.0)) / Float64(-x))) * Float64(-x)); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]}, Block[{t$95$2 = N[(b / N[(c * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.4e+95], N[(N[(-9.0 * N[(y / N[(c * z), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 * -4.0 + t$95$2), $MachinePrecision] / (-x)), $MachinePrecision]), $MachinePrecision] * (-x)), $MachinePrecision], If[LessEqual[z, 9.2e+91], 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], N[(N[(N[(-9.0 / z), $MachinePrecision] * N[(y / c), $MachinePrecision] + N[(N[(t$95$2 - N[(t$95$1 * 4.0), $MachinePrecision]), $MachinePrecision] / (-x)), $MachinePrecision]), $MachinePrecision] * (-x)), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\\\
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \frac{a \cdot t}{c}\\
t_2 := \frac{b}{c \cdot z}\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(-9, \frac{y}{c \cdot z}, \frac{\mathsf{fma}\left(t\_1, -4, t\_2\right)}{-x}\right) \cdot \left(-x\right)\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+91}:\\
\;\;\;\;\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}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-9}{z}, \frac{y}{c}, \frac{t\_2 - t\_1 \cdot 4}{-x}\right) \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -2.4e95Initial program 54.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites67.6%
Taylor expanded in x around -inf
Applied rewrites76.6%
if -2.4e95 < z < 9.19999999999999965e91Initial program 94.9%
if 9.19999999999999965e91 < z Initial program 50.7%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.3%
Final simplification89.1%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)))
(if (<= (/ (+ (- t_1 (* (* (* z 4.0) t) a)) b) (* z c)) INFINITY)
(/ (+ (- t_1 (* (* 4.0 z) (* a t))) b) (* z c))
(* -4.0 (* a (/ t c))))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double tmp;
if ((((t_1 - (((z * 4.0) * t) * a)) + b) / (z * c)) <= ((double) INFINITY)) {
tmp = ((t_1 - ((4.0 * z) * (a * t))) + b) / (z * c);
} else {
tmp = -4.0 * (a * (t / c));
}
return tmp;
}
assert x < y && y < z && z < t && t < a && a < b && b < c;
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double tmp;
if ((((t_1 - (((z * 4.0) * t) * a)) + b) / (z * c)) <= Double.POSITIVE_INFINITY) {
tmp = ((t_1 - ((4.0 * z) * (a * t))) + b) / (z * c);
} else {
tmp = -4.0 * (a * (t / c));
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) [x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): t_1 = (x * 9.0) * y tmp = 0 if (((t_1 - (((z * 4.0) * t) * a)) + b) / (z * c)) <= math.inf: tmp = ((t_1 - ((4.0 * z) * (a * t))) + b) / (z * c) else: tmp = -4.0 * (a * (t / c)) return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if (Float64(Float64(Float64(t_1 - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)) <= Inf) tmp = Float64(Float64(Float64(t_1 - Float64(Float64(4.0 * z) * Float64(a * t))) + b) / Float64(z * c)); else tmp = Float64(-4.0 * Float64(a * Float64(t / c))); end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (x * 9.0) * y;
tmp = 0.0;
if ((((t_1 - (((z * 4.0) * t) * a)) + b) / (z * c)) <= Inf)
tmp = ((t_1 - ((4.0 * z) * (a * t))) + b) / (z * c);
else
tmp = -4.0 * (a * (t / c));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[N[(N[(N[(t$95$1 - N[(N[(N[(z * 4.0), $MachinePrecision] * t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(t$95$1 - N[(N[(4.0 * z), $MachinePrecision] * N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(a * N[(t / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\\\
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;\frac{\left(t\_1 - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \leq \infty:\\
\;\;\;\;\frac{\left(t\_1 - \left(4 \cdot z\right) \cdot \left(a \cdot t\right)\right) + b}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(a \cdot \frac{t}{c}\right)\\
\end{array}
\end{array}
if (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x #s(literal 9 binary64)) y) (*.f64 (*.f64 (*.f64 z #s(literal 4 binary64)) t) a)) b) (*.f64 z c)) < +inf.0Initial program 86.1%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6486.9
Applied rewrites86.9%
if +inf.0 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x #s(literal 9 binary64)) y) (*.f64 (*.f64 (*.f64 z #s(literal 4 binary64)) t) a)) b) (*.f64 z c)) Initial program 0.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.0
Applied rewrites52.0%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6467.0
Applied rewrites67.0%
Final simplification85.5%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (* a t) c)) (t_2 (/ y (* c z))))
(if (<= z -2.4e+95)
(* (fma -9.0 t_2 (/ (fma t_1 -4.0 (/ b (* c z))) (- x))) (- x))
(if (<= z 7.5e+92)
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))
(* (- (fma t_2 9.0 (/ b (* (* z x) c))) (* (/ t_1 x) 4.0)) x)))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (a * t) / c;
double t_2 = y / (c * z);
double tmp;
if (z <= -2.4e+95) {
tmp = fma(-9.0, t_2, (fma(t_1, -4.0, (b / (c * z))) / -x)) * -x;
} else if (z <= 7.5e+92) {
tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
} else {
tmp = (fma(t_2, 9.0, (b / ((z * x) * c))) - ((t_1 / x) * 4.0)) * x;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(a * t) / c) t_2 = Float64(y / Float64(c * z)) tmp = 0.0 if (z <= -2.4e+95) tmp = Float64(fma(-9.0, t_2, Float64(fma(t_1, -4.0, Float64(b / Float64(c * z))) / Float64(-x))) * Float64(-x)); elseif (z <= 7.5e+92) tmp = Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)); else tmp = Float64(Float64(fma(t_2, 9.0, Float64(b / Float64(Float64(z * x) * c))) - Float64(Float64(t_1 / x) * 4.0)) * x); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]}, Block[{t$95$2 = N[(y / N[(c * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.4e+95], N[(N[(-9.0 * t$95$2 + N[(N[(t$95$1 * -4.0 + N[(b / N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-x)), $MachinePrecision]), $MachinePrecision] * (-x)), $MachinePrecision], If[LessEqual[z, 7.5e+92], 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], N[(N[(N[(t$95$2 * 9.0 + N[(b / N[(N[(z * x), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(t$95$1 / x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\\\
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \frac{a \cdot t}{c}\\
t_2 := \frac{y}{c \cdot z}\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(-9, t\_2, \frac{\mathsf{fma}\left(t\_1, -4, \frac{b}{c \cdot z}\right)}{-x}\right) \cdot \left(-x\right)\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+92}:\\
\;\;\;\;\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}\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(t\_2, 9, \frac{b}{\left(z \cdot x\right) \cdot c}\right) - \frac{t\_1}{x} \cdot 4\right) \cdot x\\
\end{array}
\end{array}
if z < -2.4e95Initial program 54.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites67.6%
Taylor expanded in x around -inf
Applied rewrites76.6%
if -2.4e95 < z < 7.49999999999999946e92Initial program 94.9%
if 7.49999999999999946e92 < z Initial program 49.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.9%
Final simplification88.9%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(if (<= z -2.4e+95)
(*
(fma -9.0 (/ y (* c z)) (/ (fma (/ (* a t) c) -4.0 (/ b (* c z))) (- x)))
(- x))
(if (<= z 1.15e+92)
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))
(* (fma (/ a c) -4.0 (/ (fma (* y x) 9.0 b) (* (* t z) c))) t))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (z <= -2.4e+95) {
tmp = fma(-9.0, (y / (c * z)), (fma(((a * t) / c), -4.0, (b / (c * z))) / -x)) * -x;
} else if (z <= 1.15e+92) {
tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
} else {
tmp = fma((a / c), -4.0, (fma((y * x), 9.0, b) / ((t * z) * c))) * t;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) tmp = 0.0 if (z <= -2.4e+95) tmp = Float64(fma(-9.0, Float64(y / Float64(c * z)), Float64(fma(Float64(Float64(a * t) / c), -4.0, Float64(b / Float64(c * z))) / Float64(-x))) * Float64(-x)); elseif (z <= 1.15e+92) tmp = Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)); else tmp = Float64(fma(Float64(a / c), -4.0, Float64(fma(Float64(y * x), 9.0, b) / Float64(Float64(t * z) * c))) * t); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[z, -2.4e+95], N[(N[(-9.0 * N[(y / N[(c * z), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision] * -4.0 + N[(b / N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-x)), $MachinePrecision]), $MachinePrecision] * (-x)), $MachinePrecision], If[LessEqual[z, 1.15e+92], 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], N[(N[(N[(a / c), $MachinePrecision] * -4.0 + N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\\\
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(-9, \frac{y}{c \cdot z}, \frac{\mathsf{fma}\left(\frac{a \cdot t}{c}, -4, \frac{b}{c \cdot z}\right)}{-x}\right) \cdot \left(-x\right)\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+92}:\\
\;\;\;\;\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}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{c}, -4, \frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{\left(t \cdot z\right) \cdot c}\right) \cdot t\\
\end{array}
\end{array}
if z < -2.4e95Initial program 54.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites67.6%
Taylor expanded in x around -inf
Applied rewrites76.6%
if -2.4e95 < z < 1.14999999999999999e92Initial program 94.9%
if 1.14999999999999999e92 < z Initial program 50.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.4%
Final simplification89.1%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* x 9.0) y)))
(if (or (<= t_1 -2.0) (not (<= t_1 1e+44)))
(/ (/ (fma (* y x) 9.0 b) c) z)
(/ (/ (- b (* (* (* t z) a) 4.0)) c) z))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * 9.0) * y;
double tmp;
if ((t_1 <= -2.0) || !(t_1 <= 1e+44)) {
tmp = (fma((y * x), 9.0, b) / c) / z;
} else {
tmp = ((b - (((t * z) * a) * 4.0)) / c) / z;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * 9.0) * y) tmp = 0.0 if ((t_1 <= -2.0) || !(t_1 <= 1e+44)) tmp = Float64(Float64(fma(Float64(y * x), 9.0, b) / c) / z); else tmp = Float64(Float64(Float64(b - Float64(Float64(Float64(t * z) * a) * 4.0)) / c) / z); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * 9.0), $MachinePrecision] * y), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2.0], N[Not[LessEqual[t$95$1, 1e+44]], $MachinePrecision]], N[(N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(b - N[(N[(N[(t * z), $MachinePrecision] * a), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\\\
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := \left(x \cdot 9\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -2 \lor \neg \left(t\_1 \leq 10^{+44}\right):\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{b - \left(\left(t \cdot z\right) \cdot a\right) \cdot 4}{c}}{z}\\
\end{array}
\end{array}
if (*.f64 (*.f64 x #s(literal 9 binary64)) y) < -2 or 1.0000000000000001e44 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) Initial program 75.7%
Taylor expanded in z around 0
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6473.1
Applied rewrites73.1%
if -2 < (*.f64 (*.f64 x #s(literal 9 binary64)) y) < 1.0000000000000001e44Initial program 83.8%
Taylor expanded in x around 0
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6482.3
Applied rewrites82.3%
Final simplification78.0%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(if (<= z -7.4e+152)
(* -4.0 (* a (/ t c)))
(if (<= z 1.15e+92)
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))
(* (fma (/ a c) -4.0 (/ (fma (* y x) 9.0 b) (* (* t z) c))) t))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (z <= -7.4e+152) {
tmp = -4.0 * (a * (t / c));
} else if (z <= 1.15e+92) {
tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
} else {
tmp = fma((a / c), -4.0, (fma((y * x), 9.0, b) / ((t * z) * c))) * t;
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) tmp = 0.0 if (z <= -7.4e+152) tmp = Float64(-4.0 * Float64(a * Float64(t / c))); elseif (z <= 1.15e+92) tmp = Float64(Float64(Float64(Float64(Float64(x * 9.0) * y) - Float64(Float64(Float64(z * 4.0) * t) * a)) + b) / Float64(z * c)); else tmp = Float64(fma(Float64(a / c), -4.0, Float64(fma(Float64(y * x), 9.0, b) / Float64(Float64(t * z) * c))) * t); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[z, -7.4e+152], N[(-4.0 * N[(a * N[(t / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.15e+92], 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], N[(N[(N[(a / c), $MachinePrecision] * -4.0 + N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\\\
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{+152}:\\
\;\;\;\;-4 \cdot \left(a \cdot \frac{t}{c}\right)\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+92}:\\
\;\;\;\;\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}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{c}, -4, \frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{\left(t \cdot z\right) \cdot c}\right) \cdot t\\
\end{array}
\end{array}
if z < -7.39999999999999992e152Initial program 50.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6466.4
Applied rewrites66.4%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6468.8
Applied rewrites68.8%
if -7.39999999999999992e152 < z < 1.14999999999999999e92Initial program 93.9%
if 1.14999999999999999e92 < z Initial program 50.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.4%
Final simplification87.9%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* -4.0 (* a (/ t c)))))
(if (<= z -2.3e+149)
t_1
(if (<= z 0.0075)
(/ (fma (* y x) 9.0 b) (* z c))
(if (<= z 1.05e+106)
t_1
(if (<= z 1.65e+170)
(* (/ (* 9.0 x) z) (/ y c))
(* -4.0 (/ (* a t) c))))))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = -4.0 * (a * (t / c));
double tmp;
if (z <= -2.3e+149) {
tmp = t_1;
} else if (z <= 0.0075) {
tmp = fma((y * x), 9.0, b) / (z * c);
} else if (z <= 1.05e+106) {
tmp = t_1;
} else if (z <= 1.65e+170) {
tmp = ((9.0 * x) / z) * (y / c);
} else {
tmp = -4.0 * ((a * t) / c);
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) t_1 = Float64(-4.0 * Float64(a * Float64(t / c))) tmp = 0.0 if (z <= -2.3e+149) tmp = t_1; elseif (z <= 0.0075) tmp = Float64(fma(Float64(y * x), 9.0, b) / Float64(z * c)); elseif (z <= 1.05e+106) tmp = t_1; elseif (z <= 1.65e+170) tmp = Float64(Float64(Float64(9.0 * x) / z) * Float64(y / c)); else tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(-4.0 * N[(a * N[(t / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.3e+149], t$95$1, If[LessEqual[z, 0.0075], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.05e+106], t$95$1, If[LessEqual[z, 1.65e+170], N[(N[(N[(9.0 * x), $MachinePrecision] / z), $MachinePrecision] * N[(y / c), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\\\
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
t_1 := -4 \cdot \left(a \cdot \frac{t}{c}\right)\\
\mathbf{if}\;z \leq -2.3 \cdot 10^{+149}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.0075:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z \cdot c}\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+106}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+170}:\\
\;\;\;\;\frac{9 \cdot x}{z} \cdot \frac{y}{c}\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\end{array}
\end{array}
if z < -2.2999999999999998e149 or 0.0074999999999999997 < z < 1.05000000000000002e106Initial program 62.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6467.4
Applied rewrites67.4%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6469.0
Applied rewrites69.0%
if -2.2999999999999998e149 < z < 0.0074999999999999997Initial program 95.1%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6480.6
Applied rewrites80.6%
if 1.05000000000000002e106 < z < 1.65000000000000012e170Initial program 59.1%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6464.1
Applied rewrites64.1%
Taylor expanded in x around inf
associate-*r/N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6463.6
Applied rewrites63.6%
if 1.65000000000000012e170 < z Initial program 38.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6478.3
Applied rewrites78.3%
Final simplification76.4%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(if (<= z -2.3e+149)
(* -4.0 (* a (/ t c)))
(if (<= z 1.65e+170)
(/ (/ (fma (* y x) 9.0 b) c) z)
(* -4.0 (/ (* a t) c)))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (z <= -2.3e+149) {
tmp = -4.0 * (a * (t / c));
} else if (z <= 1.65e+170) {
tmp = (fma((y * x), 9.0, b) / c) / z;
} else {
tmp = -4.0 * ((a * t) / c);
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) tmp = 0.0 if (z <= -2.3e+149) tmp = Float64(-4.0 * Float64(a * Float64(t / c))); elseif (z <= 1.65e+170) tmp = Float64(Float64(fma(Float64(y * x), 9.0, b) / c) / z); else tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[z, -2.3e+149], N[(-4.0 * N[(a * N[(t / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.65e+170], N[(N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / c), $MachinePrecision] / z), $MachinePrecision], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\\\
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+149}:\\
\;\;\;\;-4 \cdot \left(a \cdot \frac{t}{c}\right)\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+170}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{c}}{z}\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\end{array}
\end{array}
if z < -2.2999999999999998e149Initial program 50.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6466.4
Applied rewrites66.4%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6468.8
Applied rewrites68.8%
if -2.2999999999999998e149 < z < 1.65000000000000012e170Initial program 90.2%
Taylor expanded in z around 0
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6475.2
Applied rewrites75.2%
if 1.65000000000000012e170 < z Initial program 38.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6478.3
Applied rewrites78.3%
Final simplification74.5%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(if (<= z -2.3e+149)
(* -4.0 (* a (/ t c)))
(if (<= z 1.65e+170)
(/ (fma (* y x) 9.0 b) (* z c))
(* -4.0 (/ (* a t) c)))))assert(x < y && y < z && z < t && t < a && a < b && b < c);
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (z <= -2.3e+149) {
tmp = -4.0 * (a * (t / c));
} else if (z <= 1.65e+170) {
tmp = fma((y * x), 9.0, b) / (z * c);
} else {
tmp = -4.0 * ((a * t) / c);
}
return tmp;
}
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) tmp = 0.0 if (z <= -2.3e+149) tmp = Float64(-4.0 * Float64(a * Float64(t / c))); elseif (z <= 1.65e+170) tmp = Float64(fma(Float64(y * x), 9.0, b) / Float64(z * c)); else tmp = Float64(-4.0 * Float64(Float64(a * t) / c)); end return tmp end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[z, -2.3e+149], N[(-4.0 * N[(a * N[(t / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.65e+170], N[(N[(N[(y * x), $MachinePrecision] * 9.0 + b), $MachinePrecision] / N[(z * c), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(N[(a * t), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\\\
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+149}:\\
\;\;\;\;-4 \cdot \left(a \cdot \frac{t}{c}\right)\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+170}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \frac{a \cdot t}{c}\\
\end{array}
\end{array}
if z < -2.2999999999999998e149Initial program 50.1%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6466.4
Applied rewrites66.4%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6468.8
Applied rewrites68.8%
if -2.2999999999999998e149 < z < 1.65000000000000012e170Initial program 90.2%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.2
Applied rewrites74.2%
if 1.65000000000000012e170 < z Initial program 38.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6478.3
Applied rewrites78.3%
Final simplification73.8%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (if (or (<= z -1.2e+149) (not (<= z 6e-7))) (* -4.0 (* a (/ t c))) (/ b (* z c))))
assert(x < y && y < z && z < t && t < a && a < b && b < c);
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z <= -1.2e+149) || !(z <= 6e-7)) {
tmp = -4.0 * (a * (t / c));
} else {
tmp = b / (z * c);
}
return tmp;
}
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if ((z <= (-1.2d+149)) .or. (.not. (z <= 6d-7))) then
tmp = (-4.0d0) * (a * (t / c))
else
tmp = b / (z * c)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z <= -1.2e+149) || !(z <= 6e-7)) {
tmp = -4.0 * (a * (t / c));
} else {
tmp = b / (z * c);
}
return tmp;
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) [x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): tmp = 0 if (z <= -1.2e+149) or not (z <= 6e-7): tmp = -4.0 * (a * (t / c)) else: tmp = b / (z * c) return tmp
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) tmp = 0.0 if ((z <= -1.2e+149) || !(z <= 6e-7)) tmp = Float64(-4.0 * Float64(a * Float64(t / c))); else tmp = Float64(b / Float64(z * c)); end return tmp end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
tmp = 0.0;
if ((z <= -1.2e+149) || ~((z <= 6e-7)))
tmp = -4.0 * (a * (t / c));
else
tmp = b / (z * c);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[z, -1.2e+149], N[Not[LessEqual[z, 6e-7]], $MachinePrecision]], N[(-4.0 * N[(a * N[(t / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\\\
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+149} \lor \neg \left(z \leq 6 \cdot 10^{-7}\right):\\
\;\;\;\;-4 \cdot \left(a \cdot \frac{t}{c}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{z \cdot c}\\
\end{array}
\end{array}
if z < -1.20000000000000006e149 or 5.9999999999999997e-7 < z Initial program 56.4%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6460.6
Applied rewrites60.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6459.7
Applied rewrites59.7%
if -1.20000000000000006e149 < z < 5.9999999999999997e-7Initial program 95.1%
Taylor expanded in b around inf
Applied rewrites53.7%
Final simplification56.0%
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (/ b (* z c)))
assert(x < y && y < z && z < t && t < a && a < b && b < c);
assert(x < y && y < z && z < t && t < a && a < b && b < c);
double code(double x, double y, double z, double t, double a, double b, double c) {
return b / (z * c);
}
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function.
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = b / (z * c)
end function
assert x < y && y < z && z < t && t < a && a < b && b < c;
assert x < y && y < z && z < t && t < a && a < b && b < c;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return b / (z * c);
}
[x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) [x, y, z, t, a, b, c] = sort([x, y, z, t, a, b, c]) def code(x, y, z, t, a, b, c): return b / (z * c)
x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) x, y, z, t, a, b, c = sort([x, y, z, t, a, b, c]) function code(x, y, z, t, a, b, c) return Float64(b / Float64(z * c)) end
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
x, y, z, t, a, b, c = num2cell(sort([x, y, z, t, a, b, c])){:}
function tmp = code(x, y, z, t, a, b, c)
tmp = b / (z * c);
end
NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, b, and c should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := N[(b / N[(z * c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\\\
[x, y, z, t, a, b, c] = \mathsf{sort}([x, y, z, t, a, b, c])\\
\\
\frac{b}{z \cdot c}
\end{array}
Initial program 80.0%
Taylor expanded in b around inf
Applied rewrites39.2%
herbie shell --seed 2025084
(FPCore (x y z t a b c)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, J"
:precision binary64
:alt
(! :herbie-platform default (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) -220031348160821/200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 0) (/ (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) z) c) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 365902434742109/31250000000000000000000000000000000000000000000000000000000000000000) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 28768236795461370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (+ (* (* 9 (/ y c)) (/ x z)) (/ b (* c z))) (* 4 (/ (* a t) c))) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 138385150424563190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (- (+ (* 9 (* (/ y (* c z)) x)) (/ b (* c z))) (* 4 (/ (* a t) c)))))))))
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))