Questions tagged [floating-point]
Mathematical questions concerning floating point numbers, a finite approximation of the real numbers used in computing.
449
questions
0
votes
0
answers
19
views
Floating Point Precision Algorithm
In my database, data stored as a precision of 10 digits Decimal(30,10).
User can enter x or 1/x. I need to save in 1/x. If user enters ...
0
votes
0
answers
29
views
Secant method optimization - initial guesses with floating point precision?
Say I want to find the root of $f(x) = e^{-x} - 5$, and assume I start with initial guesses $x_0 = -3$ and $x_1 = 3$.
I define my update function as $x_i = x_{i-1} - f(x_{i-1}) * \frac{x_{i-1} - x_{i-...
-3
votes
1
answer
38
views
Binary math for with decimal numbers [closed]
How do you make the math operation to represent float numbers?
if example I want to represent 0.2 in binary.
1
vote
1
answer
58
views
Does using smaller floating-point numbers decrease rounding errors?
I started learning about floating point by reading "What Every Computer Scientist Should know About Floating-Point Arithmetic" by David Goldberg. On page 4 he presents a proof for the ...
0
votes
0
answers
18
views
How to calculate converted value for each number in a set using a conversion rate, having its sum equal exactly a rounded fixed converted total?
Say I have three numeric values: a total, converted total, and a conversion rate. These are fixed, given numbers, and the two totals always have the precision of two decimal places.
...
0
votes
0
answers
51
views
Finding an expression for $\sqrt{x^2 + z^2}$ that is more precise in floating point arithmetic?
Assuming that both $x$ and $z$ have no representation errors, and that $\vert z^2 \vert \ll \vert x^2 \vert$. There must exist an expression for $\sqrt{x^2 + z^2}$ that is the same in exact arithmetic ...
0
votes
0
answers
17
views
How to choose mantissa size and maximum exponent which are optimal for my use case?
I need to represent floating point values between $0$ and $2^{48}-1$, using at most $64$ bits.
I need to determine the optimal split of these $64$ bits into mantissa and exponent.
The scaling that I'm ...
0
votes
0
answers
21
views
How does a computer calculate matrix scalar multiplication order of operations (flops)
I am trying to understand the number of flops in the Householder QR factorization. In one line of the algorithm, it says
\begin{gather*}
v = v / \lVert v \rVert_2
\end{gather*}
I was wondering what ...
1
vote
1
answer
69
views
On the axioms of floating-point arithmetic
As I understand there are two "axioms" that should be satisfied in floating-point arithmetic:
$$\forall x\in \mathbb R,\ \exists |\varepsilon|\leq\varepsilon_{\text{machine}},\ \mbox{fl} (x) ...
0
votes
1
answer
52
views
Representation of rounding error in floating point arithmetic. [duplicate]
It is well known that in a Floating point number system:
$$
\mathbb{F}:=\{\pm \beta^{e}(\frac{d_1}{\beta}+\dots +\frac{d_t}{\beta^t}): d_i \in \{0,\dots,\beta-1\},d_1\neq 0, e_{\min}\leq e \leq e_{\...
1
vote
0
answers
26
views
Expression of sum in floating point system
This is a question of an exam on Numerical Analysis I had:
Consider the floating point system of base $2$, maximum number of decimals $53$, maximum exponent $1025$ and minimum exponent $-1022$. That ...
0
votes
2
answers
107
views
Evaluating $a(b + c)$ more accurately with FMA
I'm using machine-precision floating-point arithmetic, and every so often it happens that I need to evaluate an expression of the form $a(b + c)$. I found that the accuracy can be improved using FMA (...
2
votes
0
answers
55
views
Numerically stable evaluation of factored univariate real polynomial
Suppose we have a real univariate factored polynomial, meaning we have its factors: an arbitrary number of polynomials of degree less than or equal to two. To simplify things, if necessary, let's ...
0
votes
0
answers
45
views
Bias in Single Precision Floating numbers
I had a doubt regarding Single Precision Floating point numbers. It is about the bias number which can be derived from exponent part of this representation of numbers.
On searching up on google, most ...
3
votes
1
answer
91
views
How to compute this "smooth max operator"?
I was seeking for an alternate way to activate each neuron of a neural network non-linearly. Eventually, I came up with the following binary operation:
$$
x \lor y = \log (\exp x + \exp y)
$$
With $-\...
0
votes
0
answers
15
views
How to Multiply 2 arrays with unique non-integers to prodice an array with unique results?
Is there an Algortihm/formulae to multiply two arrays (1D & 2D) of unique numbers such that the resultant array contains unique results.
Would one have to create the 2 initial arrays in a certain ...
1
vote
1
answer
55
views
What is the set of all numbers that can be represented with a floating-point format?
Computers use single- (or, for more precise calculations, double-) precision floating-point formats to represent a subset of real numbers. While a decent chunk of real numbers can be stored with these ...
0
votes
0
answers
23
views
Bounding absolute error in floating point algorithm. Is my approach correct?
I'm writing a predicate to determine if two vectors are parallel or not. I work in spherical coordinates so my vectors are formed by crossing two other vectors. The operation is effectively:
$$
\...
1
vote
0
answers
35
views
Method for finding the largest positive difference between two pairs of IEEE 754 double precision floating point numbers and fixed-point numbers
I have two pairs of IEEE 754 double precision (64-bit) floating-point numbers and unsigned fixed-point numbers, and I'm trying to find which pair has the greatest difference.
The fixed-point numbers ...
0
votes
0
answers
34
views
Is converting between roots and coefficients of a polynomial numerically stable?
Assume we're on a computer using 32-bit floats (or something similar), and I'm converting back and forth between the $n$ coefficients of a polynomial and the corresponding $n$ roots of the polynomial. ...
0
votes
1
answer
31
views
storing decimal number into computer with finite mantissa
I am learning about numerical methods and the following link caught my attention:
https://www.iro.umontreal.ca/~mignotte/IFT2425/Disasters.html
So from what I understand 0.1 is not exactly ...
0
votes
0
answers
49
views
Proof of loss of orthogonality in Gram-Schmidt
I am stuck at understanding about how to derive the following proofs related to error bounds which are given in the following slides. Can anyone please explain to me how these are derived?
-1
votes
1
answer
38
views
fl(A) where A is a square matrix
We defined $fl(x)$ to be the function $fl:\mathbb{R} \rightarrow \mathbb R_b (t, s)$ (i.e., takes reals and outputs the float). What does $fl(A)$ mean when $A \in \mathbb R ^{n \times n} $? I assume ...
-3
votes
1
answer
71
views
trouble understanding floating point representation
I had a quiz last week on floating point representation. After he graded the quiz, he walked us through each step so that we could see what we did wrong. I took notes so that I could study his ...
-1
votes
1
answer
59
views
Determine The Base of The Venusian Numeration System [closed]
this question is from Thomas Koshy's book called "Discrete Mathematics With Applications":
Any idea how to do this question? I can tell that the base of the system is at least 3 (since we ...
0
votes
1
answer
73
views
Fast computation of $x^{1/p}$, where $x\in\mathbb{R}^+$ and $p=2^{n}$, where $n\in\mathbb{N}$ with bit shifts?
There is plenty of literature regarding the legendary Fast inverse square root routine from Quake, but can we do something similar to compute $x^{1/p}$ as given in the title?
Given that $p$ is a power ...
0
votes
2
answers
57
views
Algorithm for drawing generalised circles
A generalised circle is either a circle in the plane or a line. The general equation of one is:
$$A(x^2 + y^2) + Bx + Cy + D=0,$$
where $4AD - B^2 - C^2 \leq 0$. This can be checked by completing the ...
2
votes
0
answers
55
views
Adding inverses of nilpotents as an extension of the "extended real numbers"
This is an idea that I had while playing with an automatic differentiation system built on dual numbers. This system, like most computer algebra systems built on floating point arithmetic, has the ...
0
votes
0
answers
112
views
Are there any ways to increase the precision in MATLAB without built in functions?
I am a beginner learning about MATLAB scientific computation, floating point numbers, and numerical error. When I am using a very small $x$ value for some equations, such as $y(x) = (\exp(x)-1-x)/x^2$,...
3
votes
2
answers
98
views
Explanation for MATLAB floating point number calculation?
I am a beginner studying scientific computation, more specifically floating point numbers and precision in matlab. When testing the outputs of 2 of the following equations, I am not sure how matlab ...
0
votes
1
answer
36
views
Round-Off Unit Formula [duplicate]
My textbook states the following:
If $x\in \mathbb R$ such that $x_{\text{min}}\leq |x| \leq x_{\text{max}}$, then $$fl(x) = x(1+\delta) \text{ with } |\delta | \leq u$$ where $$u = \frac12 \beta^{1-...
0
votes
1
answer
84
views
What's the term for the coefficient that change any floating point number to its next or previous value?
I calculated that the following two coefficients will reduce any finite floating point number to its next exact lower value:
Single precision: 0.99999994
Double ...
2
votes
0
answers
58
views
Computational Game Theory, Why aren't Nash Equilibrium calculated with rational numbers instead of floating point numbers?
In algorithms like Counterfactual Regret Minimization/Regret Matching, most implementations are coded using floating point numbers to represent (average) strategies, and the value of the game is ...
4
votes
1
answer
276
views
Is There Any Good Way of Checking Floats for Approximate Equality?
I'm an EE, not a mathematician, so I apologize in advance if this question is dumb.
When working with floating point numbers, it is typically a bad idea to expect bitwise equivalence for reasons that ...
0
votes
0
answers
47
views
Find the smallest/largest scalar that converts a vector of reals to a vector of integers
Suppose there are two vectors: $\mathbf{x} \in \mathbb{R}^N$ and $\mathbf{y} \in \mathbb{Z}^N_+$. If I know that $\mathbf{x} = \alpha \cdot \mathbf{y}$, where $\alpha \in \mathbb{R}$, is there a way ...
0
votes
0
answers
102
views
How to do backward error analysis of $Ax=b$?
I know the definition of forward error, backward error and condition number. The following is a backward error analysis I think.
Let $A$ be a square matrix of order $n$ and $\hat{x}$ be a approximate ...
0
votes
0
answers
96
views
Polynomial Curve Fit without floating point
big math dummy here hoping to get some advice. I'm working on a closed loop servo system that requires a curve fit on some feedback. The controller for this system is $16$-bit. With the help of excel ...
1
vote
0
answers
97
views
The gap size of floating point
In Trefethen Bau Numerical Algebra, floating point set F is defined by
$\textbf{F} = \left\{\pm(m/\beta^{t})\beta ^{e}| 1 \leq m \leq \beta^{t}, e \in \mathbb{Z} \right\}$
Equivalently, by making $m$ ...
12
votes
1
answer
2k
views
What's special about the number $1.000000015047466$E+$30$?
I'm a programmer by trade by I've run into a weirdly special number and need some help deciphering its significance.
I was writing some machine learning code that compiles into GPU kernel code and the ...
0
votes
0
answers
97
views
What is the smallest positive number represented in the floating point system F(5,3,4,4) in decimal base?
I know this is easy but I have a feeling something is not right
We have the base 5. 3 is the number of significant digits and the 5 varies from -4 to 4. As the exercise asks for the smallest positive, ...
0
votes
0
answers
94
views
Condition number for the sum of two numbers
The condition number for the sum of two numbers $a$ and $b$ is $K=\frac{|a|+|b|}{|a+b|}$. But if I have $a=10$ and $b=-10$, I know that their difference is exactly $0$, so I have in practice no error, ...
1
vote
1
answer
179
views
Rounding error of matrix multiplication when one of the matrices is orthogonal
I am studying Scientific computing from Biswa Nath Datta's Numerical Linear Algebra and Applications and there is a corollary after explaining matrix multiplication rounding error described below.
if $...
0
votes
2
answers
68
views
Exact number representation to represent time from $1$ nanosecond (ns) to $1000$ seconds (sec)
I need help figuring out the exact number representation to represent time from $1$ nanosecond (ns) to $1000$ seconds (sec) with an accuracy of $1\%$. I know a floating-point is preferred over a fixed ...
0
votes
0
answers
249
views
Stability and Backward stability of arithmetic and series: Numerical Linear Algebra (Trefethen and Bau) Exercise 15.1
I can't post image with below-10 reputation. The image of the cited definition/problem description in the book is uploaded to Imgur and labeled as [Image:$\dots$]. Sorry for the inconvenience.
Context
...
0
votes
2
answers
50
views
How to deal with $e^{-x}$ when $x$ is too big ($x \gg 0$) and therefore $e^{-x}$ gives us a "prohibitive" value (computer context)?
I don't know how to formulate my question correctly but I'm going to try:
Suppose the following:
$\textbf{a} = e^{-101}$
$\textbf{b} = e^{-98}$
$\textbf{c} = e^{-97}$
$\textbf{W} = (\textbf{w}_0,\...
1
vote
0
answers
265
views
Number of FLOPs for the inner and outer vector product?
I'm trying to educate myself on the relative cost of the cross and dot products relative to the number of floating point operations (FLOPs) each one requires. My understanding based on this paper (see ...
0
votes
0
answers
39
views
How are results guaranteed in algorithms that include intermediate approximation?
Let me elucidate this vague question with an example. Consider for example the following Gauss sum of roots of unity
$N=(e^{2\pi i/5} + e^{2\pi i/4} e^{4\pi i/5} + e^{4\pi i/4} e^{8\pi i/5} + e^{6\pi ...
3
votes
2
answers
108
views
Cancellation Problem in Borwein's quartic Algorithm for computing $\pi$
In the center of Borwein's Algorithm from 1985 occurs a term $$T_n = 1-\sqrt[4]{1-y_n^4}$$ with $y_n \to 0_+$. For small $y_n$ you need 4 times the precision of result $T_n$ due to cancellation. With ...
18
votes
3
answers
1k
views
Polynomial for very large number of roots
Update: Please also see this solution here provided by MattL.
I have the roots for a very large order polynomial (>100), and from those alone wish to recreate the polynomial and run into numerical ...
0
votes
0
answers
117
views
How to Add the IEEE 754 single-precision floating-point numbers from hexadecimal?
Question:
Add the following IEEE 754 single-precision floating-point numbers.
(a) C0123456 + 81C564B7
(c) 5EF10324 + 5E039020
I know I first need to convert to binary, then add and later change into ...