Questions tagged [epsilon]

The machine epsilon gives an upper bound on the relative error due to rounding in floating point arithmetic. The quantity is also called "macheps" or "unit roundoff".

The IEEE standard does not define the terms machine epsilon and unit roundoff, so differing definitions of these terms are in use, which can cause some confusion.

The following different definition is much more widespread outside academia: Machine epsilon is defined as the smallest number that, when added to one, yields a result different from one.

158 questions
3
votes
4 answers

Using an epsilon value to determine if a ball in a game is not moving?

I have balls bouncing around and each time they collide their speed vector is reduced by the Coefficient of Restitution. Right now my balls CoR for my balls is .80 . So after many bounces my balls have "stopped" rolling because their speed has…
mmcdole
  • 91,488
  • 60
  • 186
  • 222
3
votes
4 answers

How to get around some rounding errors?

I have a method that deals with some geographic coordinates in .NET, and I have a struct that stores a coordinate pair such that if 256 is passed in for one of the coordinates, it becomes 0. However, in one particular instance a value of…
Jake Petroules
  • 23,472
  • 35
  • 144
  • 225
3
votes
3 answers

How do I loop through every value of a double in an interval?

I read here and concluded that the minimum(absolute ...) value for double is 1.7e-308 but my code loops forever: for (double d(-1.0); d <= 1.0; d+=1.7e-308) { } Edit: I want to loop from -1.0 to 1.0 in the smallest possible increment.
3
votes
2 answers

Transformation Language Text to Model

ATL is a transformation language that allows to make model to model transformations, but I want to know if with this transformation language it's possible to make text to model transformation (already having a defined Ecore metamodel) or I must have…
2
votes
1 answer

My for loop is adding +1 excess and i do not know why

Basically im trying to make a program that loops through the given array, and checks if the right element is 2x bigger than the left one, if true inserts average value of those two elements in the middle. After that, it prints out the array with…
casual
  • 39
  • 6
2
votes
1 answer

C: Calculated machine epsilon differs from limits.h

I tried to use the following program to estimate the machine epsilon with a simple C program #include #include #include int main(){ float f = 1.0f; float prev_f = 1.0f; while( 1 + f != 1 ){ prev_f = f; …
Achnos
  • 83
  • 8
2
votes
1 answer

Why we define eps= 1 and divide by 2 when writing a program to determine "machine precision" in python

So I already have my program to determine my "machine precision" or my epsilon: epsilon = 1 while 1 + epsilon != 1: epsilon_2=epsilon epsilon /= 2 print(epsilon_2) and I already confirmed that it is right. My problem is that I don't…
2
votes
1 answer

How determine optimal epsilon value in meters for DBSCAN by plotting KNN elbow

Before doing DBSCAN I need to find optimal epsilon value, all the points are geographical coordinates, I need the epsilon value in meters before convert it to radians to apply DBSCAN using haversine metrics from sklearn.neighbors import…
2
votes
1 answer

Coding Isomap (& MDS) function using only numpy and scipy in python

I have coded Isomap function starting with computing the eulidean distance matrix (using scipy.spatial.distance.cdist), next basing on K-nearest neighbors method and Dijkstra algorithm (to determinate the shortest path) I have Computed the full…
2
votes
1 answer

What do multiples of machine epsilon mean?

I'm trying to investigate the source of residuals of a matrix equation problem (Ax=b). To verify my answer, I subtract Ax-b, expecting 0. Instead of "pure" zeros, I obtain values in the same order of magnitude as machine epsilon, which is fine. The…
hopper19
  • 153
  • 1
  • 9
2
votes
1 answer

Machine epsilon calculation is different using C11 and GNU11 compiler flags

When using Python & Julia, I can use a neat trick to investigate machine epsilon for a particular floating point representation. For example, in Julia 1.1.1: julia> 7.0/3 - 4/3 - 1 2.220446049250313e-16 julia> 7.0f0/3f0 - 4f0/3f0 -…
Moustache
  • 394
  • 2
  • 14
2
votes
1 answer

Epsilon closure & automata

I think I do not quite understand the concept of epsilon transitions when determining the language of a non-deterministic automata. For example in this automata: The language is: 'A double sequence of a or a double sequence of b where there is a…
2
votes
0 answers

Is there an SQL Server equivalent for C# double.Epsilon and float.Epsilon ?

Does SQL Server define epsilon constants for float and real types ? In other words, a value which is small enough to be considered as insignificant ? in C#, there are double.Epsilon and float.Epsilon constants for that. Unfortunately, they are too…
tigrou
  • 4,236
  • 5
  • 33
  • 59
2
votes
1 answer

why use square root of epsilon as the small number

This question may be independent of the language, but I saw this post using R mentions using square root of epsilon as the small number: is.wholenumber <- function(x, tol = .Machine$double.eps^0.5) abs(x - round(x)) < tol Why there's a square…
YJZ
  • 3,934
  • 11
  • 43
  • 67
2
votes
0 answers

Solving the strict inequality with integer math and accounting for rounding errors

I have an array of floating point numbers of type T, where T could be either float or double T x[n]; These numbers are strictly positive and sorted, i.e. 0 < x[0] < x[1] < x[2] < ... < x[n-1] I want to find the smallest floating point number H of…
Fabio
  • 2,105
  • 16
  • 26