?

Average Error: 1.9 → 2.2
Time: 28.0s
Precision: binary64
Cost: 26692

?

\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y} \]
\[\begin{array}{l} \mathbf{if}\;\left(t - 1\right) \cdot \log a \leq -670:\\ \;\;\;\;x \cdot \frac{\frac{{a}^{t}}{a}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot e^{\left(y \cdot \log z - \log a\right) - b}}{y}\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))
(FPCore (x y z t a b)
 :precision binary64
 (if (<= (* (- t 1.0) (log a)) -670.0)
   (* x (/ (/ (pow a t) a) y))
   (/ (* x (exp (- (- (* y (log z)) (log a)) b))) y)))
double code(double x, double y, double z, double t, double a, double b) {
	return (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
}
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (((t - 1.0) * log(a)) <= -670.0) {
		tmp = x * ((pow(a, t) / a) / y);
	} else {
		tmp = (x * exp((((y * log(z)) - log(a)) - b))) / y;
	}
	return tmp;
}
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 * exp((((y * log(z)) + ((t - 1.0d0) * log(a))) - b))) / y
end function
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
    real(8) :: tmp
    if (((t - 1.0d0) * log(a)) <= (-670.0d0)) then
        tmp = x * (((a ** t) / a) / y)
    else
        tmp = (x * exp((((y * log(z)) - log(a)) - b))) / y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return (x * Math.exp((((y * Math.log(z)) + ((t - 1.0) * Math.log(a))) - b))) / y;
}
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (((t - 1.0) * Math.log(a)) <= -670.0) {
		tmp = x * ((Math.pow(a, t) / a) / y);
	} else {
		tmp = (x * Math.exp((((y * Math.log(z)) - Math.log(a)) - b))) / y;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	return (x * math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))) / y
def code(x, y, z, t, a, b):
	tmp = 0
	if ((t - 1.0) * math.log(a)) <= -670.0:
		tmp = x * ((math.pow(a, t) / a) / y)
	else:
		tmp = (x * math.exp((((y * math.log(z)) - math.log(a)) - b))) / y
	return tmp
function code(x, y, z, t, a, b)
	return Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b))) / y)
end
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (Float64(Float64(t - 1.0) * log(a)) <= -670.0)
		tmp = Float64(x * Float64(Float64((a ^ t) / a) / y));
	else
		tmp = Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) - log(a)) - b))) / y);
	end
	return tmp
end
function tmp = code(x, y, z, t, a, b)
	tmp = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (((t - 1.0) * log(a)) <= -670.0)
		tmp = x * (((a ^ t) / a) / y);
	else
		tmp = (x * exp((((y * log(z)) - log(a)) - b))) / y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[Exp[N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision], -670.0], N[(x * N[(N[(N[Power[a, t], $MachinePrecision] / a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[Exp[N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] - N[Log[a], $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\begin{array}{l}
\mathbf{if}\;\left(t - 1\right) \cdot \log a \leq -670:\\
\;\;\;\;x \cdot \frac{\frac{{a}^{t}}{a}}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot e^{\left(y \cdot \log z - \log a\right) - b}}{y}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original1.9
Target11.4
Herbie2.2
\[\begin{array}{l} \mathbf{if}\;t < -0.8845848504127471:\\ \;\;\;\;\frac{x \cdot \frac{{a}^{\left(t - 1\right)}}{y}}{\left(b + 1\right) - y \cdot \log z}\\ \mathbf{elif}\;t < 852031.2288374073:\\ \;\;\;\;\frac{\frac{x}{y} \cdot {a}^{\left(t - 1\right)}}{e^{b - \log z \cdot y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{{a}^{\left(t - 1\right)}}{y}}{\left(b + 1\right) - y \cdot \log z}\\ \end{array} \]

Derivation?

  1. Split input into 2 regimes
  2. if (*.f64 (-.f64 t 1) (log.f64 a)) < -670

    1. Initial program 0.3

      \[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y} \]
    2. Simplified25.2

      \[\leadsto \color{blue}{\left(\frac{{a}^{t}}{a} \cdot \frac{{z}^{y}}{e^{b}}\right) \cdot \frac{x}{y}} \]
      Proof

      [Start]0.3

      \[ \frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y} \]

      associate-*l/ [<=]9.1

      \[ \color{blue}{\frac{x}{y} \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}} \]

      *-commutative [=>]9.1

      \[ \color{blue}{e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b} \cdot \frac{x}{y}} \]
    3. Taylor expanded in y around 0 13.8

      \[\leadsto \color{blue}{\frac{{a}^{t} \cdot x}{y \cdot \left(a \cdot e^{b}\right)}} \]
    4. Taylor expanded in b around 0 8.2

      \[\leadsto \color{blue}{\frac{{a}^{t} \cdot x}{y \cdot a}} \]
    5. Simplified14.5

      \[\leadsto \color{blue}{\frac{{a}^{t}}{\frac{a}{\frac{x}{y}}}} \]
      Proof

      [Start]8.2

      \[ \frac{{a}^{t} \cdot x}{y \cdot a} \]

      *-commutative [<=]8.2

      \[ \frac{{a}^{t} \cdot x}{\color{blue}{a \cdot y}} \]

      associate-/l* [=>]13.5

      \[ \color{blue}{\frac{{a}^{t}}{\frac{a \cdot y}{x}}} \]

      associate-/l* [=>]14.5

      \[ \frac{{a}^{t}}{\color{blue}{\frac{a}{\frac{x}{y}}}} \]
    6. Applied egg-rr0.4

      \[\leadsto \color{blue}{\frac{\frac{{a}^{t}}{a}}{y} \cdot x} \]

    if -670 < (*.f64 (-.f64 t 1) (log.f64 a))

    1. Initial program 3.1

      \[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y} \]
    2. Taylor expanded in t around 0 3.5

      \[\leadsto \frac{x \cdot e^{\left(y \cdot \log z + \color{blue}{-1 \cdot \log a}\right) - b}}{y} \]
    3. Simplified3.5

      \[\leadsto \frac{x \cdot e^{\left(y \cdot \log z + \color{blue}{\left(-\log a\right)}\right) - b}}{y} \]
      Proof

      [Start]3.5

      \[ \frac{x \cdot e^{\left(y \cdot \log z + -1 \cdot \log a\right) - b}}{y} \]

      mul-1-neg [=>]3.5

      \[ \frac{x \cdot e^{\left(y \cdot \log z + \color{blue}{\left(-\log a\right)}\right) - b}}{y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(t - 1\right) \cdot \log a \leq -670:\\ \;\;\;\;x \cdot \frac{\frac{{a}^{t}}{a}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot e^{\left(y \cdot \log z - \log a\right) - b}}{y}\\ \end{array} \]

Alternatives

Alternative 1
Error7.1
Cost33805
\[\begin{array}{l} t_1 := \frac{{a}^{t}}{a}\\ t_2 := \left(t - 1\right) \cdot \log a\\ \mathbf{if}\;t_2 \leq -670:\\ \;\;\;\;x \cdot \frac{t_1}{y}\\ \mathbf{elif}\;t_2 \leq -1 \lor \neg \left(t_2 \leq 283\right):\\ \;\;\;\;x \cdot \frac{{z}^{y}}{y \cdot \left(a \cdot e^{b}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \frac{x}{y \cdot e^{b}}\\ \end{array} \]
Alternative 2
Error1.9
Cost20160
\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y} \]
Alternative 3
Error11.1
Cost13704
\[\begin{array}{l} t_1 := y \cdot \left(a \cdot e^{b}\right)\\ \mathbf{if}\;b \leq 1.52 \cdot 10^{-118}:\\ \;\;\;\;\frac{x \cdot {a}^{\left(t - 1\right)}}{y}\\ \mathbf{elif}\;b \leq 3.3 \cdot 10^{-32}:\\ \;\;\;\;x \cdot \frac{{z}^{y}}{t_1}\\ \mathbf{elif}\;b \leq 95:\\ \;\;\;\;x \cdot \frac{\frac{{a}^{t}}{a}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t_1}\\ \end{array} \]
Alternative 4
Error22.0
Cost7244
\[\begin{array}{l} \mathbf{if}\;b \leq -2.05 \cdot 10^{-13}:\\ \;\;\;\;\frac{x}{y \cdot \left(a + a \cdot b\right)}\\ \mathbf{elif}\;b \leq -1.05 \cdot 10^{-183}:\\ \;\;\;\;{\left(\frac{y}{\frac{x}{a}}\right)}^{-1}\\ \mathbf{elif}\;b \leq 1.9 \cdot 10^{-193}:\\ \;\;\;\;\frac{\frac{b}{a}}{y} \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(a \cdot e^{b}\right)}\\ \end{array} \]
Alternative 5
Error35.1
Cost7048
\[\begin{array}{l} t_1 := \frac{x}{y \cdot \left(a + a \cdot b\right)}\\ \mathbf{if}\;b \leq -8.8 \cdot 10^{-13}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq -2.3 \cdot 10^{-189}:\\ \;\;\;\;{\left(\frac{y}{\frac{x}{a}}\right)}^{-1}\\ \mathbf{elif}\;b \leq 1.04 \cdot 10^{-203}:\\ \;\;\;\;\frac{\frac{b}{a}}{y} \cdot \left(-x\right)\\ \mathbf{elif}\;b \leq 9.8 \cdot 10^{+17}:\\ \;\;\;\;\frac{1}{a} \cdot \frac{1}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error10.2
Cost7044
\[\begin{array}{l} \mathbf{if}\;b \leq 350:\\ \;\;\;\;x \cdot \frac{\frac{{a}^{t}}{a}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(a \cdot e^{b}\right)}\\ \end{array} \]
Alternative 7
Error10.9
Cost7044
\[\begin{array}{l} \mathbf{if}\;b \leq 165:\\ \;\;\;\;\frac{x \cdot {a}^{\left(t - 1\right)}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(a \cdot e^{b}\right)}\\ \end{array} \]
Alternative 8
Error40.1
Cost1041
\[\begin{array}{l} t_1 := \frac{b}{a} \cdot \frac{-x}{y}\\ \mathbf{if}\;y \leq -205000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 125000:\\ \;\;\;\;\frac{\frac{1}{\frac{a}{x}}}{y}\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+153} \lor \neg \left(y \leq 4.3 \cdot 10^{+225}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot a}\\ \end{array} \]
Alternative 9
Error39.9
Cost777
\[\begin{array}{l} \mathbf{if}\;y \leq -24500000000000 \lor \neg \left(y \leq 31000\right):\\ \;\;\;\;\frac{x \cdot \left(-b\right)}{y \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\frac{a}{x}}}{y}\\ \end{array} \]
Alternative 10
Error39.4
Cost776
\[\begin{array}{l} \mathbf{if}\;x \leq -6.4 \cdot 10^{-13}:\\ \;\;\;\;x \cdot \frac{1}{y \cdot a}\\ \mathbf{elif}\;x \leq -4.2 \cdot 10^{-60}:\\ \;\;\;\;\frac{\frac{b}{a}}{y} \cdot \left(-x\right)\\ \mathbf{elif}\;x \leq 1.85 \cdot 10^{-62}:\\ \;\;\;\;\frac{\frac{x}{y}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot a}\\ \end{array} \]
Alternative 11
Error33.1
Cost708
\[\begin{array}{l} \mathbf{if}\;a \leq 2.5 \cdot 10^{-70}:\\ \;\;\;\;\frac{1}{a} \cdot \frac{1}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(a + a \cdot b\right)}\\ \end{array} \]
Alternative 12
Error41.7
Cost452
\[\begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{-78}:\\ \;\;\;\;\frac{x}{y \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{a}}{y}\\ \end{array} \]
Alternative 13
Error39.1
Cost452
\[\begin{array}{l} \mathbf{if}\;a \leq 10^{-68}:\\ \;\;\;\;\frac{\frac{x}{y}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot a}\\ \end{array} \]
Alternative 14
Error42.1
Cost320
\[\frac{x}{y \cdot a} \]

Error

Reproduce?

herbie shell --seed 2023031 
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:incompleteBetaWorker from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (if (< t -0.8845848504127471) (/ (* x (/ (pow a (- t 1.0)) y)) (- (+ b 1.0) (* y (log z)))) (if (< t 852031.2288374073) (/ (* (/ x y) (pow a (- t 1.0))) (exp (- b (* (log z) y)))) (/ (* x (/ (pow a (- t 1.0)) y)) (- (+ b 1.0) (* y (log z))))))

  (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))