3. nan?
• True if the float is not a valid IEEE 754
floating point number.
• 0.0.nan? => false
• (0.0/0).nan? => true
• Float::NAN
Monday, September 19, 2011
4. nan?
• 0.0/0 => NaN
• This is in contrast to the
ZeroDivisionError that results when using
Fixnums to divide by zero.
Monday, September 19, 2011
7. zero?
• Only true for 0.0 or -0.0
• 0.0.zero? => true
• -0.0.zero? => true
• 0.0001.zero? => false
Monday, September 19, 2011
8. Tangent::Trivia
“The centre of York station was used as
the zero point for distance measurement
for much of the rail network in the North
East of England.” - http://www.flickr.com/photos/xerones/3887271255/
The lines, from the top:
1. Longlands Loop (Northallerton)
2. Market Weighton & Beverley
3. Micklefield Branch
4. Raskelf Curve
5. Sherburn Branch
6. York & Harrogate
7. York & Market Weighton
8. York & Newcastle
9. York & North Midland
10. York & Scarborough
Monday, September 19, 2011
10. finite?
• True if the float is a valid IEEE floating point
number; true if not Infinity and not NaN.
• 1.0.finite? => true
• 0.0.finite? => true
• (0.0/0).finite? => false (NaN)
• (1.0/0).finite? => false (Infinity)
Monday, September 19, 2011
11. Infinity is a little weird
Monday, September 19, 2011
12. infinite?
• Returns nil if float is finite
• Returns nil if float is NaN
• Returns -1 if float is -infinity
• Returns +1 if float is +infinity
Monday, September 19, 2011