(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
(FPCore (x y z t) :precision binary64 (- (+ (/ (/ (* t 0.3333333333333333) z) y) x) (/ 1.0 (/ z (* 0.3333333333333333 y)))))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
double code(double x, double y, double z, double t) {
return ((((t * 0.3333333333333333) / z) / y) + x) - (1.0 / (z / (0.3333333333333333 * y)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((((t * 0.3333333333333333d0) / z) / y) + x) - (1.0d0 / (z / (0.3333333333333333d0 * y)))
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
public static double code(double x, double y, double z, double t) {
return ((((t * 0.3333333333333333) / z) / y) + x) - (1.0 / (z / (0.3333333333333333 * y)));
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
def code(x, y, z, t): return ((((t * 0.3333333333333333) / z) / y) + x) - (1.0 / (z / (0.3333333333333333 * y)))
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) end
function code(x, y, z, t) return Float64(Float64(Float64(Float64(Float64(t * 0.3333333333333333) / z) / y) + x) - Float64(1.0 / Float64(z / Float64(0.3333333333333333 * y)))) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end
function tmp = code(x, y, z, t) tmp = ((((t * 0.3333333333333333) / z) / y) + x) - (1.0 / (z / (0.3333333333333333 * y))); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(t * 0.3333333333333333), $MachinePrecision] / z), $MachinePrecision] / y), $MachinePrecision] + x), $MachinePrecision] - N[(1.0 / N[(z / N[(0.3333333333333333 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\left(\frac{\frac{t \cdot 0.3333333333333333}{z}}{y} + x\right) - \frac{1}{\frac{z}{0.3333333333333333 \cdot y}}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 3.8 |
|---|---|
| Target | 1.6 |
| Herbie | 1.7 |
Initial program 3.8
Simplified4.1
Taylor expanded in z around 0 3.9
Applied egg-rr3.8
Applied egg-rr1.7
Final simplification1.7
herbie shell --seed 2022131
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H"
:precision binary64
:herbie-target
(+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y))
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))