Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 17408
1 vote

$e^{-5}$ error using Taylor's series

Use a spreadsheet and calculate $e^{-100}$ both ways. It will become totally obvious what is going on. "We avoid subtraction" is not the problem. The problem is that you are adding the sum or differen …
gnasher729's user avatar
  • 31.6k
0 votes

Gap between numbers in fixed-point vs. floating point arithmetic

For ieee754 floating point numbers (the most common) we have abs(f(r) - r) <= c with a rather small c as long as r is in the range of normalised numbers. For tiny numbers (denormalised) it behaves lik …
gnasher729's user avatar
  • 31.6k
1 vote

Float type variable uncertainty

The number 1.19e-07 is the difference from 1.0 to the next larger representable floating point number. Single precision floating numbers have the form $x = ± 2^k m$, where k is a small integer, and 1 …
gnasher729's user avatar
  • 31.6k
0 votes
Accepted

(Numerical Analysis) What is the largest double float represented for the gamma function and...

Nice one. Using the standard ieee 754 double precision floating point format, we can exactly represent integers less than $2^{53}$, multiplied by a power of 2. When we try to find the largest n where …
gnasher729's user avatar
  • 31.6k
0 votes

How to determine the set of real numbers corresponding to a given floating point number?

The powers of two are more interesting than most other numbers. Assume you are using double precision IEEE 754 format floating point numbers. Let $u = 2^{-52}$, Then the next floating point number lar …
gnasher729's user avatar
  • 31.6k
1 vote

How to estimate floating-point precision of function?

There's no rule of thumb. There is analysis, and that analysis can be more or less elaborate, depending on what you want. Assume IEEE 754 double precision arithmetic in default rounding mode (round …
gnasher729's user avatar
  • 31.6k
1 vote

Is 2**x faster to compute than exp(x)?

Since 2^x = e^(x * ln 2) and e^x = 2^(x * log2 (e)), you wouldn't expect much difference. For x close to zero, one would usually use a polynomial e^x = 1 + x + x^2/2 + x^3/6 ..., nicely optimised to c …
gnasher729's user avatar
  • 31.6k
0 votes

Numerical Approximation in Java

Quote: "I don't think it's that simple. I am fairly certain that you cannot find a symbolic solution for x with the equation I provided above. " $$\frac{2*\sqrt{\pi}*h*s*e^{m^{2}/(2*s^2)}}{\sqrt{2}} …
gnasher729's user avatar
  • 31.6k
2 votes

Validity of Algorithm for Testing Two Floating Point Numbers

There is one method to compare floating point numbers for equality, which is both very simple and correct: You use the equality (==) operator. There is another method to compare whether floating point …
gnasher729's user avatar
  • 31.6k
0 votes

How can I compute logarithm when comparison is undecidable?

Logarithm is undefined for x<0 and -infinity when x=0, that’s something you have to handle somehow. For the test x < 1: whatever approximation you use for x >= 1 will most likely work for x > 0.9999. …
gnasher729's user avatar
  • 31.6k
6 votes
Accepted

The stability of log(1+x)

Consider the case that x is small. (1 + x) has a rounding error; the result that you get is not (1 + x) but (1 + x') for some x' close to x. If x is very small, the relative difference between x' and …
gnasher729's user avatar
  • 31.6k
0 votes

Is order of matrix multiplication affecting numerical accuracy of the result?

Interesting problem. Obviously with floating point involved, you can’t expect the same results, but we’d like to know what tended to give better results? In a completely unscientific way, you can per …
gnasher729's user avatar
  • 31.6k
2 votes

fast and stable x * tanh(log1pexp(x)) computation

My impression is that someone wanted to multiply x by a function f(x) that goes smoothly from 0 to 1, and experimented until they found an expression using elementary functions that did this, with no …
gnasher729's user avatar
  • 31.6k