Questions tagged [floating-point]

Approximate representation of numbers as a fixed number of digits multiplied by a logarithmic scale.

Filter by
Sorted by
Tagged with
3
votes
3answers
4k views

What does normalizing with hidden bit really mean?

I have a question related to representing numbers in base 2 with floating point. For example, if I have such a number $$0.000011 \cdot 2^3$$ then is its normalized form this? $$1.1\cdot 2^{-2}$$ ...
2
votes
1answer
36 views

Do all programming languages adhere to the IEEE 754-2008 standard?

I am well aware that the float data type's maximum value is approximately 1.8E308, which means that across the various ...
1
vote
0answers
29 views

What are the smallest and biggest negative floating point numbers in IEEE 754 32 bit?

I am stuck with a question that asks for smallest and biggest negative floating point numbers in IEEE 754 32-bit (their representation and decimal numerical value from which one can approximate the ...
-2
votes
0answers
34 views

absurd output on a trivial function in python [duplicate]

k=1 while k!=0: x=float(input('Enter x:')) op=(1/(1+x))+(1/(1+(1/x))) print(op) I tried to test this function on python, clearly the output should ...
1
vote
0answers
28 views

How can I calculate the exponential integral?

(I'm not sure this is the right forum.) I'm writing a program that uses the prime-counting function. Right now, I'm using x/log(x), but I want to switch to ...
0
votes
2answers
35 views

Question about machine epsilon

I am studying over my notes, and there is something I don't understand about $e_m$. We represent the floating point numbers as $1.d_1d_2...d_t \times \beta^e$. Now, my professor defines $\epsilon_m$ ...
1
vote
1answer
22 views

What's the least signifcant bit of a mantissa system?

If Mantissa is a 1-dot-M fixed-point number whose most significant bit is always 1 then, how is the least significant bit calculated? I know the least and most significant bit of the mantissa ...
1
vote
1answer
33 views

Floating point arithmetic on division

I am trying to figure out how $(x/y)$ in floating point arithmetic $fl(fl(x) / fl(y))$ where $fl(x) = x(1-\delta_1)$, $fl(y) = y(1-\delta_2)$, $fl = (1-\delta_3)$ I have: $= x/y \cdot ((1-\delta_1)/...
0
votes
2answers
46 views

Floating point precision from rearranging equation

When I run $x^2 - y^2$ with x=8.8888888888 and y=9.9999999999 in python, I get the following result: ...
0
votes
0answers
11 views

Is Decimal (correctly-rounded arbitrary precision decimal floating point arithmetic) fixed-point, floating-point or something else?

The Decimal data type I am referring to is GNU MPFR(https://en.wikipedia.org/wiki/GNU_MPFR), or libmpdec (http://www.bytereef.org/mpdecimal/doc/libmpdec/index.html). I have been searching for ...
2
votes
1answer
41 views

Smallest integer i stored as a float such that i+1=i

So I had an assignment which asked me to find the smallest integer $i$ which when represented as a float is such that $i+1=i$ My approach- By making a simple C++ program , we get $i=16777216$ or $i=2^...
2
votes
2answers
31 views

Why multiplying float number by multiple of 10 seems to preserve better precision?

It is famous that for float numbers: .1 + .2 != .3 but 1+2=3 It seems that multiplying floats by 10 allows you to preserve ...
1
vote
4answers
67 views

How does a computer compute negative(-) and positive(+) Infinity?

If we divide (1.0/0.0) we will get +Infinity and if we divide (-1.0/0.0) we will get -Infinity. How does a computer calculate this value internally?
1
vote
0answers
46 views

Can we represent $\sqrt{2}$ exactly even with infinite bits in mantissa [closed]

Can we represent $\sqrt{2}$ exactly even with infinite bits in mantissa in floating point notation or otherwise. We actually have to prove this is not possible. But why can't we if we have infinite ...
0
votes
1answer
146 views

Using a 16-bit 2,s Complement normalised floating-point representation; 10-bit fractional mantissa and a 6-bit integer exponent: express 2.171875

So far I know how to normalize when you are given, say: 1111010010 Mantissa, and 000100 exponent and are told that it's a positive number: ...
0
votes
1answer
129 views

Computing the error bound of floating-point expression

How should I compute the maximum absolute and relative error of the following IEEE-754 floating-point expression? a.y + (x - a.x) * ((b.y - a.y) / (b.x - a.x)) ...
0
votes
1answer
282 views

How to compute relative error for the rounding of floating point numbers when the rounded number is 0?

I have asked this question on Stack Overflow, I am asking it here in the hope to get more traction. The relative rounding error for a floating point number x is defined as $e_r = |\frac{(round(x) -...
0
votes
1answer
39 views

algorithm for correctly rounded floating point radix conversion

Is there any generic algorithm which implements a floating point radix conversion? Lets say we have a $p$-digit FP number $A = \sum_{i=0}^{p-1} A_i \beta^{e-i}$ in radix $\beta$ and with $0 \leq ...
0
votes
0answers
25 views

Floating point substraction

if $x=1.0e38=1.0 * 10^{38}$ and $y=3.0$ i want to find $ (x-x)+y $ and $(x+y)-x$ i think the value of (x-x)+y will be just substract $x-x=0 + y=3.0 = 3.0$ but how can i perfom addition of different ...
0
votes
2answers
133 views

Convert $1.75\times10^{15}$ to IEEE-32 format?

$1.75\times10^{15}$ I know how to convert decimal to binary $(1.75)_{10}$ is equal to $(1.11)_2$ But to represent $10^{15}$ is the main problem for me. I can solve the question but this is the ...
2
votes
1answer
70 views

Polynomials - using Newton's method, or not?

I have to find a root of polynomial of degree $n\ge2$. I need to write code to calculate the root for different values of $n$. Only 1 real positive solution is needed. I can use general Newton's ...
1
vote
0answers
28 views

How many floating point ops were performed worldwide over a time interval [closed]

I am looking for information regarding the evolution of computing capability. Specifically I would like to know how many floating point operations were performed worldwide from, say, the deployment of ...
0
votes
1answer
61 views

Computing an Expression

I am writing code to evaluate the following expression: $$ \frac{(a+b+c)!}{a! b! c!} $$ where $a$, $b$ and $c$ are on the range of $10$ to $500$. The result is going to be a floating point number. ...
3
votes
2answers
100 views

How much can we trust mathematical software when working with large numbers, and how much memory it needs to work with these numbers?

For example, I want to evaluate the expression: $3^{3^{{3}^{3}}}$ so I used wolframalpha.com (it's free, and I don't own any software), which returned the scientific notation of the number above, ...
1
vote
1answer
56 views

Shortest decimal expansion within binary interval

Consider an interval $[x-2^n,x+2^n]$ defined by a binary float $x$ and a power of two $2^n$ typically much smaller than $x$. I would like to know whether an efficient algorithm exists to determine the ...
2
votes
1answer
55 views

numerically stable log1pexp calculation

What are good approximations for computing log1pexp for single precision and double precision floating point numbers? Note: ...
2
votes
1answer
78 views

Floating point arithmetic

I need to change x1 = 0.3 and x2 = -0.29 to a FP(floating point) number with one sign bit, a 4 bit mantissa, a 3 bit exponent. The results I got are: x1: 0 001 0011 x2: 1 001 0010 I am also trying ...
3
votes
3answers
63 views

Guarantees on computing $a+x(b-a)$ in floating point

I want to implement the function $f(x,a,b) = a + x(b-a)$ where all the inputs are floating point (doubles, say), such that (a) $f(0,a,b)=a$ exactly; (b) $f(1,a,b)=b$ exactly; (c) $f(x,a,b) \le f(y,a,b)...
0
votes
2answers
82 views

Float number to binary

I would like to convert 0,347 and 0,9828 to binary, how can I do that? I know that sucessive multiplication by 2 can do this, but this method seems very painful and even ineffective since the size of ...
0
votes
0answers
45 views

How does normalised floating point binary work with two's complement?

I'm doing AQA a-level computer science, and the specification for which states that: Exam questions on floating point numbers will use a format in which both the normalised mantissa and exponent are ...
0
votes
3answers
749 views

What is the 1's and 2's complement of 0.01101?

What is the 1's and 2's complement of 0.01101? I'm unable to find any details on this from google. Basically how do we represent the floating points in 1's and 2's complement forms? Even wikipedia ...
1
vote
0answers
12 views

Where can I find some free benchmarks to evaluate a MCU? [closed]

At present, I'm designing a soft processor with single-precision floating point unit (FPU). I am going to put my soft core into an FPGA and do some performance evaluation. The benchmarks are supposed ...
0
votes
1answer
77 views

Why isn't it necessary to store an integer part of significant in IEEE754 floating point notation?

We see that there is a sign, exponent, and mantissa part for the notation. But, there is no location for the significant bit. Why isn't it necessary to store an integer part of significant in IEEE754 ...
2
votes
0answers
129 views

Stable and fast computation of the squared euclidean distance matrix

Let's say I want to compute the matrix $M$ of the squared euclidean distances between each pair of vectors $(x, y)$ belonging to two sets $X$ and $Y$ respectively. The sets of vectors $X$ and $Y$ have ...
4
votes
2answers
247 views

Proof that (x-y)(x+y) is more accurate than x²-y²

I was carrying on my reading of What Every Computer Scientist Should Know About Floating-Point Arithmetic but got stuck on the proof of Theorem 2 (page 34). At some point it says: \begin{align} (x \...
2
votes
1answer
51 views

Proof that a guard digit bound the error of subtraction

I was reading What Every Computer Scientist Should Know About Floating-Point Arithmetic, which is extremely interesting. But I have some troubles understanding the proof of Theorem 9 (page 33). First ...
-2
votes
1answer
40 views

Doubt in definition of Float

Can anyone tell the meaning of the bold portion? Float: It is used to store decimal numbers (numbers with floating point value) with single precision.
0
votes
3answers
164 views

IEEE754 representation in hexadecimal?

In class, I've heard hexadecimal representation for IEEE754 mentioned and described in 32bit length as a format that consists of one bit for sign, normalized 6-digit fraction (with an implied leading ...
7
votes
5answers
1k views

Number of FLOPs (floating point operations) for exponentiation

What is the number of floating point operations needed to perform exponentiation (power of)? Assuming multiplication of two floats use one FLOP, the number of operations for $x^n$ will be $n-1$. ...
6
votes
1answer
510 views

Simple algorithm for IEEE-754 division on 8-bit CPU?

IEEE Std 754-2008 is the modern definition of Floating-Point Arithmetic. It requires that division (among other operations) performs as if it first produced an intermediate result correct to ...
0
votes
2answers
128 views

How to test for overflow when multiplying floats

I am trying to implement a 3-term recurrence relation: $$ p_{n+1} = ap_n + bp_{n-1} $$ This can be implemented as ...
0
votes
1answer
33 views

How does IEEE 754 decimal encoding work? [closed]

This may be a silly question, but if a computer works in binary how can you encript numbers using decimal?
5
votes
0answers
106 views

What is the state of the algorithmic art for floating point arithmetic on complex numbers?

Most modern compilers and processors implement the IEEE 754 binary formats for floating point numbers. IEEE 754 guarantees that the addition, subtraction, multiplication, division, and square root ...
1
vote
1answer
208 views

Binary Floating Point Range/Precision for 4-bit Mantissa and 4-bit Exponent

I'm trying to understand binary floating point and using just a 4-bit mantissa and a 4-bit exponent (both 2s compliment) to keep things simple. As far as I can tell, the largest denary number I can ...
1
vote
1answer
38 views

Why do I get different results from two calculation methods?

I am wondering what the reason for the following is We know that , exponential has a taylor representation : $$exp(x)=1+x+\frac{x^{2}}{2!}+\frac{x^{3}}{3!}+...$$ Using the first n terms , in R , ...
1
vote
2answers
59 views

Increased rounding relative error when subtracting

I'm reading the book "Lessons in Scientific Computing" by Schoerghofer and it says: If x and y are real numbers of the same sign, their sum x + y has an absolute error that adds the two ...
1
vote
1answer
69 views

Addition errors in IEEE754 floating point representation

So in class, we were talking about the idea of floating point precision in IEEE754 format, and how, when some numbers are added, precision is lost. My professor then gave the following example of a ...
1
vote
0answers
2k views

Understanding denormalized numbers in floating point representation

I am confused about how denormalized numbers work in floating point representation. I was referring to Stallings book and this article. The book initially explains floating point number format in ...
1
vote
0answers
45 views

Accuracy and performance between a division and subtraction for a ratio in decibels

For comparing two images, one can use the Peak Signal-to-Noise Ratio (PSNR) metric, defined as follows: $\mathrm{PSNR} = 10 \cdot \log_{10}\left(\frac{\mathrm{MAX}^2}{\mathrm{MSE}}\right) = 20 \cdot \...
0
votes
0answers
29 views

Numbers lying between single and double precision

The IEEE floating point number format is defined as $$s\underbrace{c_1\dots c_m}_\text{exponent}\underbrace{f_1\dots f_n}_\text{fraction}\text{ (*)}$$ with $s, c_i, f_j$ being either $1$ or $0$. The ...