
(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 8 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 (/ (* (exp (- (+ (* (log a) (- t 1.0)) (* (log z) y)) b)) x) y))
double code(double x, double y, double z, double t, double a, double b) {
return (exp((((log(a) * (t - 1.0)) + (log(z) * y)) - b)) * x) / 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 = (exp((((log(a) * (t - 1.0d0)) + (log(z) * y)) - b)) * x) / y
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (Math.exp((((Math.log(a) * (t - 1.0)) + (Math.log(z) * y)) - b)) * x) / y;
}
def code(x, y, z, t, a, b): return (math.exp((((math.log(a) * (t - 1.0)) + (math.log(z) * y)) - b)) * x) / y
function code(x, y, z, t, a, b) return Float64(Float64(exp(Float64(Float64(Float64(log(a) * Float64(t - 1.0)) + Float64(log(z) * y)) - b)) * x) / y) end
function tmp = code(x, y, z, t, a, b) tmp = (exp((((log(a) * (t - 1.0)) + (log(z) * y)) - b)) * x) / y; end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[Exp[N[(N[(N[(N[Log[a], $MachinePrecision] * N[(t - 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{\left(\log a \cdot \left(t - 1\right) + \log z \cdot y\right) - b} \cdot x}{y}
\end{array}
Initial program 98.9%
Final simplification98.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (* (exp (* (log z) y)) x) y)))
(if (<= y -1.9e+47)
t_1
(if (<= y 4e+222) (/ (* (exp (- (* (log a) (- t 1.0)) b)) x) y) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (exp((log(z) * y)) * x) / y;
double tmp;
if (y <= -1.9e+47) {
tmp = t_1;
} else if (y <= 4e+222) {
tmp = (exp(((log(a) * (t - 1.0)) - b)) * x) / y;
} else {
tmp = t_1;
}
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) :: tmp
t_1 = (exp((log(z) * y)) * x) / y
if (y <= (-1.9d+47)) then
tmp = t_1
else if (y <= 4d+222) then
tmp = (exp(((log(a) * (t - 1.0d0)) - b)) * x) / y
else
tmp = t_1
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.exp((Math.log(z) * y)) * x) / y;
double tmp;
if (y <= -1.9e+47) {
tmp = t_1;
} else if (y <= 4e+222) {
tmp = (Math.exp(((Math.log(a) * (t - 1.0)) - b)) * x) / y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (math.exp((math.log(z) * y)) * x) / y tmp = 0 if y <= -1.9e+47: tmp = t_1 elif y <= 4e+222: tmp = (math.exp(((math.log(a) * (t - 1.0)) - b)) * x) / y else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(exp(Float64(log(z) * y)) * x) / y) tmp = 0.0 if (y <= -1.9e+47) tmp = t_1; elseif (y <= 4e+222) tmp = Float64(Float64(exp(Float64(Float64(log(a) * Float64(t - 1.0)) - b)) * x) / y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (exp((log(z) * y)) * x) / y; tmp = 0.0; if (y <= -1.9e+47) tmp = t_1; elseif (y <= 4e+222) tmp = (exp(((log(a) * (t - 1.0)) - b)) * x) / y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[Exp[N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -1.9e+47], t$95$1, If[LessEqual[y, 4e+222], N[(N[(N[Exp[N[(N[(N[Log[a], $MachinePrecision] * N[(t - 1.0), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{e^{\log z \cdot y} \cdot x}{y}\\
\mathbf{if}\;y \leq -1.9 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+222}:\\
\;\;\;\;\frac{e^{\log a \cdot \left(t - 1\right) - b} \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.9000000000000002e47 or 4.0000000000000002e222 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6486.1
Applied rewrites86.1%
if -1.9000000000000002e47 < y < 4.0000000000000002e222Initial program 98.4%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
rem-exp-logN/A
lower-log.f64N/A
rem-exp-log93.1
Applied rewrites93.1%
Final simplification91.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (exp (- b))))
(if (<= b -2300.0)
(* (/ t_1 y) x)
(if (<= b 0.00052)
(/ (* (pow a (- t 1.0)) (* (pow z y) x)) y)
(/ (* (/ t_1 a) x) y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp(-b);
double tmp;
if (b <= -2300.0) {
tmp = (t_1 / y) * x;
} else if (b <= 0.00052) {
tmp = (pow(a, (t - 1.0)) * (pow(z, y) * x)) / y;
} else {
tmp = ((t_1 / a) * x) / 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
real(8) :: t_1
real(8) :: tmp
t_1 = exp(-b)
if (b <= (-2300.0d0)) then
tmp = (t_1 / y) * x
else if (b <= 0.00052d0) then
tmp = ((a ** (t - 1.0d0)) * ((z ** y) * x)) / y
else
tmp = ((t_1 / a) * x) / y
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.exp(-b);
double tmp;
if (b <= -2300.0) {
tmp = (t_1 / y) * x;
} else if (b <= 0.00052) {
tmp = (Math.pow(a, (t - 1.0)) * (Math.pow(z, y) * x)) / y;
} else {
tmp = ((t_1 / a) * x) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.exp(-b) tmp = 0 if b <= -2300.0: tmp = (t_1 / y) * x elif b <= 0.00052: tmp = (math.pow(a, (t - 1.0)) * (math.pow(z, y) * x)) / y else: tmp = ((t_1 / a) * x) / y return tmp
function code(x, y, z, t, a, b) t_1 = exp(Float64(-b)) tmp = 0.0 if (b <= -2300.0) tmp = Float64(Float64(t_1 / y) * x); elseif (b <= 0.00052) tmp = Float64(Float64((a ^ Float64(t - 1.0)) * Float64((z ^ y) * x)) / y); else tmp = Float64(Float64(Float64(t_1 / a) * x) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = exp(-b); tmp = 0.0; if (b <= -2300.0) tmp = (t_1 / y) * x; elseif (b <= 0.00052) tmp = ((a ^ (t - 1.0)) * ((z ^ y) * x)) / y; else tmp = ((t_1 / a) * x) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Exp[(-b)], $MachinePrecision]}, If[LessEqual[b, -2300.0], N[(N[(t$95$1 / y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[b, 0.00052], N[(N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] * N[(N[Power[z, y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(t$95$1 / a), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{-b}\\
\mathbf{if}\;b \leq -2300:\\
\;\;\;\;\frac{t\_1}{y} \cdot x\\
\mathbf{elif}\;b \leq 0.00052:\\
\;\;\;\;\frac{{a}^{\left(t - 1\right)} \cdot \left({z}^{y} \cdot x\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_1}{a} \cdot x}{y}\\
\end{array}
\end{array}
if b < -2300Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6490.0
Applied rewrites90.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.0
Applied rewrites90.0%
if -2300 < b < 5.19999999999999954e-4Initial program 97.5%
Taylor expanded in b around 0
exp-sumN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f6482.5
Applied rewrites82.5%
if 5.19999999999999954e-4 < b Initial program 99.8%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f64N/A
lower-exp.f6459.6
Applied rewrites59.6%
Taylor expanded in t around 0
Applied rewrites82.7%
Final simplification84.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (* (exp (* (log z) y)) x) y)))
(if (<= y -1.75e+47)
t_1
(if (<= y 6e+126) (* (/ (pow a (- t 1.0)) (* (exp b) y)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (exp((log(z) * y)) * x) / y;
double tmp;
if (y <= -1.75e+47) {
tmp = t_1;
} else if (y <= 6e+126) {
tmp = (pow(a, (t - 1.0)) / (exp(b) * y)) * x;
} else {
tmp = t_1;
}
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) :: tmp
t_1 = (exp((log(z) * y)) * x) / y
if (y <= (-1.75d+47)) then
tmp = t_1
else if (y <= 6d+126) then
tmp = ((a ** (t - 1.0d0)) / (exp(b) * y)) * x
else
tmp = t_1
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.exp((Math.log(z) * y)) * x) / y;
double tmp;
if (y <= -1.75e+47) {
tmp = t_1;
} else if (y <= 6e+126) {
tmp = (Math.pow(a, (t - 1.0)) / (Math.exp(b) * y)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (math.exp((math.log(z) * y)) * x) / y tmp = 0 if y <= -1.75e+47: tmp = t_1 elif y <= 6e+126: tmp = (math.pow(a, (t - 1.0)) / (math.exp(b) * y)) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(exp(Float64(log(z) * y)) * x) / y) tmp = 0.0 if (y <= -1.75e+47) tmp = t_1; elseif (y <= 6e+126) tmp = Float64(Float64((a ^ Float64(t - 1.0)) / Float64(exp(b) * y)) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (exp((log(z) * y)) * x) / y; tmp = 0.0; if (y <= -1.75e+47) tmp = t_1; elseif (y <= 6e+126) tmp = ((a ^ (t - 1.0)) / (exp(b) * y)) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[Exp[N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -1.75e+47], t$95$1, If[LessEqual[y, 6e+126], N[(N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] / N[(N[Exp[b], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{e^{\log z \cdot y} \cdot x}{y}\\
\mathbf{if}\;y \leq -1.75 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+126}:\\
\;\;\;\;\frac{{a}^{\left(t - 1\right)}}{e^{b} \cdot y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.75000000000000008e47 or 6.0000000000000005e126 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6483.6
Applied rewrites83.6%
if -1.75000000000000008e47 < y < 6.0000000000000005e126Initial program 98.2%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6456.8
Applied rewrites56.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6456.8
Applied rewrites56.8%
Taylor expanded in y around 0
div-expN/A
associate-/l/N/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f6484.9
Applied rewrites84.9%
Final simplification84.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (exp (- b))))
(if (<= b -115000000.0)
(* (/ t_1 y) x)
(if (<= b 3.6e-37)
(* (- x (* b x)) (/ (pow a (- t 1.0)) y))
(/ (* (/ t_1 a) x) y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp(-b);
double tmp;
if (b <= -115000000.0) {
tmp = (t_1 / y) * x;
} else if (b <= 3.6e-37) {
tmp = (x - (b * x)) * (pow(a, (t - 1.0)) / y);
} else {
tmp = ((t_1 / a) * x) / 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
real(8) :: t_1
real(8) :: tmp
t_1 = exp(-b)
if (b <= (-115000000.0d0)) then
tmp = (t_1 / y) * x
else if (b <= 3.6d-37) then
tmp = (x - (b * x)) * ((a ** (t - 1.0d0)) / y)
else
tmp = ((t_1 / a) * x) / y
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.exp(-b);
double tmp;
if (b <= -115000000.0) {
tmp = (t_1 / y) * x;
} else if (b <= 3.6e-37) {
tmp = (x - (b * x)) * (Math.pow(a, (t - 1.0)) / y);
} else {
tmp = ((t_1 / a) * x) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.exp(-b) tmp = 0 if b <= -115000000.0: tmp = (t_1 / y) * x elif b <= 3.6e-37: tmp = (x - (b * x)) * (math.pow(a, (t - 1.0)) / y) else: tmp = ((t_1 / a) * x) / y return tmp
function code(x, y, z, t, a, b) t_1 = exp(Float64(-b)) tmp = 0.0 if (b <= -115000000.0) tmp = Float64(Float64(t_1 / y) * x); elseif (b <= 3.6e-37) tmp = Float64(Float64(x - Float64(b * x)) * Float64((a ^ Float64(t - 1.0)) / y)); else tmp = Float64(Float64(Float64(t_1 / a) * x) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = exp(-b); tmp = 0.0; if (b <= -115000000.0) tmp = (t_1 / y) * x; elseif (b <= 3.6e-37) tmp = (x - (b * x)) * ((a ^ (t - 1.0)) / y); else tmp = ((t_1 / a) * x) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Exp[(-b)], $MachinePrecision]}, If[LessEqual[b, -115000000.0], N[(N[(t$95$1 / y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[b, 3.6e-37], N[(N[(x - N[(b * x), $MachinePrecision]), $MachinePrecision] * N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 / a), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{-b}\\
\mathbf{if}\;b \leq -115000000:\\
\;\;\;\;\frac{t\_1}{y} \cdot x\\
\mathbf{elif}\;b \leq 3.6 \cdot 10^{-37}:\\
\;\;\;\;\left(x - b \cdot x\right) \cdot \frac{{a}^{\left(t - 1\right)}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_1}{a} \cdot x}{y}\\
\end{array}
\end{array}
if b < -1.15e8Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6491.2
Applied rewrites91.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6491.2
Applied rewrites91.2%
if -1.15e8 < b < 3.60000000000000007e-37Initial program 97.7%
Taylor expanded in b around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-/l*N/A
associate-*r*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
Applied rewrites81.8%
Taylor expanded in y around 0
Applied rewrites75.0%
if 3.60000000000000007e-37 < b Initial program 99.5%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f64N/A
lower-exp.f6459.6
Applied rewrites59.6%
Taylor expanded in t around 0
Applied rewrites81.4%
Final simplification81.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (/ (exp (- b)) y) x)))
(if (<= b -115000000.0)
t_1
(if (<= b 2.9e+15) (* (/ (pow a (- t 1.0)) y) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (exp(-b) / y) * x;
double tmp;
if (b <= -115000000.0) {
tmp = t_1;
} else if (b <= 2.9e+15) {
tmp = (pow(a, (t - 1.0)) / y) * x;
} else {
tmp = t_1;
}
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) :: tmp
t_1 = (exp(-b) / y) * x
if (b <= (-115000000.0d0)) then
tmp = t_1
else if (b <= 2.9d+15) then
tmp = ((a ** (t - 1.0d0)) / y) * x
else
tmp = t_1
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.exp(-b) / y) * x;
double tmp;
if (b <= -115000000.0) {
tmp = t_1;
} else if (b <= 2.9e+15) {
tmp = (Math.pow(a, (t - 1.0)) / y) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (math.exp(-b) / y) * x tmp = 0 if b <= -115000000.0: tmp = t_1 elif b <= 2.9e+15: tmp = (math.pow(a, (t - 1.0)) / y) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(exp(Float64(-b)) / y) * x) tmp = 0.0 if (b <= -115000000.0) tmp = t_1; elseif (b <= 2.9e+15) tmp = Float64(Float64((a ^ Float64(t - 1.0)) / y) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (exp(-b) / y) * x; tmp = 0.0; if (b <= -115000000.0) tmp = t_1; elseif (b <= 2.9e+15) tmp = ((a ^ (t - 1.0)) / y) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[b, -115000000.0], t$95$1, If[LessEqual[b, 2.9e+15], N[(N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{e^{-b}}{y} \cdot x\\
\mathbf{if}\;b \leq -115000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 2.9 \cdot 10^{+15}:\\
\;\;\;\;\frac{{a}^{\left(t - 1\right)}}{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.15e8 or 2.9e15 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6488.8
Applied rewrites88.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6488.8
Applied rewrites88.8%
if -1.15e8 < b < 2.9e15Initial program 97.6%
Taylor expanded in b around 0
exp-sumN/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f6477.1
Applied rewrites77.1%
Taylor expanded in y around 0
Applied rewrites72.7%
Final simplification81.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (/ (exp (- b)) y) x)))
(if (<= b -2200.0)
t_1
(if (<= b 10000.0) (* (/ (/ 1.0 a) y) (* 1.0 x)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (exp(-b) / y) * x;
double tmp;
if (b <= -2200.0) {
tmp = t_1;
} else if (b <= 10000.0) {
tmp = ((1.0 / a) / y) * (1.0 * x);
} else {
tmp = t_1;
}
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) :: tmp
t_1 = (exp(-b) / y) * x
if (b <= (-2200.0d0)) then
tmp = t_1
else if (b <= 10000.0d0) then
tmp = ((1.0d0 / a) / y) * (1.0d0 * x)
else
tmp = t_1
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.exp(-b) / y) * x;
double tmp;
if (b <= -2200.0) {
tmp = t_1;
} else if (b <= 10000.0) {
tmp = ((1.0 / a) / y) * (1.0 * x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (math.exp(-b) / y) * x tmp = 0 if b <= -2200.0: tmp = t_1 elif b <= 10000.0: tmp = ((1.0 / a) / y) * (1.0 * x) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(exp(Float64(-b)) / y) * x) tmp = 0.0 if (b <= -2200.0) tmp = t_1; elseif (b <= 10000.0) tmp = Float64(Float64(Float64(1.0 / a) / y) * Float64(1.0 * x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (exp(-b) / y) * x; tmp = 0.0; if (b <= -2200.0) tmp = t_1; elseif (b <= 10000.0) tmp = ((1.0 / a) / y) * (1.0 * x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[b, -2200.0], t$95$1, If[LessEqual[b, 10000.0], N[(N[(N[(1.0 / a), $MachinePrecision] / y), $MachinePrecision] * N[(1.0 * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{e^{-b}}{y} \cdot x\\
\mathbf{if}\;b \leq -2200:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 10000:\\
\;\;\;\;\frac{\frac{1}{a}}{y} \cdot \left(1 \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -2200 or 1e4 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6486.5
Applied rewrites86.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.5
Applied rewrites86.5%
if -2200 < b < 1e4Initial program 97.5%
Taylor expanded in b around 0
exp-sumN/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f6479.1
Applied rewrites79.1%
Taylor expanded in t around 0
Applied rewrites69.1%
Taylor expanded in y around 0
Applied rewrites46.7%
Final simplification68.4%
(FPCore (x y z t a b) :precision binary64 (* (/ (/ 1.0 a) y) (* 1.0 x)))
double code(double x, double y, double z, double t, double a, double b) {
return ((1.0 / a) / y) * (1.0 * x);
}
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 = ((1.0d0 / a) / y) * (1.0d0 * x)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((1.0 / a) / y) * (1.0 * x);
}
def code(x, y, z, t, a, b): return ((1.0 / a) / y) * (1.0 * x)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(1.0 / a) / y) * Float64(1.0 * x)) end
function tmp = code(x, y, z, t, a, b) tmp = ((1.0 / a) / y) * (1.0 * x); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(1.0 / a), $MachinePrecision] / y), $MachinePrecision] * N[(1.0 * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{a}}{y} \cdot \left(1 \cdot x\right)
\end{array}
Initial program 98.9%
Taylor expanded in b around 0
exp-sumN/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f6459.6
Applied rewrites59.6%
Taylor expanded in t around 0
Applied rewrites55.2%
Taylor expanded in y around 0
Applied rewrites35.1%
Final simplification35.1%
(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 2024255
(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))