# How do I prevent this precision exception?

I have the following as the first step to a sequence.

x = 2 - GoldenRatio;
Ceiling[x + x^(1/2)]


It gets a precision exception. The value is correct, but I would like to prevent the exception. (If we subtract 0.000001 from x, everything is fine.)

Is there a way to limit the precision? For one step only?

Edit: the sequence where 2-GoldenRatio is the seed.

x = 2 - GoldenRatio; t = Table[(x = Ceiling[x + x^(1/2)]), {2000}];


If ceiling is removed the first step works fine. However, I need the ceiling for alternate steps.

Edit2: $0 < x \leq 2-\phi$ where $\phi$ is the golden ratio. $\textit{When x = 2 -$\phi$, the first step equals$1$}$.

## 2 Answers

Does this get you what you need:

x = N[2 - GoldenRatio]
Ceiling[x + x^(1/2)]

0.381966
1


This doesn't get a precision exception.

This as per the update of your question also works without getting an error.

x = N[2 - GoldenRatio];
t = Table[(x = Ceiling[x + x^(1/2)]), {2000}];

• That's the ticket! – Fred Kline Jul 10 '12 at 3:03

Perhaps you could make a value inexact:

x = 2 - GoldenRatio;
x + x^(1/2)

1.


Or use FullSimplify:

x = 2 - GoldenRatio;
x + x^(1/2) // FullSimplify

1
`