[前][次][番号順一覧][スレッド一覧]

ruby-changes:26805

From: tenderlove <ko1@a...>
Date: Thu, 17 Jan 2013 10:50:25 +0900 (JST)
Subject: [ruby-changes:26805] tenderlove:r38857 (trunk): * ext/psych/lib/psych/scalar_scanner.rb: use constants rather than

tenderlove	2013-01-17 10:49:55 +0900 (Thu, 17 Jan 2013)

  New Revision: 38857

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38857

  Log:
    * ext/psych/lib/psych/scalar_scanner.rb: use constants rather than
      calculating Inf and NaN.

  Modified files:
    trunk/ChangeLog
    trunk/ext/psych/lib/psych/scalar_scanner.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38856)
+++ ChangeLog	(revision 38857)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jan 17 10:48:56 2013  Aaron Patterson <aaron@t...>
+
+	* ext/psych/lib/psych/scalar_scanner.rb: use constants rather than
+	  calculating Inf and NaN.
+
 Thu Jan 17 10:21:05 2013  Eric Hodel  <drbrain@s...>
 
 	* doc/syntax/miscellaneous.rdoc:  Added Ending an Expression and
Index: ext/psych/lib/psych/scalar_scanner.rb
===================================================================
--- ext/psych/lib/psych/scalar_scanner.rb	(revision 38856)
+++ ext/psych/lib/psych/scalar_scanner.rb	(revision 38857)
@@ -68,11 +68,11 @@ module Psych https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych/scalar_scanner.rb#L68
           string
         end
       when /^\.inf$/i
-        1 / 0.0
+        Float::INFINITY
       when /^-\.inf$/i
-        -1 / 0.0
+        -Float::INFINITY
       when /^\.nan$/i
-        0.0 / 0.0
+        Float::NAN
       when /^:./
         if string =~ /^:(["'])(.*)\1/
           @symbol_cache[string] = $2.sub(/^:/, '').to_sym

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]