Average Error: 0.0 → 0.0
Time: 6.8s
Precision: 64
$1 - \frac{1}{B} \cdot e^{\frac{-A}{B}}$
$1 - \frac{1 \cdot \frac{1}{e^{\frac{A}{B}}}}{B}$
1 - \frac{1}{B} \cdot e^{\frac{-A}{B}}
1 - \frac{1 \cdot \frac{1}{e^{\frac{A}{B}}}}{B}
double f(double B, double A) {
double r12258 = 1.0;
double r12259 = B;
double r12260 = r12258 / r12259;
double r12261 = A;
double r12262 = -r12261;
double r12263 = r12262 / r12259;
double r12264 = exp(r12263);
double r12265 = r12260 * r12264;
double r12266 = r12258 - r12265;
return r12266;
}


double f(double B, double A) {
double r12267 = 1.0;
double r12268 = 1.0;
double r12269 = A;
double r12270 = B;
double r12271 = r12269 / r12270;
double r12272 = exp(r12271);
double r12273 = r12268 / r12272;
double r12274 = r12267 * r12273;
double r12275 = r12274 / r12270;
double r12276 = r12267 - r12275;
return r12276;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.0

$1 - \frac{1}{B} \cdot e^{\frac{-A}{B}}$
2. Using strategy rm
3. Applied associate-*l/0.0

$\leadsto 1 - \color{blue}{\frac{1 \cdot e^{\frac{-A}{B}}}{B}}$
4. Using strategy rm
5. Applied distribute-frac-neg0.0

$\leadsto 1 - \frac{1 \cdot e^{\color{blue}{-\frac{A}{B}}}}{B}$
6. Applied exp-neg0.0

$\leadsto 1 - \frac{1 \cdot \color{blue}{\frac{1}{e^{\frac{A}{B}}}}}{B}$
7. Final simplification0.0

$\leadsto 1 - \frac{1 \cdot \frac{1}{e^{\frac{A}{B}}}}{B}$

# Reproduce

herbie shell --seed 1
(FPCore (B A)
:name "1-(1/B)*exp(-A/B)"
:precision binary64
(- 1 (* (/ 1 B) (exp (/ (- A) B)))))