[#65451] [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string — ko1@...

Issue #10333 has been updated by Koichi Sasada.

9 messages 2014/10/07

[ruby-core:65893] [ruby-trunk - misc #10424] [Open] Error message when sorting NaN

From: jason.mark.thomas@...
Date: 2014-10-24 21:24:52 UTC
List: ruby-core #65893
Issue #10424 has been reported by Jason Thomas.

----------------------------------------
misc #10424: Error message when sorting NaN
https://bugs.ruby-lang.org/issues/10424

* Author: Jason Thomas
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
----------------------------------------
When sorting an array of floats with a NaN you get a very confusing message:
irb(main):001:0> [0.0/0.0,1.0,2.0].sort
ArgumentError: comparison of Float with Float failed

Sorting a nil is much friendlier:
irb(main):012:0> [nil,1.0,2.0].sort
ArgumentError: comparison of NilClass with Float failed

This is confusing for many. Simply google for "comparison of Float with Float failed" and makes for a difficult debugging session for anyone who doesn't know that NaN produces this result. What I would expect is:
irb(main):001:0> [0.0/0.0,1.0,2.0].sort
ArgumentError: comparison of NaN with Float failed




-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next