# Tag Info

## Hot answers tagged rounding

8

Assuming round-to-nearest and that $N > 0$, then $N * R < N$ always. (Be careful not to convert an integer that's too large.) Let $c 2^{-q} = N$, where $c \in [1, 2)$ is the significand and $q$ is the integer exponent. Let $1 - 2^{-s} = R$ and derive the bound $$N R = c 2^{-q}(1 - 2^{-s}) \le c 2^{-q} - 2^{-q - s},$$ with equality if and only if $c =... 7 In$\mathbb R$, one can simply round down or round up to obtain an element of$\mathbb Z$. Only two choices! However, in$\mathbb R^n$, one has$2^n$ways of rounding to obtain an element of the integer lattice$\mathbb Z^n$. For example, if$n=100$, one has$2^{100} \approx 10^{30}$possible ways of rounding. Of course, one can round all entries of an$n$... 6 There's nothing fundamentally hard about computing$\sin(10^{99})$. You simply compute$x = 10^{99} \bmod 2\pi$, then compute$\sin(x)$. (Why is this valid? It's because$\sin(x)=\sin(y)$if$x\equiv y \pmod{2\pi}$.) It's not too hard to compute$x$if you use a numerical representation that has enough digits of precision, and then to compute$\sin(x)$... 5 The analysis there is slightly wrong, though the conclusions are correct. Here is the correct calculation:$i$is not a power of 2. In that case$\lfloor \log_2 i \rfloor = \lfloor \log_2 (i-1) \rfloor$and so$\Phi(i) - \Phi(i-1) = (2i+1) - (2(i-1)+1) = 2$.$i$is a power of 2. In that case$2^{\lfloor \log_2 i \rfloor} = i$and$2^{\lfloor \log_2 (i-1) \...

5

If there are only constraints that place a lower bound on the number of trucks, but no constraints that place an upper limit on the number of trucks, then of course you can round up. That will still give you a solution. However, there are multiple caveats: First, this isn't always possible. Sometimes there are both constraints that place lower limits and ...

4

Taking the sine of large numbers is a numerically unstable operation. Considering an argument like $10^{99}$, you can get a completely different value of the sine by adding, say $1$ to it. Think that this is a relative change of $10^{-99}$ ! Indeed, $$|\sin(a+1)-\sin(a)|=|2\sin(\frac12)\cos(a+\frac12)|>0.95|\sin(a+\frac12)|,$$ so that you can find ...

2

That has been long established. Most IEEE 754 floating point numbers represent exactly one real number. The exceptions are +0 and -0, +Inf and -Inf, and NaN with special meanings. If you tried to claim that IEEE 754 floating point numbers did represent intervals, then you would run into deep, deep trouble when you try to define floating-point arithmetic.

1

For first question: No, it doesn't make sense. If there is no ratio between OPT(ILP) and OPT(LP-relax) (i.e. integrality gap is 1) which is very rarely to happen (only happen with problem that is in $P$), then this means that you reach the optimal solution for this problem. It is known that LP-relax cannot give the optimal solution for a problem (except for ...

1

On the other hand, $x−y$ has increased relative error. The correct conclusion should be $x-y$ may have increased relative error. In other words, $x-y$ may have decreased relative error. Let us review what is absolute error and relative error in scientific computing. The absolute error in approximating $x$ by $\hat x$ is $e = e_x= e_{x, \hat x}= \hat x − x$...

1

Decimal numbers with k digits to the right of the decimal point are $10^{-k}$ apart. So if you choose k large enough that $10^{-k} < 2·2^n$, then there is a decimal number with k decimals inside the interval. You can for example calculate it as $round (x·10^k) / 10^k$. You may be lucky, and a number with fewer decimals may be inside the interval. ...

1

That's probably not what was meant by "round". I suspect "round" probably meant to round to the nearest single-precision float. In particular, you can easily verify that 41 is the smallest number with this property: >>> from numpy import * >>> float32(float32(1.0/3.0)*3.0) 1.0 >>> float32(float32(1.0/40.0)*40.0) 1.0 >>>...

1

The correct binary representation of $0.145$ is $0.00100101000111...$ Normalized: $1.00101000111...$ The 8 bit mantissa is $00101000 = 0\mbox{x}28$

1

The format you are using is not IEEE-754 but an IBM FP format. The mantissa is fractional, so the binary representation 0001_0000_0000_0000_0000_0000 means 0.1 (base 16). With a zero value in the exponent field, the exponent would be -64. So you can see that $16^{-65}$ would be the smallest normalized positive value ($1 * 16^{-1} * 16^{-64}$)

Only top voted, non community-wiki answers of a minimum length are eligible