How do I declare NaN (not a number) in Ruby? July 29, 2023 by Tarik Since Ruby 1.9.3 there is a constant to get the NaN value Float::NAN => NaN