(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (- (/ y (/ t z)) (/ x (/ t z)))))
(t_2 (+ x (/ (* (- y x) z) t))))
(if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 2e+265) t_2 t_1))))double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
double code(double x, double y, double z, double t) {
double t_1 = x + ((y / (t / z)) - (x / (t / z)));
double t_2 = x + (((y - x) * z) / t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 2e+265) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
public static double code(double x, double y, double z, double t) {
double t_1 = x + ((y / (t / z)) - (x / (t / z)));
double t_2 = x + (((y - x) * z) / t);
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= 2e+265) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
def code(x, y, z, t): t_1 = x + ((y / (t / z)) - (x / (t / z))) t_2 = x + (((y - x) * z) / t) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= 2e+265: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(y / Float64(t / z)) - Float64(x / Float64(t / z)))) t_2 = Float64(x + Float64(Float64(Float64(y - x) * z) / t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 2e+265) tmp = t_2; else tmp = t_1; end return tmp end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
function tmp_2 = code(x, y, z, t) t_1 = x + ((y / (t / z)) - (x / (t / z))); t_2 = x + (((y - x) * z) / t); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= 2e+265) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision] - N[(x / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 2e+265], t$95$2, t$95$1]]]]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
t_1 := x + \left(\frac{y}{\frac{t}{z}} - \frac{x}{\frac{t}{z}}\right)\\
t_2 := x + \frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 \leq 2 \cdot 10^{+265}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.2 |
|---|---|
| Target | 2.0 |
| Herbie | 0.8 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -inf.0 or 2.00000000000000013e265 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 43.4
Applied egg-rr1.7
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 2.00000000000000013e265Initial program 0.7
Final simplification0.8
herbie shell --seed 2022166
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:herbie-target
(if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))
(+ x (/ (* (- y x) z) t)))