Dave Cramer wrote:
> Well, I have an interesting problem...
>
> Detecting that a value is greater than MaxLong?
>
> If I parse it using Double.parseDouble, and it is greater than LongMax
> by 1 or so, the value ends up actually being less due to rounding ?
>
> Any suggestions?
The problem is that you're going via a double, you're going to lose
precision there regardless of what you do (you don't have 64 bits of
mantissa+sign to play with).
If you want to retain precision, don't use a double as your intermediate
value. Perhaps extract everything before the first '.' and use
parseLong? That will truncate rather than round the value though.
I don't like the whole idea of silently losing data anyway..
-O