?

Average Error: 2.86% → 4.04%
Time: 26.4s
Precision: binary64
Cost: 33736

?

\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y} \]
\[\begin{array}{l} t_1 := \left(t + -1\right) \cdot \log a\\ \mathbf{if}\;t_1 \leq -10000000:\\ \;\;\;\;\frac{\frac{{a}^{t}}{a}}{y} \cdot x\\ \mathbf{elif}\;t_1 \leq -195:\\ \;\;\;\;\frac{x}{y \cdot \left(a + a \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot e^{\left(t_1 + y \cdot \log z\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
 (let* ((t_1 (* (+ t -1.0) (log a))))
   (if (<= t_1 -10000000.0)
     (* (/ (/ (pow a t) a) y) x)
     (if (<= t_1 -195.0)
       (/ x (* y (+ a (* a b))))
       (/ (* x (exp (- (+ t_1 (* y (log z))) 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 t_1 = (t + -1.0) * log(a);
	double tmp;
	if (t_1 <= -10000000.0) {
		tmp = ((pow(a, t) / a) / y) * x;
	} else if (t_1 <= -195.0) {
		tmp = x / (y * (a + (a * b)));
	} else {
		tmp = (x * exp(((t_1 + (y * log(z))) - 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) :: t_1
    real(8) :: tmp
    t_1 = (t + (-1.0d0)) * log(a)
    if (t_1 <= (-10000000.0d0)) then
        tmp = (((a ** t) / a) / y) * x
    else if (t_1 <= (-195.0d0)) then
        tmp = x / (y * (a + (a * b)))
    else
        tmp = (x * exp(((t_1 + (y * log(z))) - 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 t_1 = (t + -1.0) * Math.log(a);
	double tmp;
	if (t_1 <= -10000000.0) {
		tmp = ((Math.pow(a, t) / a) / y) * x;
	} else if (t_1 <= -195.0) {
		tmp = x / (y * (a + (a * b)));
	} else {
		tmp = (x * Math.exp(((t_1 + (y * Math.log(z))) - 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):
	t_1 = (t + -1.0) * math.log(a)
	tmp = 0
	if t_1 <= -10000000.0:
		tmp = ((math.pow(a, t) / a) / y) * x
	elif t_1 <= -195.0:
		tmp = x / (y * (a + (a * b)))
	else:
		tmp = (x * math.exp(((t_1 + (y * math.log(z))) - 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)
	t_1 = Float64(Float64(t + -1.0) * log(a))
	tmp = 0.0
	if (t_1 <= -10000000.0)
		tmp = Float64(Float64(Float64((a ^ t) / a) / y) * x);
	elseif (t_1 <= -195.0)
		tmp = Float64(x / Float64(y * Float64(a + Float64(a * b))));
	else
		tmp = Float64(Float64(x * exp(Float64(Float64(t_1 + Float64(y * log(z))) - 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)
	t_1 = (t + -1.0) * log(a);
	tmp = 0.0;
	if (t_1 <= -10000000.0)
		tmp = (((a ^ t) / a) / y) * x;
	elseif (t_1 <= -195.0)
		tmp = x / (y * (a + (a * b)));
	else
		tmp = (x * exp(((t_1 + (y * log(z))) - 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_] := Block[{t$95$1 = N[(N[(t + -1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -10000000.0], N[(N[(N[(N[Power[a, t], $MachinePrecision] / a), $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$1, -195.0], N[(x / N[(y * N[(a + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[Exp[N[(N[(t$95$1 + N[(y * N[Log[z], $MachinePrecision]), $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}
t_1 := \left(t + -1\right) \cdot \log a\\
\mathbf{if}\;t_1 \leq -10000000:\\
\;\;\;\;\frac{\frac{{a}^{t}}{a}}{y} \cdot x\\

\mathbf{elif}\;t_1 \leq -195:\\
\;\;\;\;\frac{x}{y \cdot \left(a + a \cdot b\right)}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.86%
Target17.47%
Herbie4.04%
\[\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 3 regimes
  2. if (*.f64 (-.f64 t 1) (log.f64 a)) < -1e7

    1. Initial program 0

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

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

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

      [Start]1.06

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

      exp-sum [=>]16.56

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

      *-commutative [=>]16.56

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

      log-pow [<=]16.56

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

      sub-neg [=>]16.56

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

      metadata-eval [=>]16.56

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

      rem-exp-log [=>]16.56

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

      log-pow [<=]16.56

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

      rem-exp-log [=>]16.56

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

      \[\leadsto \color{blue}{\frac{{a}^{\left(t - 1\right)} \cdot x}{y}} \]
    5. Applied egg-rr0

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

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

    1. Initial program 9.78

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

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

      [Start]9.78

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

      associate-*l/ [<=]16.97

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

      *-commutative [=>]16.97

      \[ \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 10.54

      \[\leadsto \color{blue}{\frac{{a}^{t} \cdot x}{y \cdot \left(a \cdot e^{b}\right)}} \]
    4. Simplified21.67

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

      [Start]10.54

      \[ \frac{{a}^{t} \cdot x}{y \cdot \left(a \cdot e^{b}\right)} \]

      times-frac [=>]21.67

      \[ \color{blue}{\frac{{a}^{t}}{y} \cdot \frac{x}{a \cdot e^{b}}} \]
    5. Taylor expanded in b around 0 23.89

      \[\leadsto \frac{{a}^{t}}{y} \cdot \frac{x}{\color{blue}{a \cdot b + a}} \]
    6. Taylor expanded in t around 0 15.25

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(a \cdot b + a\right)}} \]

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

    1. Initial program 1.85

      \[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification4.04

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

Alternatives

Alternative 1
Error4.24%
Cost33480
\[\begin{array}{l} t_1 := \left(t + -1\right) \cdot \log a\\ \mathbf{if}\;t_1 \leq -10000000:\\ \;\;\;\;\frac{\frac{{a}^{t}}{a}}{y} \cdot x\\ \mathbf{elif}\;t_1 \leq -195:\\ \;\;\;\;\frac{x}{y \cdot \left(a + a \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot e^{\left(y \cdot \log z - \log a\right) - b}}{y}\\ \end{array} \]
Alternative 2
Error11.27%
Cost27016
\[\begin{array}{l} t_1 := \left(t + -1\right) \cdot \log a\\ \mathbf{if}\;t_1 \leq -10000000:\\ \;\;\;\;\frac{\frac{{a}^{t}}{a}}{y} \cdot x\\ \mathbf{elif}\;t_1 \leq -197.6:\\ \;\;\;\;\frac{x}{y \cdot \left(a + a \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{{z}^{y}}{a \cdot \left(y \cdot e^{b}\right)}\\ \end{array} \]
Alternative 3
Error17.41%
Cost7572
\[\begin{array}{l} t_1 := x \cdot \frac{{z}^{y}}{a \cdot y}\\ t_2 := \frac{\frac{{a}^{t}}{a}}{y} \cdot x\\ \mathbf{if}\;b \leq -5.8 \cdot 10^{-41}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \leq -1.5 \cdot 10^{-146}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq -5.5 \cdot 10^{-270}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \leq 1.4 \cdot 10^{-230}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 22:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(a \cdot e^{b}\right)}\\ \end{array} \]
Alternative 4
Error18.16%
Cost7572
\[\begin{array}{l} t_1 := x \cdot \frac{{z}^{y}}{a \cdot y}\\ t_2 := \frac{\frac{{a}^{t}}{a}}{y} \cdot x\\ \mathbf{if}\;b \leq -2.9 \cdot 10^{-41}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \leq -5 \cdot 10^{-160}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq -5.2 \cdot 10^{-279}:\\ \;\;\;\;\frac{{a}^{t}}{y} \cdot \frac{x}{a}\\ \mathbf{elif}\;b \leq 2.65 \cdot 10^{-230}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 18:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(a \cdot e^{b}\right)}\\ \end{array} \]
Alternative 5
Error17.43%
Cost7572
\[\begin{array}{l} t_1 := x \cdot \frac{{z}^{y}}{a \cdot y}\\ t_2 := \frac{{a}^{t}}{a}\\ t_3 := \frac{t_2}{y} \cdot x\\ \mathbf{if}\;b \leq -8.2 \cdot 10^{-44}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;b \leq -6.5 \cdot 10^{-147}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq -7 \cdot 10^{-281}:\\ \;\;\;\;\frac{t_2 \cdot x}{y}\\ \mathbf{elif}\;b \leq 2.8 \cdot 10^{-226}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 16:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(a \cdot e^{b}\right)}\\ \end{array} \]
Alternative 6
Error21.07%
Cost7044
\[\begin{array}{l} \mathbf{if}\;b \leq 230:\\ \;\;\;\;x \cdot \frac{{z}^{y}}{a \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(a \cdot e^{b}\right)}\\ \end{array} \]
Alternative 7
Error33.18%
Cost6980
\[\begin{array}{l} \mathbf{if}\;b \leq -230:\\ \;\;\;\;\frac{x}{y \cdot \left(a + a \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(a \cdot e^{b}\right)}\\ \end{array} \]
Alternative 8
Error53.12%
Cost969
\[\begin{array}{l} t_1 := a + a \cdot b\\ \mathbf{if}\;y \leq -2 \cdot 10^{-239} \lor \neg \left(y \leq 7.5 \cdot 10^{-255}\right):\\ \;\;\;\;\frac{x}{y \cdot t_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{x}{t_1}\\ \end{array} \]
Alternative 9
Error60.98%
Cost840
\[\begin{array}{l} \mathbf{if}\;x \leq -2.5 \cdot 10^{-71}:\\ \;\;\;\;x \cdot \frac{\frac{1}{a}}{y}\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-56}:\\ \;\;\;\;\frac{1}{a} \cdot \frac{1}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot y}\\ \end{array} \]
Alternative 10
Error51.09%
Cost708
\[\begin{array}{l} \mathbf{if}\;a \leq 3.2 \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 11
Error61.14%
Cost585
\[\begin{array}{l} \mathbf{if}\;x \leq -7.4 \cdot 10^{-72} \lor \neg \left(x \leq 10^{-59}\right):\\ \;\;\;\;\frac{x}{a \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{a}\\ \end{array} \]
Alternative 12
Error61.41%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -2.5 \cdot 10^{-71}:\\ \;\;\;\;x \cdot \frac{\frac{1}{a}}{y}\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-52}:\\ \;\;\;\;\frac{\frac{x}{y}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot y}\\ \end{array} \]
Alternative 13
Error64.35%
Cost452
\[\begin{array}{l} \mathbf{if}\;a \leq 1.75 \cdot 10^{+90}:\\ \;\;\;\;\frac{\frac{x}{a}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot y}\\ \end{array} \]
Alternative 14
Error65.87%
Cost320
\[\frac{x}{a \cdot y} \]

Error

Reproduce?

herbie shell --seed 2023090 
(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))