Posted on 2007-05-21 15:37 By
Axel Vogt (
994)
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 ...
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.0000000000000000000That isn't quite what you want, but...
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.