Statistics.Distribution.Beta:$centropy from math-functions-0.1.5.2

Percentage Accurate: 95.3% → 97.9%
Time: 13.2s
Alternatives: 22
Speedup: 0.5×

Specification

?
\[\begin{array}{l} \\ \left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
	return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = ((x - ((y - 1.0d0) * z)) - ((t - 1.0d0) * a)) + (((y + t) - 2.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
def code(x, y, z, t, a, b):
	return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b)
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b))
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 22 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 95.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
	return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = ((x - ((y - 1.0d0) * z)) - ((t - 1.0d0) * a)) + (((y + t) - 2.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
def code(x, y, z, t, a, b):
	return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b)
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b))
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b
\end{array}

Alternative 1: 97.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(\left(t + y\right) - 2\right) \cdot b\\ \mathbf{if}\;t\_1 + \left(\left(x - z \cdot \left(y - 1\right)\right) - a \cdot \left(t - 1\right)\right) \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(-a, t - 1, t\_1\right) + \mathsf{fma}\left(-z, y - 1, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b - a, t, \mathsf{fma}\left(-2, b, x\right)\right) + a\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* (- (+ t y) 2.0) b)))
   (if (<= (+ t_1 (- (- x (* z (- y 1.0))) (* a (- t 1.0)))) INFINITY)
     (+ (fma (- a) (- t 1.0) t_1) (fma (- z) (- y 1.0) x))
     (+ (fma (- b a) t (fma -2.0 b x)) a))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = ((t + y) - 2.0) * b;
	double tmp;
	if ((t_1 + ((x - (z * (y - 1.0))) - (a * (t - 1.0)))) <= ((double) INFINITY)) {
		tmp = fma(-a, (t - 1.0), t_1) + fma(-z, (y - 1.0), x);
	} else {
		tmp = fma((b - a), t, fma(-2.0, b, x)) + a;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(Float64(t + y) - 2.0) * b)
	tmp = 0.0
	if (Float64(t_1 + Float64(Float64(x - Float64(z * Float64(y - 1.0))) - Float64(a * Float64(t - 1.0)))) <= Inf)
		tmp = Float64(fma(Float64(-a), Float64(t - 1.0), t_1) + fma(Float64(-z), Float64(y - 1.0), x));
	else
		tmp = Float64(fma(Float64(b - a), t, fma(-2.0, b, x)) + a);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[N[(t$95$1 + N[(N[(x - N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * N[(t - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[((-a) * N[(t - 1.0), $MachinePrecision] + t$95$1), $MachinePrecision] + N[((-z) * N[(y - 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b - a), $MachinePrecision] * t + N[(-2.0 * b + x), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{if}\;t\_1 + \left(\left(x - z \cdot \left(y - 1\right)\right) - a \cdot \left(t - 1\right)\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(-a, t - 1, t\_1\right) + \mathsf{fma}\left(-z, y - 1, x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \mathsf{fma}\left(-2, b, x\right)\right) + a\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (-.f64 (-.f64 x (*.f64 (-.f64 y #s(literal 1 binary64)) z)) (*.f64 (-.f64 t #s(literal 1 binary64)) a)) (*.f64 (-.f64 (+.f64 y t) #s(literal 2 binary64)) b)) < +inf.0

    1. Initial program 100.0%

      \[\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b} \]
      2. lift--.f64N/A

        \[\leadsto \color{blue}{\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right)} + \left(\left(y + t\right) - 2\right) \cdot b \]
      3. sub-negN/A

        \[\leadsto \color{blue}{\left(\left(x - \left(y - 1\right) \cdot z\right) + \left(\mathsf{neg}\left(\left(t - 1\right) \cdot a\right)\right)\right)} + \left(\left(y + t\right) - 2\right) \cdot b \]
      4. associate-+l+N/A

        \[\leadsto \color{blue}{\left(x - \left(y - 1\right) \cdot z\right) + \left(\left(\mathsf{neg}\left(\left(t - 1\right) \cdot a\right)\right) + \left(\left(y + t\right) - 2\right) \cdot b\right)} \]
      5. lower-+.f64N/A

        \[\leadsto \color{blue}{\left(x - \left(y - 1\right) \cdot z\right) + \left(\left(\mathsf{neg}\left(\left(t - 1\right) \cdot a\right)\right) + \left(\left(y + t\right) - 2\right) \cdot b\right)} \]
      6. lift--.f64N/A

        \[\leadsto \color{blue}{\left(x - \left(y - 1\right) \cdot z\right)} + \left(\left(\mathsf{neg}\left(\left(t - 1\right) \cdot a\right)\right) + \left(\left(y + t\right) - 2\right) \cdot b\right) \]
      7. sub-negN/A

        \[\leadsto \color{blue}{\left(x + \left(\mathsf{neg}\left(\left(y - 1\right) \cdot z\right)\right)\right)} + \left(\left(\mathsf{neg}\left(\left(t - 1\right) \cdot a\right)\right) + \left(\left(y + t\right) - 2\right) \cdot b\right) \]
      8. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(y - 1\right) \cdot z\right)\right) + x\right)} + \left(\left(\mathsf{neg}\left(\left(t - 1\right) \cdot a\right)\right) + \left(\left(y + t\right) - 2\right) \cdot b\right) \]
      9. lift-*.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\color{blue}{\left(y - 1\right) \cdot z}\right)\right) + x\right) + \left(\left(\mathsf{neg}\left(\left(t - 1\right) \cdot a\right)\right) + \left(\left(y + t\right) - 2\right) \cdot b\right) \]
      10. *-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\color{blue}{z \cdot \left(y - 1\right)}\right)\right) + x\right) + \left(\left(\mathsf{neg}\left(\left(t - 1\right) \cdot a\right)\right) + \left(\left(y + t\right) - 2\right) \cdot b\right) \]
      11. distribute-lft-neg-inN/A

        \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(y - 1\right)} + x\right) + \left(\left(\mathsf{neg}\left(\left(t - 1\right) \cdot a\right)\right) + \left(\left(y + t\right) - 2\right) \cdot b\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(z\right), y - 1, x\right)} + \left(\left(\mathsf{neg}\left(\left(t - 1\right) \cdot a\right)\right) + \left(\left(y + t\right) - 2\right) \cdot b\right) \]
      13. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(z\right)}, y - 1, x\right) + \left(\left(\mathsf{neg}\left(\left(t - 1\right) \cdot a\right)\right) + \left(\left(y + t\right) - 2\right) \cdot b\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(z\right), y - 1, x\right) + \left(\left(\mathsf{neg}\left(\color{blue}{\left(t - 1\right) \cdot a}\right)\right) + \left(\left(y + t\right) - 2\right) \cdot b\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(z\right), y - 1, x\right) + \left(\left(\mathsf{neg}\left(\color{blue}{a \cdot \left(t - 1\right)}\right)\right) + \left(\left(y + t\right) - 2\right) \cdot b\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(z\right), y - 1, x\right) + \left(\color{blue}{\left(\mathsf{neg}\left(a\right)\right) \cdot \left(t - 1\right)} + \left(\left(y + t\right) - 2\right) \cdot b\right) \]
      17. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(z\right), y - 1, x\right) + \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(a\right), t - 1, \left(\left(y + t\right) - 2\right) \cdot b\right)} \]
      18. lower-neg.f64100.0

        \[\leadsto \mathsf{fma}\left(-z, y - 1, x\right) + \mathsf{fma}\left(\color{blue}{-a}, t - 1, \left(\left(y + t\right) - 2\right) \cdot b\right) \]
      19. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(z\right), y - 1, x\right) + \mathsf{fma}\left(\mathsf{neg}\left(a\right), t - 1, \color{blue}{\left(\left(y + t\right) - 2\right) \cdot b}\right) \]
      20. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(z\right), y - 1, x\right) + \mathsf{fma}\left(\mathsf{neg}\left(a\right), t - 1, \color{blue}{b \cdot \left(\left(y + t\right) - 2\right)}\right) \]
    4. Applied rewrites100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-z, y - 1, x\right) + \mathsf{fma}\left(-a, t - 1, b \cdot \left(\left(t + y\right) - 2\right)\right)} \]

    if +inf.0 < (+.f64 (-.f64 (-.f64 x (*.f64 (-.f64 y #s(literal 1 binary64)) z)) (*.f64 (-.f64 t #s(literal 1 binary64)) a)) (*.f64 (-.f64 (+.f64 y t) #s(literal 2 binary64)) b))

    1. Initial program 0.0%

      \[\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - a \cdot \left(t - 1\right)} \]
    4. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) + \left(\mathsf{neg}\left(a \cdot \left(t - 1\right)\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(a \cdot \left(t - 1\right)\right)\right) + \left(x + b \cdot \left(\left(t + y\right) - 2\right)\right)} \]
      3. *-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(t - 1\right) \cdot a}\right)\right) + \left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
      4. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(t - 1\right)\right)\right) \cdot a} + \left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
      5. mul-1-negN/A

        \[\leadsto \color{blue}{\left(-1 \cdot \left(t - 1\right)\right)} \cdot a + \left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
      6. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1 \cdot \left(t - 1\right), a, x + b \cdot \left(\left(t + y\right) - 2\right)\right)} \]
      7. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(\left(t - 1\right)\right)}, a, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(t + \left(\mathsf{neg}\left(1\right)\right)\right)}\right), a, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\left(t + \color{blue}{-1}\right)\right), a, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(-1 + t\right)}\right), a, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
      11. distribute-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(-1\right)\right) + \left(\mathsf{neg}\left(t\right)\right)}, a, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{1} + \left(\mathsf{neg}\left(t\right)\right), a, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{1 - t}, a, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
      14. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{1 - t}, a, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
      15. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(1 - t, a, \color{blue}{b \cdot \left(\left(t + y\right) - 2\right) + x}\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(1 - t, a, \color{blue}{\left(\left(t + y\right) - 2\right) \cdot b} + x\right) \]
      17. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(1 - t, a, \color{blue}{\mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)}\right) \]
      18. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\color{blue}{\left(y + t\right)} - 2, b, x\right)\right) \]
      19. associate-+r-N/A

        \[\leadsto \mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\color{blue}{y + \left(t - 2\right)}, b, x\right)\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\color{blue}{\left(t - 2\right) + y}, b, x\right)\right) \]
      21. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\color{blue}{\left(t - 2\right) + y}, b, x\right)\right) \]
      22. lower--.f6450.0

        \[\leadsto \mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\color{blue}{\left(t - 2\right)} + y, b, x\right)\right) \]
    5. Applied rewrites50.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\left(t - 2\right) + y, b, x\right)\right)} \]
    6. Taylor expanded in a around 0

      \[\leadsto x + \color{blue}{b \cdot \left(\left(t + y\right) - 2\right)} \]
    7. Step-by-step derivation
      1. Applied rewrites42.2%

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, \color{blue}{b}, x\right) \]
      2. Taylor expanded in t around 0

        \[\leadsto a + \color{blue}{\left(x + \left(b \cdot \left(y - 2\right) + t \cdot \left(b + -1 \cdot a\right)\right)\right)} \]
      3. Step-by-step derivation
        1. Applied rewrites66.7%

          \[\leadsto \mathsf{fma}\left(b - a, t, \mathsf{fma}\left(y - 2, b, x\right)\right) + \color{blue}{a} \]
        2. Taylor expanded in y around 0

          \[\leadsto \mathsf{fma}\left(b - a, t, x + -2 \cdot b\right) + a \]
        3. Step-by-step derivation
          1. Applied rewrites68.2%

            \[\leadsto \mathsf{fma}\left(b - a, t, \mathsf{fma}\left(-2, b, x\right)\right) + a \]
        4. Recombined 2 regimes into one program.
        5. Final simplification98.5%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(t + y\right) - 2\right) \cdot b + \left(\left(x - z \cdot \left(y - 1\right)\right) - a \cdot \left(t - 1\right)\right) \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(-a, t - 1, \left(\left(t + y\right) - 2\right) \cdot b\right) + \mathsf{fma}\left(-z, y - 1, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b - a, t, \mathsf{fma}\left(-2, b, x\right)\right) + a\\ \end{array} \]
        6. Add Preprocessing

        Alternative 2: 33.9% accurate, 0.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(\left(t + y\right) - 2\right) \cdot b + \left(\left(x - z \cdot \left(y - 1\right)\right) - a \cdot \left(t - 1\right)\right)\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;b \cdot t\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+306}:\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;b \cdot y\\ \end{array} \end{array} \]
        (FPCore (x y z t a b)
         :precision binary64
         (let* ((t_1
                 (+ (* (- (+ t y) 2.0) b) (- (- x (* z (- y 1.0))) (* a (- t 1.0))))))
           (if (<= t_1 (- INFINITY)) (* b t) (if (<= t_1 5e+306) (+ z x) (* b y)))))
        double code(double x, double y, double z, double t, double a, double b) {
        	double t_1 = (((t + y) - 2.0) * b) + ((x - (z * (y - 1.0))) - (a * (t - 1.0)));
        	double tmp;
        	if (t_1 <= -((double) INFINITY)) {
        		tmp = b * t;
        	} else if (t_1 <= 5e+306) {
        		tmp = z + x;
        	} else {
        		tmp = b * y;
        	}
        	return tmp;
        }
        
        public static double code(double x, double y, double z, double t, double a, double b) {
        	double t_1 = (((t + y) - 2.0) * b) + ((x - (z * (y - 1.0))) - (a * (t - 1.0)));
        	double tmp;
        	if (t_1 <= -Double.POSITIVE_INFINITY) {
        		tmp = b * t;
        	} else if (t_1 <= 5e+306) {
        		tmp = z + x;
        	} else {
        		tmp = b * y;
        	}
        	return tmp;
        }
        
        def code(x, y, z, t, a, b):
        	t_1 = (((t + y) - 2.0) * b) + ((x - (z * (y - 1.0))) - (a * (t - 1.0)))
        	tmp = 0
        	if t_1 <= -math.inf:
        		tmp = b * t
        	elif t_1 <= 5e+306:
        		tmp = z + x
        	else:
        		tmp = b * y
        	return tmp
        
        function code(x, y, z, t, a, b)
        	t_1 = Float64(Float64(Float64(Float64(t + y) - 2.0) * b) + Float64(Float64(x - Float64(z * Float64(y - 1.0))) - Float64(a * Float64(t - 1.0))))
        	tmp = 0.0
        	if (t_1 <= Float64(-Inf))
        		tmp = Float64(b * t);
        	elseif (t_1 <= 5e+306)
        		tmp = Float64(z + x);
        	else
        		tmp = Float64(b * y);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z, t, a, b)
        	t_1 = (((t + y) - 2.0) * b) + ((x - (z * (y - 1.0))) - (a * (t - 1.0)));
        	tmp = 0.0;
        	if (t_1 <= -Inf)
        		tmp = b * t;
        	elseif (t_1 <= 5e+306)
        		tmp = z + x;
        	else
        		tmp = b * y;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision] + N[(N[(x - N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * N[(t - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(b * t), $MachinePrecision], If[LessEqual[t$95$1, 5e+306], N[(z + x), $MachinePrecision], N[(b * y), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \left(\left(t + y\right) - 2\right) \cdot b + \left(\left(x - z \cdot \left(y - 1\right)\right) - a \cdot \left(t - 1\right)\right)\\
        \mathbf{if}\;t\_1 \leq -\infty:\\
        \;\;\;\;b \cdot t\\
        
        \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+306}:\\
        \;\;\;\;z + x\\
        
        \mathbf{else}:\\
        \;\;\;\;b \cdot y\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (+.f64 (-.f64 (-.f64 x (*.f64 (-.f64 y #s(literal 1 binary64)) z)) (*.f64 (-.f64 t #s(literal 1 binary64)) a)) (*.f64 (-.f64 (+.f64 y t) #s(literal 2 binary64)) b)) < -inf.0

          1. Initial program 100.0%

            \[\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
          2. Add Preprocessing
          3. Taylor expanded in t around inf

            \[\leadsto \color{blue}{t \cdot \left(b - a\right)} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \color{blue}{\left(b - a\right) \cdot t} \]
            2. lower-*.f64N/A

              \[\leadsto \color{blue}{\left(b - a\right) \cdot t} \]
            3. lower--.f6454.0

              \[\leadsto \color{blue}{\left(b - a\right)} \cdot t \]
          5. Applied rewrites54.0%

            \[\leadsto \color{blue}{\left(b - a\right) \cdot t} \]
          6. Taylor expanded in b around inf

            \[\leadsto b \cdot \color{blue}{t} \]
          7. Step-by-step derivation
            1. Applied rewrites29.3%

              \[\leadsto b \cdot \color{blue}{t} \]

            if -inf.0 < (+.f64 (-.f64 (-.f64 x (*.f64 (-.f64 y #s(literal 1 binary64)) z)) (*.f64 (-.f64 t #s(literal 1 binary64)) a)) (*.f64 (-.f64 (+.f64 y t) #s(literal 2 binary64)) b)) < 4.99999999999999993e306

            1. Initial program 100.0%

              \[\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
            2. Add Preprocessing
            3. Taylor expanded in t around inf

              \[\leadsto \color{blue}{t \cdot \left(b - a\right)} \]
            4. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto \color{blue}{\left(b - a\right) \cdot t} \]
              2. lower-*.f64N/A

                \[\leadsto \color{blue}{\left(b - a\right) \cdot t} \]
              3. lower--.f6421.0

                \[\leadsto \color{blue}{\left(b - a\right)} \cdot t \]
            5. Applied rewrites21.0%

              \[\leadsto \color{blue}{\left(b - a\right) \cdot t} \]
            6. Taylor expanded in a around 0

              \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
            7. Step-by-step derivation
              1. sub-negN/A

                \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) + \left(\mathsf{neg}\left(z \cdot \left(y - 1\right)\right)\right)} \]
              2. mul-1-negN/A

                \[\leadsto \left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) + \color{blue}{-1 \cdot \left(z \cdot \left(y - 1\right)\right)} \]
              3. +-commutativeN/A

                \[\leadsto \color{blue}{-1 \cdot \left(z \cdot \left(y - 1\right)\right) + \left(x + b \cdot \left(\left(t + y\right) - 2\right)\right)} \]
              4. *-commutativeN/A

                \[\leadsto -1 \cdot \color{blue}{\left(\left(y - 1\right) \cdot z\right)} + \left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
              5. associate-*r*N/A

                \[\leadsto \color{blue}{\left(-1 \cdot \left(y - 1\right)\right) \cdot z} + \left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
              6. lower-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(-1 \cdot \left(y - 1\right), z, x + b \cdot \left(\left(t + y\right) - 2\right)\right)} \]
              7. sub-negN/A

                \[\leadsto \mathsf{fma}\left(-1 \cdot \color{blue}{\left(y + \left(\mathsf{neg}\left(1\right)\right)\right)}, z, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
              8. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(-1 \cdot \left(y + \color{blue}{-1}\right), z, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
              9. distribute-lft-inN/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{-1 \cdot y + -1 \cdot -1}, z, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
              10. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(-1 \cdot y + \color{blue}{1}, z, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
              11. +-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{1 + -1 \cdot y}, z, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
              12. neg-mul-1N/A

                \[\leadsto \mathsf{fma}\left(1 + \color{blue}{\left(\mathsf{neg}\left(y\right)\right)}, z, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
              13. sub-negN/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{1 - y}, z, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
              14. lower--.f64N/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{1 - y}, z, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
              15. +-commutativeN/A

                \[\leadsto \mathsf{fma}\left(1 - y, z, \color{blue}{b \cdot \left(\left(t + y\right) - 2\right) + x}\right) \]
              16. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(1 - y, z, \color{blue}{\left(\left(t + y\right) - 2\right) \cdot b} + x\right) \]
              17. lower-fma.f64N/A

                \[\leadsto \mathsf{fma}\left(1 - y, z, \color{blue}{\mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)}\right) \]
              18. lower--.f64N/A

                \[\leadsto \mathsf{fma}\left(1 - y, z, \mathsf{fma}\left(\color{blue}{\left(t + y\right) - 2}, b, x\right)\right) \]
              19. +-commutativeN/A

                \[\leadsto \mathsf{fma}\left(1 - y, z, \mathsf{fma}\left(\color{blue}{\left(y + t\right)} - 2, b, x\right)\right) \]
              20. lower-+.f6473.9

                \[\leadsto \mathsf{fma}\left(1 - y, z, \mathsf{fma}\left(\color{blue}{\left(y + t\right)} - 2, b, x\right)\right) \]
            8. Applied rewrites73.9%

              \[\leadsto \color{blue}{\mathsf{fma}\left(1 - y, z, \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right)\right)} \]
            9. Taylor expanded in b around 0

              \[\leadsto x + \color{blue}{z \cdot \left(1 - y\right)} \]
            10. Step-by-step derivation
              1. Applied rewrites47.2%

                \[\leadsto \mathsf{fma}\left(1 - y, \color{blue}{z}, x\right) \]
              2. Taylor expanded in y around 0

                \[\leadsto x + z \]
              3. Step-by-step derivation
                1. Applied rewrites36.0%

                  \[\leadsto x + z \]

                if 4.99999999999999993e306 < (+.f64 (-.f64 (-.f64 x (*.f64 (-.f64 y #s(literal 1 binary64)) z)) (*.f64 (-.f64 t #s(literal 1 binary64)) a)) (*.f64 (-.f64 (+.f64 y t) #s(literal 2 binary64)) b))

                1. Initial program 77.7%

                  \[\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
                2. Add Preprocessing
                3. Taylor expanded in z around 0

                  \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - a \cdot \left(t - 1\right)} \]
                4. Step-by-step derivation
                  1. sub-negN/A

                    \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) + \left(\mathsf{neg}\left(a \cdot \left(t - 1\right)\right)\right)} \]
                  2. +-commutativeN/A

                    \[\leadsto \color{blue}{\left(\mathsf{neg}\left(a \cdot \left(t - 1\right)\right)\right) + \left(x + b \cdot \left(\left(t + y\right) - 2\right)\right)} \]
                  3. *-commutativeN/A

                    \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(t - 1\right) \cdot a}\right)\right) + \left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
                  4. distribute-lft-neg-inN/A

                    \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(t - 1\right)\right)\right) \cdot a} + \left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
                  5. mul-1-negN/A

                    \[\leadsto \color{blue}{\left(-1 \cdot \left(t - 1\right)\right)} \cdot a + \left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
                  6. lower-fma.f64N/A

                    \[\leadsto \color{blue}{\mathsf{fma}\left(-1 \cdot \left(t - 1\right), a, x + b \cdot \left(\left(t + y\right) - 2\right)\right)} \]
                  7. mul-1-negN/A

                    \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(\left(t - 1\right)\right)}, a, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
                  8. sub-negN/A

                    \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(t + \left(\mathsf{neg}\left(1\right)\right)\right)}\right), a, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
                  9. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\left(t + \color{blue}{-1}\right)\right), a, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
                  10. +-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(-1 + t\right)}\right), a, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
                  11. distribute-neg-inN/A

                    \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(-1\right)\right) + \left(\mathsf{neg}\left(t\right)\right)}, a, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
                  12. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(\color{blue}{1} + \left(\mathsf{neg}\left(t\right)\right), a, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
                  13. sub-negN/A

                    \[\leadsto \mathsf{fma}\left(\color{blue}{1 - t}, a, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
                  14. lower--.f64N/A

                    \[\leadsto \mathsf{fma}\left(\color{blue}{1 - t}, a, x + b \cdot \left(\left(t + y\right) - 2\right)\right) \]
                  15. +-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(1 - t, a, \color{blue}{b \cdot \left(\left(t + y\right) - 2\right) + x}\right) \]
                  16. *-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(1 - t, a, \color{blue}{\left(\left(t + y\right) - 2\right) \cdot b} + x\right) \]
                  17. lower-fma.f64N/A

                    \[\leadsto \mathsf{fma}\left(1 - t, a, \color{blue}{\mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)}\right) \]
                  18. +-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\color{blue}{\left(y + t\right)} - 2, b, x\right)\right) \]
                  19. associate-+r-N/A

                    \[\leadsto \mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\color{blue}{y + \left(t - 2\right)}, b, x\right)\right) \]
                  20. +-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\color{blue}{\left(t - 2\right) + y}, b, x\right)\right) \]
                  21. lower-+.f64N/A

                    \[\leadsto \mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\color{blue}{\left(t - 2\right) + y}, b, x\right)\right) \]
                  22. lower--.f6471.7

                    \[\leadsto \mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\color{blue}{\left(t - 2\right)} + y, b, x\right)\right) \]
                5. Applied rewrites71.7%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\left(t - 2\right) + y, b, x\right)\right)} \]
                6. Taylor expanded in y around inf

                  \[\leadsto b \cdot \color{blue}{y} \]
                7. Step-by-step derivation
                  1. Applied rewrites30.7%

                    \[\leadsto y \cdot \color{blue}{b} \]
                8. Recombined 3 regimes into one program.
                9. Final simplification33.9%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(t + y\right) - 2\right) \cdot b + \left(\left(x - z \cdot \left(y - 1\right)\right) - a \cdot \left(t - 1\right)\right) \leq -\infty:\\ \;\;\;\;b \cdot t\\ \mathbf{elif}\;\left(\left(t + y\right) - 2\right) \cdot b + \left(\left(x - z \cdot \left(y - 1\right)\right) - a \cdot \left(t - 1\right)\right) \leq 5 \cdot 10^{+306}:\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;b \cdot y\\ \end{array} \]
                10. Add Preprocessing

                Reproduce

                ?
                herbie shell --seed 2024230 
                (FPCore (x y z t a b)
                  :name "Statistics.Distribution.Beta:$centropy from math-functions-0.1.5.2"
                  :precision binary64
                  (+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))