Stack Exchange Network

Stack Exchange network consists of 175 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
17 views

Determine rating of change from floating data

For example in this set of data (in ascending order of time) [ 100, 98, 105, 91, 108, 106, 110, 109] It is clearly the trend is rising but i would like to know how to determine the rate of change, ...
0
votes
0answers
66 views

How did they simplify this floating point expression?

Assume $D_hf(x) = \frac{f(x+h) - f(x-h)}{2h}$. Suppose $f$ can be evaluated with relative error bounded by $\epsilon$. Show that floating-point arithmetic with machine epsilon $\epsilon$ gives $...
0
votes
2answers
105 views

Why is $0.0180 = 0.0180$ false in MATLAB? [closed]

I am trying to do a small script in MatLab. What it does is load .txt data in to memory. The data comes in a few columns, and I need it to figure out in how many. The data in the .txt will look like ...
1
vote
1answer
58 views

Double-precision algorithm for inverse log gamma or log factorial?

Question in a nutshell: Can anyone point me to an algorithm for computing to double-precision floating-point (roughly 16 digits) the inverse of either log gamma or log factorial? In other words, if ...
0
votes
0answers
33 views

Two's complement addition issue

In a two's complement system, 16-bit binary numbers $0010010010010010$ and $1111110011111100$ can be represented in the decimal system as $9362$ and $-772$, correspondingly. Now, from what I've read ...
0
votes
1answer
28 views

46- and 64-bit integers

Some Cray supercomputers used to support 46-bit and 64-bit integer data types. What are the maximum and minimum values that we could express in a 46-bit integer? in a 64-bit integer? Is my ...
0
votes
0answers
32 views

23-bit mantissa and 9-bit exponent range and precision

I have the following problem which I would like to make sure that I understand correctly. So I would appreciate your help in this matter. Some computers (such as IBM mainframes) used to implement ...
0
votes
2answers
42 views

Numerical Accuracy: How many digits are correct?

I'm really not too sure how to go on about this: Problem. Julia (or take MatLab etc. (I guess.)) computes ...
1
vote
1answer
52 views

Why do harmonic series converge in a finite precision number system?

I'm new to numerical analysis. I'm still unclear as to why the harmonic series $\sum 1/k $, where k = 1, ... , infinity converges. I would appreciate any help! I can show that the sum does indeed ...
0
votes
1answer
37 views

How do we do arithmetic with negative floating point numbers?

I'm studying floating point arithmetic and understand everything in the positive domain but can't seem to wrap my head around how negative floating point numbers are dealt with. I understand that the ...
1
vote
1answer
42 views

How to compute amount of floating point operations for LU-decomposition of banded matrix?

I want to compute the amount of floating point operations, flops, needed for the LU-decomposition/factorization of a banded matrix A consisting of 5 nonzero diagonals. Matrix $A\in\mathbb{R}^{n \...
0
votes
1answer
25 views

Transform parabola to be tangent to line in point and through other point

Sorry for stupid question, but I give up. I've spent whole weekend to solve that and no results. Please help. I think I know the solution, but it doesn't work form me. So now I am not sure. I am not ...
2
votes
0answers
29 views

Removable singularities for rational functions with floating point coefficients

Suppose I have given a rational function $r(x)=p(x)/q(x)$ where $p$ is a degree $m$ polynomial and $q$ is a degree $n$ polynomial, both over the real numbers, and the coefficients of $p$ and $q$ are ...
0
votes
1answer
42 views

Adding two IEEE754 floating-point representations and interpreting the result.

This isn't for any class or homework. As part of my personal study, I'm trying to better understand the IEEE754 representation of decimal floating-point numbers in binary. I'd like to add two numbers: ...
0
votes
1answer
33 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
74 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
90 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
138 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
221 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
99 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
80 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
90 views

Floating Point Numbers - Machine numbers

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 ± and 0 available for the exponent. We interpret "+" as "+1" ...
2
votes
2answers
45 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
29 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
49 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
144 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
74 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
72 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
58 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
145 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
50 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
642 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
90 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
67 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
71 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
45 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
56 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
634 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
113 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
111 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. ...
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
78 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
57 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
65 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 ...
7
votes
0answers
133 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
114 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
59 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
192 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$ ...