Tag Info

6

Firstly, you need to decide if the floating point numbers you are working with are "normalized" or not. Think about how binary numbers are represented in scientific notation. Consider the number 100101.010101 The expression given above is not given in scientific notation, but what if we change that? To re-write 100101.010101 in scientific notation, we move ...

3

Let $0 < \varepsilon \lll 1$ be the relative error bound of the floating-point system—$2^{-53}$ in IEEE 754 binary64 arithmetic. First, the naive formula log1p(exp(x)) always gives a good approximation unless exp(x) overflows: If exp(x) computes $(1 + \delta_1) e^x$, and if log1p(y) computes $(1 + \delta_2) \log(1 + y)$, where $|\delta_1|, |\delta_2| \... 3 The only numbers that can be stored exactly are rational numbers whose denominator is a power of 2 (read any source on floating point numbers to understand why). For example, floating point numbers do satisfy $$1/4 + 2/4 = 3/4$$ but do not satisfy (or rather, don't necessarily satisfy) $$1/3 + 2/3 = 3/3.$$ There's nothing magical about the number 10. It'... 2 Although, the question is a bit old, but it may help people coming here for similar question. A vital detail was missed out in the article that you referred to and it is that the standard chose to interpret an all 0s exponent to be equivalent to '-126' and not '-127'. One place, where I found a nice explanation (and an explicit statement about this truth) ... 2 Question a): Here is the output from python console. >>> import math >>> math.log(3,10) * (3**(3**3)) 3638334640024.0996 >>> math.pow(10, 0.0996) 1.2577664324512539 The first 5 most significant digits are almost the same of that of Wolfram, 12577 vs 12580. If we try the following at my favorite online arbitrary precision ... 2 The simple answer is that a computer that follows a floating point standard such as IEEE 754 does not really compute +/- infinity at all. Instead it treats it as an exception - a special case. Whenever the processor detects an attempt to divide a non-zero floating point number by zero, it sets the result to a special value that is then interpreted as +/-... 2 Many people can afford to buy a computer with a powerful processor and say 128GB of RAM. Maybe the same cost as a small car. That's enough to store one number with 300 billion digits. It's enough to store 300,000 numbers of a million digits. But it is also enough to store 16 billion double precision floating point numbers. There are problems where 300,000 ... 2 I'll give you a simple example. Suppose you have some floating-point numbers to add together. We'll assume they're all non-negative so that cancellation isn't an issue. For the purpose of this example, I'm going to use decimal with four significant digits of precision just to illustrate the point. The numbers are: 1.000e-4 1.000e-4 1.000e-4 1.000e-4 1.... 1 It is 0.100000, because normalised values are only allowed to start with 01 or 10. The exponent is 1000 (-8 in decimal) because that is the smallest possible value that can be represented using two's compliment in 4 bits. The value of the exponent means that the floating point will be moved 8 values to the left, thus making the result smaller. 1 Both encodings for the exponent are possible, and they are called Excess-$2^{n-1}$and Excess-$2^{n-1}-1$- in particular, you might meet such number encodings as Excess-127, Excess-128, Excess-1023 and so on. The IEEE-754 standard happened to choose the Excess-127 and the Excess-1023 encodings for exponents, so these encodings became more customary. Your ... 1 I don't know how old your book is, but some architectures (I know of the early SPARCs, there may be others) only had 32 bit floating point registers. Double precision instructions used pairs of registers for storage. This became much less common on general-purpose hardware when 64-bit integer registers became the norm. If anything, we have the converse ... 1 There are a couple of different things happening in that question. Is it due to the limit of binary system to express floating-point numbers? Loss of precision isn't due to the use of binary, it is due to keeping the storage size constant. It also happens if you work with, say, 8-digit decimal numbers, also if you do it with pen and paper. Eventually you ... 1 I'm going to start with this famous quote from James Wilkinson's 1970 Turing Award Lecture, Some Comments from a Numerical Analyst. In the early days of the computer revolution computer designers and numerical analysts worked closely together and indeed were often the same people. Now there is a regrettable tendency for numerical analysts to opt out ... 1 For example, C and C++ don’t adhere to it. They don’t define the details of floating point arithmetic. An implementation may adhere to that standard, and there is a standard way to inform the user about it. I used one compiler with ieee compliant 32 and 64 bit floating point, and totally non-compliant 128 bit fp with roughly 105 bit mantissa. 1 There is a huge discrepancy in your notes. Either you assume that you are using base 2, in which case there should be no beta introduced, but just the number 2 used. Or you don't assume that you are using base 2, but for example base 10, then the number before the decimal point can't be forced to be 1 (or you could only represent 1 ≤ x < 2, 10 ≤ x < 20,... 1 There is definitely an inconsistency in what you've written here. My guess is that$t$doesn't mean what you think it means. You are using it here to describe the size of the significand field, that is, the number of digits after the radix point. (It's not a decimal point in general!) My guess is that your lecturer is using it to refer to the precision. The ... 1 I don't know exactly where you're trying to get to with this, but I think you probably want to Taylor expand the division: $$\frac{1}{1 - \delta_2} = 1 + \delta_2 + \delta_2^2 + \delta_2^3 + \cdots$$ Then, for example, if$\epsilon$is the machine epsilon and$\delta_2 > 0$: $$1 + \delta_2 \le \frac{1}{1 - \delta_2} \le 1 + \delta_2 + \epsilon$$ That ... 1 Standard “float” has a 24 bit mantissa (the highest bit doesn’t get stored because it is always 1). Therefore all integers that fit into 24 bits - all integers less than$2^{24}$- can be represented exactly. From$2^{24}$onward only even numbers can be stored. So you take N =$2^{24}$, and carefully check what n+1 is according to the rounding rules. ... 1 To understand that, you need to understand how floating point numbers are stored n memory. Basically, it’s not possible to store the decimal part exactly (precisely). So, they are approximated to the nearest value which could be stored. Hence, they loose some precision while storing. And hence, the above mentioned behaviour. If you want more insight on ... 1 Technically speaking, not all computers evaluate 1.0 / 0.0 to +Inf. But most of recent computers follows a specification named IEEE 754, which especially defines the division on floating-point numbers 1.0 / 0.0 is +Inf. Division by zero: an operation on finite operands gives an exact infinite result, e.g., 1/0 or log(0). By default, returns ±infinity. ... 1 The sum goes to infinity at x = -1 /$b_i$. Between$b_i$and$b_{I+1}$it is continuous. So each of these intervals contains a point wher the sum of fractions equals k. Go from there. 1 Compute 4^4^4 and you will know how much pairs of bits 4^4^4^4 will require to represent. 1 (Disclaimer: Sorry this answer got a bit long, but I had the same problem and also didn't find an easy explanation on IEEE754 on the internet so I'm posting this. This is answering the question of the OP but also a bit more than that.) I'll explain this with an example. If you consider these three numbers and their binary values: 0.06 = 0.000011110101110...... 1 You need to understand how the IEEE-754 standard for floating point numbers works. It is not simply converting the number to binary. Instead, the 32 bits that compose the representation of the floating-point number are split into 3 fields: sign, exponent, mantissa. Their sizes are 1bit, 8bit, and 23bit, respectively. Each field is written in binary basis (... 1 In general, you can exclude cases x ≥ 0.5 as Doris shows: Find an implementation g (x, a, b) which is good for 0 ≤ x ≤ 0.5. If x ≥ 0.5 then 1 - x is calculated exactly without rounding error, so let f (x, a, b) = g (x, a, b) if x ≤ 0.5, and f (x, a, b) = g (1-x, b, a) if x ≥ 0.5. a + x (b - a) is reasonably accurate if b and a have the same sign. Problem is ... 1 Here is a proposed alternative $$f(x,a,b) = \operatorname{ifelse}(x<0.5, a+x(b-a), b-(1-x)(b-a))$$ which also satisfies (a) and (b), but it is not accurate near$0.5$. It also satisfies (c) except maybe at$\operatorname{prev}(0.5)$and$0.5$. For example with double-precision arithmetic we compute$f(0.5,-1.0,\operatorname{prev}(1.0))\$ to be -1.11e-16 ...

1

If I understand your question correctly, you want to determine the binary representation of a floating-point number by hand. I assume you are talking about the IEEE 754 floating-point format, since this is the most common format. You can indeed do this by successively multiplying with 2. However, just multiplying does not result in anything useful, you ...

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