Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [floating-point]

Mathematical questions concerning floating point numbers, a finite approximation of the real numbers used in computing.

0
votes
0answers
8 views

Costs of $LU$ decomposition and directly solving for banded matrix

Let $A\in\mathbb{R}^{(N+1)^{2}\times(N+1)^{2}}$ be a matrix with a banded sparsity structure, only on diagonal $-N,-1,0,1$ and $N$ there are nonzero elements. My question is: how are the ...
0
votes
1answer
25 views

Prove that in a floating point system with truncation the number of significant digits is $n$.

I was requested to prove that in a floating point system $\text{F}(\beta, n, m, M)$ with truncation the number of significant digits is $n$. (where $n$ is the number of digits and $m < \text{...
0
votes
0answers
65 views

Why Cardinality not the same for rounded floats?

I need to solve a question: Two float values are equivalent if they return same integer with Math.round(). Why the equivalence classes arising from this ...
2
votes
1answer
39 views

Detect (catastrophic) cancellation in sums

In finite precision arithmetic, what are ways to detect (catastrophic) cancellation when adding $N\in\mathbb{N}$ numbers? Example ($N=2$): When adding two numbers $a$ and $b$ the result $a+b$ might ...
1
vote
0answers
105 views

How to prove the bound for Relative Round Off error

Machine precision is defined as the smallest machine number ε. Anything smaller when added to 1 will be lost at roundoff. Prove that ε is the bound for relative round-off error. ...
0
votes
0answers
191 views

How to prove fl(x^k) definition

How would I show that fl(x^k)= (x^k)(1 + δ)^(k−1), where |δ| ≤ ,ε if x is a floating-point machine number in a computer that has machine precision . Edit: I was thinking I can use induction to ...
1
vote
0answers
70 views

How to find smallest and largest representable number possible given a Normalized Floating Point System

Let's say you are given the normalized floating-point system: $R_3(3, 1)$ with exponent range $−1 ≤ e ≤ 1$ The base is $3$, mantissa length is $3$ and exponent length is $1$. How would you go about to ...
0
votes
0answers
35 views

Error bound of chopping and rounding for floating-point

The floating point representation for a binary number $x$ is written as $$x =\sigma \cdot \bar{x}\cdot 2^e$$ where $\sigma$ denotes the sign of $x$, $e$ is an integer denotes the exponent and $\bar{x}...
1
vote
1answer
83 views

Floating Point Numbers - Machine numbers

Okay, I will put the exercise in and explain my problem. "Consider the set of machine numbers $M(10, 2, 0)$. (The ’zero-length’ for the exponent is to be understood such that there is only the sign ± ...
2
votes
2answers
40 views

How many bits to represent these numbers precisely?

Consider the following numbers: $$19=10011_b, 12.75=1100.11_b, 7.125=111.001_b$$ What is the minimum number of bits necessary to represent the above three numbers precisely? A system like the IEEE ...
0
votes
2answers
27 views

How to get the fractional part of a product of large numbers with machine precision?

Let us have about 100 or so random (exact) floats such as: $$ A_1 = 1234123.428\\ A_2 = 13713.4193\\ A_3 = 0.1332\\ A_4 = 123.13213\\ ...$$ Now I want to find an efficient way to get the fractional ...
1
vote
0answers
44 views

Numerical Analysis- Finding two closest machine numbers in single precision.

There is a question that is similar to this that was asked already, but the answer did not really make too much sense to me. Let's say I have a number 4096.000244 and I want to find the two closest ...
0
votes
2answers
103 views

Integer part of natural logarithm

Please, does anyone know of a algorithm to compute the integer part $n$ of natural logarithm of an integer $x$? $$n = \lfloor \ln(x) \rfloor$$ Preferably using integer arithmetic only (akin to ...
0
votes
0answers
48 views

Standards for representing real numbers in computers (other than floating point)?

Some year ago I made a small discourse and investigated some representations for real number approximation, for example quotient between integers, satisfying this equation $$ax - b = 0 \...
1
vote
1answer
70 views

Can differentiation be defined for floating point numbers? [closed]

Can differentiation be defined for floating point numbers (e.g. 32 bit floats or 64 bits doubles)? I think one can have limit points in floating point numbers, I read somewhere that they have a ...
0
votes
1answer
50 views

How to compute rounding error bound?

I am using the IEEE754 half-precision floating point format, which has 11 significand bits. My input is drawn randomly with values between 1.0 and 2.0. I would like to approximate the maximum ...
2
votes
1answer
40 views

Verification: Machine number immediately to right and left of $2^m$

The question I'm given is what are the machine numbers immediately to the right and left of $2^m$? How far is each from $2^m$? I'm given the machine epsilon, $\epsilon$ is $2^{-23}$. (I believe we ...
1
vote
1answer
86 views

Between an adjacent pair of nonzero IEEE single precision real numbers, how many IEEE doubles are there?

My calculation: consider an adjacent pair of IEEE single precision floating point numbers (known as "floats" in C++ for example). Then the gap between those numbers is the corresponding machine ...
3
votes
1answer
36 views

Numerically-robust methods of calculating $1-(1-x)^n$ for $n >> 1$ and a wide dynamic range of $x$

I am trying to calculate $y = 1-(1-x)^n$ for $n$ in the 50-500 range, where $x$ ranges widely between, say, $10^{-20}$ and 1. The straightforward way is not numerically robust, and loses precision ...
1
vote
1answer
279 views

Machine Epsilon meaning

Say we have the floating-point system $(2,3,-1,2)$ and we want to find machine epsilon. According to my textbook, this can be found as $\epsilon_m=\beta^{1-t} = 2^{1-3}=0.25$. However, my textbook ...
0
votes
0answers
54 views

General way to quantize floating point numbers into arbitrary number of bins?

I want to quantize a series of numbers which have a maximum and minimum value of X and Y respectively into arbitrary number of ...
1
vote
1answer
57 views

Numerically approximating limit with large numbers, bumping up against machine precision

Consider $\lim_{x\rightarrow\infty}(1+\frac1x)^{x}=e$. Using standard calculus techniques, this limit can be evaluated, however, approximating it directly with numerical code can be difficult ...
0
votes
0answers
70 views

How many floating point multiplications required to evaluate a Newton interpolant of degree 4? Given interpolation points and values of x.

I'm a bit lost on this question. I can easily evaluate the $x_k$'s but I'm unsure of how to go about calculating the amount of floating point multiplications. I understand that for $x=-1$ it's just a ...
1
vote
0answers
38 views

Hardware implementations of floating-point numbers have uses for “negative zero”; is there any use for “imaginary negative zero”?

I've been studying low-level hardware implementations of floating point numbers and doing an exercise to design a custom floating point implementation. I know that being able to represent negative ...
0
votes
1answer
40 views

Floating point arithmetic ( IEEE-754 standard ) commutative law (*,+)

How can I prove that: $ fl(a \ op \ b) = fl(b \ op \ a), \: op = +,*.$. I have been reading and searching the big majority say that its true. like here. However, I can not find a mathematical proof ...
1
vote
4answers
307 views

Exact representation of floating point numbers

Why do 1000.5, 1/16 and 1.5/32 have an exact representation in an arbitrary (finite) normalized binary floating point number system but 123.4, 0.025 and 1/10 don't? How can this easily been seen ...
3
votes
0answers
79 views

Error bound for floating-point interval dot product

In Handbook of Floating-Point Arithmetic (Birkhäuser, 2010, Chapter 6) Muller et al. presented the following absolute forward error bound for the floating-point recursive dot product: $$ \left|...
0
votes
1answer
80 views

Floating point representation

Consider the following two 8-bit floating-point representations based on the IEEE floating point format. The most significant bit represents the sign bit. Format A: There are k=3 exponent bits. The ...
1
vote
0answers
32 views

What does the floating point arithmetic contribute to the rounding error in Mathematica?

I am a theoretical mathematician who works on the iterative method to find some generalized inverse of my interest. When I have tried some numerical example in Mathematica $11.0$, this does not ...
4
votes
2answers
76 views

What is the correct way to round 331.449999 to 1 decimal place

Should 331.449999 be 331.4 or 331.5? I can see a issue with a programming framework I am using. I think I am getting erroneous results in some cases and wanted to make sure I am using the right math ...
0
votes
0answers
43 views

Why floating point relative accuracy is needed?

In checking convergence of an iterative method, I have found that MATLAB uses the following code:dw = max(max(abs(W-Wnew) / (sqrt(eps)+max(max(abs(Wnew)))))); Here,...
0
votes
0answers
58 views

Understanding Floating point arithmetic

I really am in need of understanding floating point arithmetic, and I need an indepth knowledge of floating point arithmetic. The behaviour of most books that just touch the subject is like described ...
0
votes
1answer
28 views

Distinguising two error terms in rounding error

Considering two non-floating-point numbers $x$ and $y$, we write their floating point representation as $\operatorname{fl}(x)$ and $\operatorname{fl}(y)$ respectively. By $\circ$, we denote an ...
0
votes
0answers
81 views

Conditioning of the linear systems in the inverse or Rayleigh quotient iteration algorithms

I'm working through the book Numerical Linear Algebra by Trefethen and Bau. In Lecture 27 (and exercise 27.5), the following claim is made about the inverse iteration algorithm: Let $ A $ be a real, ...
1
vote
1answer
51 views

Understanding the amount of FLOPS required to perform a single iteration in GCR

Exercise: Determine the amount of memory and flops for iteration $i$ of the following (GCR) algorithm: $$\begin{split}\text{for }&i = 1,2,\ldots\text{ do}\\&s^i = r^{i-1},\\&v^i = As^i,\\&...
0
votes
1answer
47 views

Writing A Number In Floating Point With $5$ Significant Digits

Write the number $496354.1$ with $5$ significant digits by chopping and rounding Now for chopping we can write it as $0.49635*10^5$ or $4.9635*10^4$ which is the correct way?
3
votes
2answers
89 views

How to convert $\ln x - \ln y$ into a more accurate floating point representation?

I have an equation $\ln(x) - \ln(y)$ where x and y are very close to eachother. For example if $x = 5.1234$ then something like $fl(\ln(5.1234)) = 1.6338$ (with 4 significant digits). If $y = 5.1233$ ...
0
votes
0answers
29 views

product of hexdecimal floating-point

For this question, assume that the most-sigificant bit of a 24-bit floating point number is used as a sign bit. The remaining fields after the sign bit are a 7-bit biased exponent field (-63 excess) ...
1
vote
1answer
233 views

The upper and lower limits of IEEE-754 standard

So there's something I just can't understand about ieee-754. The specific questions are: Which range of numbers can be represented by IEEE-754 standard using base 2 in single (double) precision? ...
0
votes
1answer
45 views

Obtaining Coefficients of Powers of polynomial (e.g., $P(x)^N$) for large N, becomes Numerically Unstable

Obtaining Coefficients of Powers of polynomial (e.g., $P(x)^N$) for large N, becomes Numerically Unstable I have a polynomial $P(x)$ where $-1\leq P(x) \leq 1$ for $-1 \leq x \leq 1$ and $-1\leq {\it ...
1
vote
2answers
82 views

Relativistiv kinetic energy and floating point

My function is $E(v)=mc^2(\frac{1}{\sqrt{1-v^2/c^2}} - 1)$, (c=3e8, m=1) and I have to calculate it for values of v between 1e-6 and 2.99e8. The point of this problem is floating point precision. For ...
8
votes
0answers
78 views

Theory of floating point math

We learn about groups, rings and fields in algebra - but floating point numbers (like double in many modern programming languages) do not form one of the above ...
3
votes
2answers
168 views

How to find difference between consecutive double precision numbers?

I have been studying floating point precision, and I came across double precision. I understand already that there are 1 bit reserved for the sign, 11 bits reserved for the exponent, and 52 bits ...
2
votes
3answers
100 views

What step have I missed in my calculation converting the binary representation of pi to decimal?

While I was reading this one wikipedia page on floating-point arithmetic, I stumbled upon a calculation that I found interesting. So, I decided just for fun to try and work it out. I used a ...
1
vote
1answer
92 views

Numerically stable way to calculate (a-b)/(c-d) where a~=b and c~=d

Is there a known general numerically-stable way to calculate $\frac{a-b}{c-d}$, where a is very close to b and c is very close to d, and all variables are stored as floating-point with some precision? ...
0
votes
1answer
183 views

$\operatorname{eps} = \inf\{\delta > 0 : f l(1 + \delta) > 1\}$

I have a question about the Machine-epsilon let $ \text{eps}$ be the relative machine error, so that $ \text{eps}=\frac{b^{1-m}}{2}$ with $b >1$ and the mantise $m$ I have to prove that $$ ...
1
vote
1answer
425 views

What is the second smallest C single precision positive floating number there is? (IEEE754)

Documentation on how single precision floating point numbers work in C can be found in various good places such as: IEEE754 32-bit single precision format https://en.wikipedia.org/wiki/Single-...
0
votes
3answers
50 views

calculating $1024\times(1.11111111)_{2}$

Question calculate $1024\times(1.11111111)_{2}$ in terms of power of $10$ My Confusion/Approach $1024*(1.11111111)_{2}=2^{10}(2-2^{-8})=2^{11}-2^{2}=2^{2}(2^{9}-1)$ I am not getting how $(1....
5
votes
0answers
92 views

Associativity in floating point arithmetic failing by two values

Assume all numbers and operations below are in floating point arithmetic with finite precision, bounded exponent and rounding to nearest. Are there $x,y$ positive such that $$\begin{align}(x+y)-x&...
0
votes
1answer
30 views

Using int and floating gives different value of LegendreP

I should post this in mathematica forum, sorry for the inconvenience. When I use LegendreP at mathematica 10.0, I found weird a thing happening. ...