I just found a bug in some number manipulations in my program and I'm getting a FloatDomainError (NaN)
So I started logging the number passed in with:
if(metric.is_a?(Numeric))
self.metric = metric
else
LOGGER.warn("metric #{metric} is not a number")
self.metric=0
end
But the number being passed in is NaN
which apparently is_a?(Numeric)
as I don't get my log warning, and it passes metric on to my metric= method, which is where I get my FloatDomainError
Now, correct me if I'm wrong, but doesn't it seem semantically wrong to have an NaN
(Not A Number) be of type Numeric ?? Can someone explain this to me?
BTW using Jruby-1.4.1