\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\begin{array}{l}
\mathbf{if}\;x \le -28471394463391.582 \lor \neg \left(x \le 125769773969809.797\right):\\
\;\;\;\;\left(1 + \frac{x}{y}\right) - 1 \cdot \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x \cdot x - 1 \cdot 1} \cdot \left(x - 1\right)\\
\end{array}double code(double x, double y) {
return ((x * ((x / y) + 1.0)) / (x + 1.0));
}
double code(double x, double y) {
double temp;
if (((x <= -28471394463391.582) || !(x <= 125769773969809.8))) {
temp = ((1.0 + (x / y)) - (1.0 * (1.0 / x)));
} else {
temp = (((x * ((x / y) + 1.0)) / ((x * x) - (1.0 * 1.0))) * (x - 1.0));
}
return temp;
}




Bits error versus x




Bits error versus y
Results
| Original | 9.0 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if x < -28471394463391.582 or 125769773969809.8 < x Initial program 22.8
rmApplied flip-+27.7
Applied associate-*r/33.5
Taylor expanded around inf 0.0
if -28471394463391.582 < x < 125769773969809.8Initial program 0.1
rmApplied flip-+0.1
Applied associate-/r/0.1
Final simplification0.1
herbie shell --seed 2020066 +o rules:numerics
(FPCore (x y)
:name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
:precision binary64
:herbie-target
(* (/ x 1) (/ (+ (/ x y) 1) (+ x 1)))
(/ (* x (+ (/ x y) 1)) (+ x 1)))