'machine' epsilon

Axel Vogt's picture
Working in usual programming languages there is a largest machine epsilon
with 1 + epsilon != 1.

Now I am working with floats in Maple and want something similar: given a
real constant x (as positive floating point number) and m:=floor(log10(x))
(= ilog10(x) scales the x (down or up) to be of size 1). 

My question is:

Does the following always evaluate to "true"

  x + epsilon = x; evalf(eval(%, epsilon= 1/10^(Digits-m)));

and to "false" if taking m+1 instead?


Sorry, stupidly can not find the answer in the docu ...
Robert Israel's picture

epsilon

Yes, this should be correct. Of course to actually
get "true" or "false" rather than an equation, you need to apply evalb to it.

NextAfter

See the help page for NextAfter.

> Digits := 20:             
> epsilon := NextAfter(0,1);
                                                                   -20
                                                  epsilon := 0.1 10

> 1+epsilon;                
                                                 1.0000000000000000000

That isn't quite what you want, but...

Axel Vogt's picture

Thx for both the answers

Thank you for both the answers!

The reason for the question was how to terminate summing a series
with reasonable fast decaying summands, I felt unsure for that.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}