(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (/ y (* z 3.0)))))
(if (<= t -1.3110050459942516e-113)
(+ (+ x (/ (/ y z) -3.0)) (/ t (* y (* z 3.0))))
(if (<= t 6.568065307651204e+190)
(+ t_1 (* (/ 1.0 z) (/ t (* y 3.0))))
(+ t_1 (/ t (* z (* y 3.0))))))))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) {
double t_1 = x - (y / (z * 3.0));
double tmp;
if (t <= -1.3110050459942516e-113) {
tmp = (x + ((y / z) / -3.0)) + (t / (y * (z * 3.0)));
} else if (t <= 6.568065307651204e+190) {
tmp = t_1 + ((1.0 / z) * (t / (y * 3.0)));
} else {
tmp = t_1 + (t / (z * (y * 3.0)));
}
return tmp;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = x - (y / (z * 3.0d0))
if (t <= (-1.3110050459942516d-113)) then
tmp = (x + ((y / z) / (-3.0d0))) + (t / (y * (z * 3.0d0)))
else if (t <= 6.568065307651204d+190) then
tmp = t_1 + ((1.0d0 / z) * (t / (y * 3.0d0)))
else
tmp = t_1 + (t / (z * (y * 3.0d0)))
end if
code = tmp
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) {
double t_1 = x - (y / (z * 3.0));
double tmp;
if (t <= -1.3110050459942516e-113) {
tmp = (x + ((y / z) / -3.0)) + (t / (y * (z * 3.0)));
} else if (t <= 6.568065307651204e+190) {
tmp = t_1 + ((1.0 / z) * (t / (y * 3.0)));
} else {
tmp = t_1 + (t / (z * (y * 3.0)));
}
return tmp;
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
def code(x, y, z, t): t_1 = x - (y / (z * 3.0)) tmp = 0 if t <= -1.3110050459942516e-113: tmp = (x + ((y / z) / -3.0)) + (t / (y * (z * 3.0))) elif t <= 6.568065307651204e+190: tmp = t_1 + ((1.0 / z) * (t / (y * 3.0))) else: tmp = t_1 + (t / (z * (y * 3.0))) return tmp
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) t_1 = Float64(x - Float64(y / Float64(z * 3.0))) tmp = 0.0 if (t <= -1.3110050459942516e-113) tmp = Float64(Float64(x + Float64(Float64(y / z) / -3.0)) + Float64(t / Float64(y * Float64(z * 3.0)))); elseif (t <= 6.568065307651204e+190) tmp = Float64(t_1 + Float64(Float64(1.0 / z) * Float64(t / Float64(y * 3.0)))); else tmp = Float64(t_1 + Float64(t / Float64(z * Float64(y * 3.0)))); end return tmp end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end
function tmp_2 = code(x, y, z, t) t_1 = x - (y / (z * 3.0)); tmp = 0.0; if (t <= -1.3110050459942516e-113) tmp = (x + ((y / z) / -3.0)) + (t / (y * (z * 3.0))); elseif (t <= 6.568065307651204e+190) tmp = t_1 + ((1.0 / z) * (t / (y * 3.0))); else tmp = t_1 + (t / (z * (y * 3.0))); end tmp_2 = tmp; 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_] := Block[{t$95$1 = N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.3110050459942516e-113], N[(N[(x + N[(N[(y / z), $MachinePrecision] / -3.0), $MachinePrecision]), $MachinePrecision] + N[(t / N[(y * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.568065307651204e+190], N[(t$95$1 + N[(N[(1.0 / z), $MachinePrecision] * N[(t / N[(y * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t / N[(z * N[(y * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
t_1 := x - \frac{y}{z \cdot 3}\\
\mathbf{if}\;t \leq -1.3110050459942516 \cdot 10^{-113}:\\
\;\;\;\;\left(x + \frac{\frac{y}{z}}{-3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\mathbf{elif}\;t \leq 6.568065307651204 \cdot 10^{+190}:\\
\;\;\;\;t_1 + \frac{1}{z} \cdot \frac{t}{y \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;t_1 + \frac{t}{z \cdot \left(y \cdot 3\right)}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 3.6 |
|---|---|
| Target | 1.7 |
| Herbie | 1.5 |
if t < -1.3110050459942516e-113Initial program 1.3
Applied egg-rr1.4
Applied egg-rr1.3
if -1.3110050459942516e-113 < t < 6.5680653076512042e190Initial program 5.0
Applied egg-rr1.6
if 6.5680653076512042e190 < t Initial program 1.3
Applied egg-rr1.3
Final simplification1.5
herbie shell --seed 2022153
(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))))