
(FPCore (x y z t a b) :precision binary64 (/ (* 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) {
return (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
}
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
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;
}
def code(x, y, z, t, a, b): return (x * math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))) / y
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 tmp = code(x, y, z, t, a, b) tmp = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y; 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]
\begin{array}{l}
\\
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (* 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) {
return (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
}
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
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;
}
def code(x, y, z, t, a, b): return (x * math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))) / y
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 tmp = code(x, y, z, t, a, b) tmp = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y; 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]
\begin{array}{l}
\\
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \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))
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;
}
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
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;
}
def code(x, y, z, t, a, b): return (x * math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))) / y
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 tmp = code(x, y, z, t, a, b) tmp = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y; 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]
\begin{array}{l}
\\
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\end{array}
Initial program 98.3%
(FPCore (x y z t a b)
:precision binary64
(if (<=
(/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y)
2e+147)
(exp (- t 1.0))
(exp (exp (log a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y) <= 2e+147) {
tmp = exp((t - 1.0));
} else {
tmp = exp(exp(log(a)));
}
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
real(8) :: tmp
if (((x * exp((((y * log(z)) + ((t - 1.0d0) * log(a))) - b))) / y) <= 2d+147) then
tmp = exp((t - 1.0d0))
else
tmp = exp(exp(log(a)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * Math.exp((((y * Math.log(z)) + ((t - 1.0) * Math.log(a))) - b))) / y) <= 2e+147) {
tmp = Math.exp((t - 1.0));
} else {
tmp = Math.exp(Math.exp(Math.log(a)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))) / y) <= 2e+147: tmp = math.exp((t - 1.0)) else: tmp = math.exp(math.exp(math.log(a))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b))) / y) <= 2e+147) tmp = exp(Float64(t - 1.0)); else tmp = exp(exp(log(a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y) <= 2e+147) tmp = exp((t - 1.0)); else tmp = exp(exp(log(a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[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], 2e+147], N[Exp[N[(t - 1.0), $MachinePrecision]], $MachinePrecision], N[Exp[N[Exp[N[Log[a], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y} \leq 2 \cdot 10^{+147}:\\
\;\;\;\;e^{t - 1}\\
\mathbf{else}:\\
\;\;\;\;e^{e^{\log a}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < 2e147Initial program 98.0%
Taylor expanded in y around 0
Applied rewrites59.6%
Taylor expanded in y around 0
Applied rewrites23.1%
if 2e147 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) Initial program 99.5%
Taylor expanded in y around 0
Applied rewrites90.2%
Taylor expanded in y around 0
Applied rewrites90.2%
Taylor expanded in y around 0
Applied rewrites49.0%
(FPCore (x y z t a b) :precision binary64 (if (<= (* (- t 1.0) (log a)) -2e+36) (exp (- t 1.0)) (exp (- (exp (log a)) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((t - 1.0) * log(a)) <= -2e+36) {
tmp = exp((t - 1.0));
} else {
tmp = exp((exp(log(a)) - b));
}
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
real(8) :: tmp
if (((t - 1.0d0) * log(a)) <= (-2d+36)) then
tmp = exp((t - 1.0d0))
else
tmp = exp((exp(log(a)) - b))
end if
code = tmp
end function
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)) <= -2e+36) {
tmp = Math.exp((t - 1.0));
} else {
tmp = Math.exp((Math.exp(Math.log(a)) - b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((t - 1.0) * math.log(a)) <= -2e+36: tmp = math.exp((t - 1.0)) else: tmp = math.exp((math.exp(math.log(a)) - b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(t - 1.0) * log(a)) <= -2e+36) tmp = exp(Float64(t - 1.0)); else tmp = exp(Float64(exp(log(a)) - b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((t - 1.0) * log(a)) <= -2e+36) tmp = exp((t - 1.0)); else tmp = exp((exp(log(a)) - b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision], -2e+36], N[Exp[N[(t - 1.0), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[Exp[N[Log[a], $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(t - 1\right) \cdot \log a \leq -2 \cdot 10^{+36}:\\
\;\;\;\;e^{t - 1}\\
\mathbf{else}:\\
\;\;\;\;e^{e^{\log a} - b}\\
\end{array}
\end{array}
if (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < -2.00000000000000008e36Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites86.4%
Taylor expanded in y around 0
Applied rewrites61.1%
if -2.00000000000000008e36 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) Initial program 97.8%
Taylor expanded in y around 0
Applied rewrites59.4%
Taylor expanded in y around 0
Applied rewrites59.4%
Taylor expanded in y around 0
Applied rewrites36.7%
(FPCore (x y z t a b) :precision binary64 (exp (- (- (- (- (+ (* y (log z)) (* (- t 1.0) (log a))) b) b) b) b)))
double code(double x, double y, double z, double t, double a, double b) {
return exp(((((((y * log(z)) + ((t - 1.0) * log(a))) - b) - b) - b) - 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 = exp(((((((y * log(z)) + ((t - 1.0d0) * log(a))) - b) - b) - b) - b))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return Math.exp(((((((y * Math.log(z)) + ((t - 1.0) * Math.log(a))) - b) - b) - b) - b));
}
def code(x, y, z, t, a, b): return math.exp(((((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b) - b) - b) - b))
function code(x, y, z, t, a, b) return exp(Float64(Float64(Float64(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b) - b) - b) - b)) end
function tmp = code(x, y, z, t, a, b) tmp = exp(((((((y * log(z)) + ((t - 1.0) * log(a))) - b) - b) - b) - b)); end
code[x_, y_, z_, t_, a_, b_] := N[Exp[N[(N[(N[(N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(\left(\left(\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b\right) - b\right) - b\right) - b}
\end{array}
Initial program 98.3%
Taylor expanded in y around 0
Applied rewrites66.4%
Taylor expanded in y around 0
Applied rewrites66.4%
Taylor expanded in y around 0
Applied rewrites66.4%
Taylor expanded in y around 0
Applied rewrites66.4%
(FPCore (x y z t a b) :precision binary64 (exp (- (- (- (+ (* y (log z)) (* (- t 1.0) (log a))) b) b) b)))
double code(double x, double y, double z, double t, double a, double b) {
return exp((((((y * log(z)) + ((t - 1.0) * log(a))) - b) - b) - 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 = exp((((((y * log(z)) + ((t - 1.0d0) * log(a))) - b) - b) - b))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return Math.exp((((((y * Math.log(z)) + ((t - 1.0) * Math.log(a))) - b) - b) - b));
}
def code(x, y, z, t, a, b): return math.exp((((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b) - b) - b))
function code(x, y, z, t, a, b) return exp(Float64(Float64(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b) - b) - b)) end
function tmp = code(x, y, z, t, a, b) tmp = exp((((((y * log(z)) + ((t - 1.0) * log(a))) - b) - b) - b)); end
code[x_, y_, z_, t_, a_, b_] := N[Exp[N[(N[(N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(\left(\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b\right) - b\right) - b}
\end{array}
Initial program 98.3%
Taylor expanded in y around 0
Applied rewrites66.4%
Taylor expanded in y around 0
Applied rewrites66.4%
Taylor expanded in y around 0
Applied rewrites66.4%
(FPCore (x y z t a b) :precision binary64 (exp (- (- (+ (* y (log z)) (* (- t 1.0) (log a))) b) b)))
double code(double x, double y, double z, double t, double a, double b) {
return exp(((((y * log(z)) + ((t - 1.0) * log(a))) - b) - 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 = exp(((((y * log(z)) + ((t - 1.0d0) * log(a))) - b) - b))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return Math.exp(((((y * Math.log(z)) + ((t - 1.0) * Math.log(a))) - b) - b));
}
def code(x, y, z, t, a, b): return math.exp(((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b) - b))
function code(x, y, z, t, a, b) return exp(Float64(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b) - b)) end
function tmp = code(x, y, z, t, a, b) tmp = exp(((((y * log(z)) + ((t - 1.0) * log(a))) - b) - b)); end
code[x_, y_, z_, t_, a_, b_] := N[Exp[N[(N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b\right) - b}
\end{array}
Initial program 98.3%
Taylor expanded in y around 0
Applied rewrites66.4%
Taylor expanded in y around 0
Applied rewrites66.4%
(FPCore (x y z t a b) :precision binary64 (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b)))
double code(double x, double y, double z, double t, double a, double b) {
return exp((((y * log(z)) + ((t - 1.0) * log(a))) - 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 = exp((((y * log(z)) + ((t - 1.0d0) * log(a))) - b))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return Math.exp((((y * Math.log(z)) + ((t - 1.0) * Math.log(a))) - b));
}
def code(x, y, z, t, a, b): return math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))
function code(x, y, z, t, a, b) return exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b)) end
function tmp = code(x, y, z, t, a, b) tmp = exp((((y * log(z)) + ((t - 1.0) * log(a))) - b)); end
code[x_, y_, z_, t_, a_, b_] := 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]
\begin{array}{l}
\\
e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}
\end{array}
Initial program 98.3%
Taylor expanded in y around 0
Applied rewrites66.4%
(FPCore (x y z t a b) :precision binary64 (exp (- t 1.0)))
double code(double x, double y, double z, double t, double a, double b) {
return exp((t - 1.0));
}
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 = exp((t - 1.0d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return Math.exp((t - 1.0));
}
def code(x, y, z, t, a, b): return math.exp((t - 1.0))
function code(x, y, z, t, a, b) return exp(Float64(t - 1.0)) end
function tmp = code(x, y, z, t, a, b) tmp = exp((t - 1.0)); end
code[x_, y_, z_, t_, a_, b_] := N[Exp[N[(t - 1.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{t - 1}
\end{array}
Initial program 98.3%
Taylor expanded in y around 0
Applied rewrites66.4%
Taylor expanded in y around 0
Applied rewrites25.0%
(FPCore (x y z t a b) :precision binary64 (- t 1.0))
double code(double x, double y, double z, double t, double a, double b) {
return t - 1.0;
}
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 = t - 1.0d0
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return t - 1.0;
}
def code(x, y, z, t, a, b): return t - 1.0
function code(x, y, z, t, a, b) return Float64(t - 1.0) end
function tmp = code(x, y, z, t, a, b) tmp = t - 1.0; end
code[x_, y_, z_, t_, a_, b_] := N[(t - 1.0), $MachinePrecision]
\begin{array}{l}
\\
t - 1
\end{array}
Initial program 98.3%
Taylor expanded in y around 0
Applied rewrites3.0%
Taylor expanded in y around 0
Applied rewrites2.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (pow a (- t 1.0)))
(t_2 (/ (* x (/ t_1 y)) (- (+ b 1.0) (* y (log z))))))
(if (< t -0.8845848504127471)
t_2
(if (< t 852031.2288374073)
(/ (* (/ x y) t_1) (exp (- b (* (log z) y))))
t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = pow(a, (t - 1.0));
double t_2 = (x * (t_1 / y)) / ((b + 1.0) - (y * log(z)));
double tmp;
if (t < -0.8845848504127471) {
tmp = t_2;
} else if (t < 852031.2288374073) {
tmp = ((x / y) * t_1) / exp((b - (log(z) * y)));
} else {
tmp = t_2;
}
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
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = a ** (t - 1.0d0)
t_2 = (x * (t_1 / y)) / ((b + 1.0d0) - (y * log(z)))
if (t < (-0.8845848504127471d0)) then
tmp = t_2
else if (t < 852031.2288374073d0) then
tmp = ((x / y) * t_1) / exp((b - (log(z) * y)))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.pow(a, (t - 1.0));
double t_2 = (x * (t_1 / y)) / ((b + 1.0) - (y * Math.log(z)));
double tmp;
if (t < -0.8845848504127471) {
tmp = t_2;
} else if (t < 852031.2288374073) {
tmp = ((x / y) * t_1) / Math.exp((b - (Math.log(z) * y)));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.pow(a, (t - 1.0)) t_2 = (x * (t_1 / y)) / ((b + 1.0) - (y * math.log(z))) tmp = 0 if t < -0.8845848504127471: tmp = t_2 elif t < 852031.2288374073: tmp = ((x / y) * t_1) / math.exp((b - (math.log(z) * y))) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = a ^ Float64(t - 1.0) t_2 = Float64(Float64(x * Float64(t_1 / y)) / Float64(Float64(b + 1.0) - Float64(y * log(z)))) tmp = 0.0 if (t < -0.8845848504127471) tmp = t_2; elseif (t < 852031.2288374073) tmp = Float64(Float64(Float64(x / y) * t_1) / exp(Float64(b - Float64(log(z) * y)))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a ^ (t - 1.0); t_2 = (x * (t_1 / y)) / ((b + 1.0) - (y * log(z))); tmp = 0.0; if (t < -0.8845848504127471) tmp = t_2; elseif (t < 852031.2288374073) tmp = ((x / y) * t_1) / exp((b - (log(z) * y))); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision] / N[(N[(b + 1.0), $MachinePrecision] - N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -0.8845848504127471], t$95$2, If[Less[t, 852031.2288374073], N[(N[(N[(x / y), $MachinePrecision] * t$95$1), $MachinePrecision] / N[Exp[N[(b - N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {a}^{\left(t - 1\right)}\\
t_2 := \frac{x \cdot \frac{t\_1}{y}}{\left(b + 1\right) - y \cdot \log z}\\
\mathbf{if}\;t < -0.8845848504127471:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t < 852031.2288374073:\\
\;\;\;\;\frac{\frac{x}{y} \cdot t\_1}{e^{b - \log z \cdot y}}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2024313
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:incompleteBetaWorker from math-functions-0.1.5.2, A"
:precision binary64
:alt
(! :herbie-platform default (if (< t -8845848504127471/10000000000000000) (/ (* x (/ (pow a (- t 1)) y)) (- (+ b 1) (* y (log z)))) (if (< t 8520312288374073/10000000000) (/ (* (/ x y) (pow a (- t 1))) (exp (- b (* (log z) y)))) (/ (* x (/ (pow a (- t 1)) y)) (- (+ b 1) (* y (log z)))))))
(/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))