Number Quantity_Remaining = Boundary.getQuantity_remaining ( Value can be anything 1,,2,20,(0.66),(3.54),(55.66),100);
if( Quantity_Remaining .doubleValue( ) == 0)
{
certain operations
}
When i am doing so it is giving the 100 % accurate results.As 0 is Autboxed to 0.0 in java 1.5.
But JTest is not allowing me to commit this as it is giving a warning : Floating Point Comparison can produce unexpected results so avoid their comparison.
The alternate to this that i can think of is following :
[ code]
Number Quantity_Remaining = Boundary.getQuantity_remaining ;
if( Double.valueOf(Quantity_Remaining).equals(new Double(0))
{
}
I Just want to ask whether this comparison can produce unexpected results/incorrect comparison under any circumstances.Or is it 100 % safe to do this sort of comparison of double values.
Thanks !!!!!