Check all values within a range

i want to check within a script if (var x) - (var y) is any number within the range -1 and 1… it should check every possible float number between that, say 0.000012… is that possible? i didn’t exactly understand how to use RangeAttribute.RangeAttribute…

it need not necessarily be RangeAttribute.RangeAttribute, can anyone help me get the proper code to check the if condition…

if (x - y >= -1.0 && x - y <= 1.0) {…