A way to make doubles, floats, or longs ‘equal’.
Float a=1.56148; Float b=1.56139;
Float threshold = 0.00009 or 0.0001 //difference of Float a and Float b
if (Math.abs(a-b) <= threshold){//Or < threshold
//logic here
}
Continue reading “To Compare Float, Double, or Long Data Types”