Forum: IronRuby Code Review (External): NumericalFixes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9d5a4bd314818560d935f2c1a4f0d2f2?d=identicon&s=25 Peter Bacon Darwin (Guest)
on 2008-10-07 15:47
(Received via mailing list)
Attachment: numeric_fixes.diff (10 KB)
A number of fixes to pass most of the relevant rubyspecs.

                BignumOps.cs: Leftshift and Rightshift fixes

                FixnumOps.cs: Leftshift, Rightshift, Bitwise_Xor,
Bitwise_And and Bitwise_Or fixes

                FloatOps.cs: Constant and IsNegativeZero modification.
Also
partial fix to ToS

                Integer.cs: DownTo and UpTo fixes

                Numeric.cs: Remainder and Step fixes.



(There are now only 2 failures in Numeric, 1 in Float and a number in
Bignum.)
9d5a4bd314818560d935f2c1a4f0d2f2?d=identicon&s=25 Peter Bacon Darwin (Guest)
on 2008-10-09 12:11
(Received via mailing list)
Ping!



From: Peter Bacon Darwin [mailto:bacondarwin@googlemail.com]
Sent: Tuesday,07 October 07, 2008 14:38
To: 'ironruby-core@rubyforge.org'
Subject: Code Review (External): NumericalFixes



A number of fixes to pass most of the relevant rubyspecs.

                BignumOps.cs: Leftshift and Rightshift fixes

                FixnumOps.cs: Leftshift, Rightshift, Bitwise_Xor,
Bitwise_And and Bitwise_Or fixes

                FloatOps.cs: Constant and IsNegativeZero modification.
Also
partial fix to ToS

                Integer.cs: DownTo and UpTo fixes

                Numeric.cs: Remainder and Step fixes.



(There are now only 2 failures in Numeric, 1 in Float and a number in
Bignum.)
Ade8632553a9243ae05fc920f68644c1?d=identicon&s=25 Jim Deville (Guest)
on 2008-10-09 15:47
(Received via mailing list)
If you are running against the RubySpec's version of RubySpecs (as
opposed to the IronRuby repo) you may want to sync and test again. I
pushed some changes last night that make some of the float comparison do
numerical comparisons instead of string comparisons.


JD

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Peter Bacon
Darwin
Sent: Wednesday, October 08, 2008 10:09 AM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes

Ping!

From: Peter Bacon Darwin [mailto:bacondarwin@googlemail.com]
Sent: Tuesday,07 October 07, 2008 14:38
To: 'ironruby-core@rubyforge.org'
Subject: Code Review (External): NumericalFixes

A number of fixes to pass most of the relevant rubyspecs.
                BignumOps.cs: Leftshift and Rightshift fixes
                FixnumOps.cs: Leftshift, Rightshift, Bitwise_Xor,
Bitwise_And and Bitwise_Or fixes
                FloatOps.cs: Constant and IsNegativeZero modification.
Also partial fix to ToS
                Integer.cs: DownTo and UpTo fixes
                Numeric.cs: Remainder and Step fixes.

(There are now only 2 failures in Numeric, 1 in Float and a number in
Bignum.)
9d5a4bd314818560d935f2c1a4f0d2f2?d=identicon&s=25 Peter Bacon Darwin (Guest)
on 2008-10-09 16:22
(Received via mailing list)
Thanks Jim.  I pulled the latest rubyspecs and there are no unexpected
failures.



Still waiting for someone to review my code...



Pete



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Jim Deville
Sent: Wednesday,08 October 08, 2008 21:44
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



If you are running against the RubySpec's version of RubySpecs (as
opposed
to the IronRuby repo) you may want to sync and test again. I pushed some
changes last night that make some of the float comparison do numerical
comparisons instead of string comparisons.





JD



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Peter Bacon
Darwin
Sent: Wednesday, October 08, 2008 10:09 AM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



Ping!



From: Peter Bacon Darwin [mailto:bacondarwin@googlemail.com]
Sent: Tuesday,07 October 07, 2008 14:38
To: 'ironruby-core@rubyforge.org'
Subject: Code Review (External): NumericalFixes



A number of fixes to pass most of the relevant rubyspecs.

                BignumOps.cs: Leftshift and Rightshift fixes

                FixnumOps.cs: Leftshift, Rightshift, Bitwise_Xor,
Bitwise_And and Bitwise_Or fixes

                FloatOps.cs: Constant and IsNegativeZero modification.
Also
partial fix to ToS

                Integer.cs: DownTo and UpTo fixes

                Numeric.cs: Remainder and Step fixes.



(There are now only 2 failures in Numeric, 1 in Float and a number in
Bignum.)
A120eb09d383829bfa210bf656fcde4e?d=identicon&s=25 John Lam (IRONRUBY) (Guest)
on 2008-10-09 18:18
(Received via mailing list)
Looks good. Please check into SVN and I'll integrate. Note that I'm
pushing out r159 in a few minutes, so you'll need to update and
regenerate the initializers before you check in.

Thanks,
-John

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Peter Bacon
Darwin
Sent: Thursday, October 09, 2008 7:21 AM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes

Thanks Jim.  I pulled the latest rubyspecs and there are no unexpected
failures.

Still waiting for someone to review my code...

Pete

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Jim Deville
Sent: Wednesday,08 October 08, 2008 21:44
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes

If you are running against the RubySpec's version of RubySpecs (as
opposed to the IronRuby repo) you may want to sync and test again. I
pushed some changes last night that make some of the float comparison do
numerical comparisons instead of string comparisons.


JD

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Peter Bacon
Darwin
Sent: Wednesday, October 08, 2008 10:09 AM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes

Ping!

From: Peter Bacon Darwin [mailto:bacondarwin@googlemail.com]
Sent: Tuesday,07 October 07, 2008 14:38
To: 'ironruby-core@rubyforge.org'
Subject: Code Review (External): NumericalFixes

A number of fixes to pass most of the relevant rubyspecs.
                BignumOps.cs: Leftshift and Rightshift fixes
                FixnumOps.cs: Leftshift, Rightshift, Bitwise_Xor,
Bitwise_And and Bitwise_Or fixes
                FloatOps.cs: Constant and IsNegativeZero modification.
Also partial fix to ToS
                Integer.cs: DownTo and UpTo fixes
                Numeric.cs: Remainder and Step fixes.

(There are now only 2 failures in Numeric, 1 in Float and a number in
Bignum.)
9d5a4bd314818560d935f2c1a4f0d2f2?d=identicon&s=25 Peter Bacon Darwin (Guest)
on 2008-10-09 21:02
(Received via mailing list)
Pushed the bug fixes to SVN r160.  Someone on MS side needs to look at
ironruby-tags and make sure it is up to date.

Pete



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of John Lam
(IRONRUBY)
Sent: Thursday,09 October 09, 2008 17:17
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



Looks good. Please check into SVN and I'll integrate. Note that I'm
pushing
out r159 in a few minutes, so you'll need to update and regenerate the
initializers before you check in.



Thanks,

-John



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Peter Bacon
Darwin
Sent: Thursday, October 09, 2008 7:21 AM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



Thanks Jim.  I pulled the latest rubyspecs and there are no unexpected
failures.



Still waiting for someone to review my code...



Pete



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Jim Deville
Sent: Wednesday,08 October 08, 2008 21:44
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



If you are running against the RubySpec's version of RubySpecs (as
opposed
to the IronRuby repo) you may want to sync and test again. I pushed some
changes last night that make some of the float comparison do numerical
comparisons instead of string comparisons.





JD



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Peter Bacon
Darwin
Sent: Wednesday, October 08, 2008 10:09 AM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



Ping!



From: Peter Bacon Darwin [mailto:bacondarwin@googlemail.com]
Sent: Tuesday,07 October 07, 2008 14:38
To: 'ironruby-core@rubyforge.org'
Subject: Code Review (External): NumericalFixes



A number of fixes to pass most of the relevant rubyspecs.

                BignumOps.cs: Leftshift and Rightshift fixes

                FixnumOps.cs: Leftshift, Rightshift, Bitwise_Xor,
Bitwise_And and Bitwise_Or fixes

                FloatOps.cs: Constant and IsNegativeZero modification.
Also
partial fix to ToS

                Integer.cs: DownTo and UpTo fixes

                Numeric.cs: Remainder and Step fixes.



(There are now only 2 failures in Numeric, 1 in Float and a number in
Bignum.)
A120eb09d383829bfa210bf656fcde4e?d=identicon&s=25 John Lam (IRONRUBY) (Guest)
on 2008-10-11 00:08
(Received via mailing list)
You changed this line:

            StringFormatter sf = new StringFormatter(scope, "%.15g", new
object[] { self });

To:

            StringFormatter sf = new StringFormatter(scope, "%.14g", new
object[] { self });

Why the reduced # of digits? This is causing one of the specs to fail:

1)
Math.sqrt returns the square root of the argument FAILED
Expected "123456789.12346"
 to equal "123456789.123457"

Thanks,
-John

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Peter Bacon
Darwin
Sent: Thursday, October 09, 2008 12:00 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes

Pushed the bug fixes to SVN r160.  Someone on MS side needs to look at
ironruby-tags and make sure it is up to date.
Pete

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of John Lam
(IRONRUBY)
Sent: Thursday,09 October 09, 2008 17:17
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes

Looks good. Please check into SVN and I'll integrate. Note that I'm
pushing out r159 in a few minutes, so you'll need to update and
regenerate the initializers before you check in.

Thanks,
-John

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Peter Bacon
Darwin
Sent: Thursday, October 09, 2008 7:21 AM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes

Thanks Jim.  I pulled the latest rubyspecs and there are no unexpected
failures.

Still waiting for someone to review my code...

Pete

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Jim Deville
Sent: Wednesday,08 October 08, 2008 21:44
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes

If you are running against the RubySpec's version of RubySpecs (as
opposed to the IronRuby repo) you may want to sync and test again. I
pushed some changes last night that make some of the float comparison do
numerical comparisons instead of string comparisons.


JD

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Peter Bacon
Darwin
Sent: Wednesday, October 08, 2008 10:09 AM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes

Ping!

From: Peter Bacon Darwin [mailto:bacondarwin@googlemail.com]
Sent: Tuesday,07 October 07, 2008 14:38
To: 'ironruby-core@rubyforge.org'
Subject: Code Review (External): NumericalFixes

A number of fixes to pass most of the relevant rubyspecs.
                BignumOps.cs: Leftshift and Rightshift fixes
                FixnumOps.cs: Leftshift, Rightshift, Bitwise_Xor,
Bitwise_And and Bitwise_Or fixes
                FloatOps.cs: Constant and IsNegativeZero modification.
Also partial fix to ToS
                Integer.cs: DownTo and UpTo fixes
                Numeric.cs: Remainder and Step fixes.

(There are now only 2 failures in Numeric, 1 in Float and a number in
Bignum.)
9d5a4bd314818560d935f2c1a4f0d2f2?d=identicon&s=25 Peter Bacon Darwin (Guest)
on 2008-10-11 10:22
(Received via mailing list)
OK, I mean to raise a bug about this one.  There is some funniness
inside
MRI's string formatting of floating point numbers.  Feel free to change
it
back but then one of the Float specs fails.

I think the relevant one is something like:

10000000000000.0.to_s.should == "100000000000000.0"

100000000000000.0.to_s.should == "1.0E+15"

But IronRuby produces "1.0E+14" and "1.0E+15" or something like that.  I
think it has to do with whether you count the trailing zero as a
significant
digit.

Pete



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of John Lam
(IRONRUBY)
Sent: Friday,10 October 10, 2008 23:08
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



You changed this line:



            StringFormatter sf = new StringFormatter(scope, "%.15g", new
object[] { self });



To:



            StringFormatter sf = new StringFormatter(scope, "%.14g", new
object[] { self });



Why the reduced # of digits? This is causing one of the specs to fail:



1)

Math.sqrt returns the square root of the argument FAILED

Expected "123456789.12346"

 to equal "123456789.123457"



Thanks,

-John



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Peter Bacon
Darwin
Sent: Thursday, October 09, 2008 12:00 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



Pushed the bug fixes to SVN r160.  Someone on MS side needs to look at
ironruby-tags and make sure it is up to date.

Pete



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of John Lam
(IRONRUBY)
Sent: Thursday,09 October 09, 2008 17:17
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



Looks good. Please check into SVN and I'll integrate. Note that I'm
pushing
out r159 in a few minutes, so you'll need to update and regenerate the
initializers before you check in.



Thanks,

-John



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Peter Bacon
Darwin
Sent: Thursday, October 09, 2008 7:21 AM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



Thanks Jim.  I pulled the latest rubyspecs and there are no unexpected
failures.



Still waiting for someone to review my code...



Pete



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Jim Deville
Sent: Wednesday,08 October 08, 2008 21:44
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



If you are running against the RubySpec's version of RubySpecs (as
opposed
to the IronRuby repo) you may want to sync and test again. I pushed some
changes last night that make some of the float comparison do numerical
comparisons instead of string comparisons.





JD



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Peter Bacon
Darwin
Sent: Wednesday, October 08, 2008 10:09 AM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



Ping!



From: Peter Bacon Darwin [mailto:bacondarwin@googlemail.com]
Sent: Tuesday,07 October 07, 2008 14:38
To: 'ironruby-core@rubyforge.org'
Subject: Code Review (External): NumericalFixes



A number of fixes to pass most of the relevant rubyspecs.

                BignumOps.cs: Leftshift and Rightshift fixes

                FixnumOps.cs: Leftshift, Rightshift, Bitwise_Xor,
Bitwise_And and Bitwise_Or fixes

                FloatOps.cs: Constant and IsNegativeZero modification.
Also
partial fix to ToS

                Integer.cs: DownTo and UpTo fixes

                Numeric.cs: Remainder and Step fixes.



(There are now only 2 failures in Numeric, 1 in Float and a number in
Bignum.)
9d5a4bd314818560d935f2c1a4f0d2f2?d=identicon&s=25 Peter Bacon Darwin (Guest)
on 2008-10-11 22:55
(Received via mailing list)
I have submitted two bugs regarding this: 22384
<http://rubyforge.org/tracker/index.php?func=detail...
atid=16798>  and 22385
<http://rubyforge.org/tracker/index.php?func=detail...
atid=16798> .  I think for now you get less weirdness if you revert my
change below back to

            StringFormatter sf = new StringFormatter(scope, "%.15g", new
object[] { self });

But this is still not right.  The problem is that the trailing zero is
being
added in after the formatting but that a) it should be counted as a
significant digit and b) it is not being picked up when there is an
exponent
displayed.  I think that the StringFormatter needs to be fiddled with to
sort this out but I am wary of entering into this rather complex beast
in
case I break other stuff.

Regards,

Pete



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of John Lam
(IRONRUBY)
Sent: Friday,10 October 10, 2008 23:08
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



You changed this line:



            StringFormatter sf = new StringFormatter(scope, "%.15g", new
object[] { self });



To:



            StringFormatter sf = new StringFormatter(scope, "%.14g", new
object[] { self });



Why the reduced # of digits? This is causing one of the specs to fail:



1)

Math.sqrt returns the square root of the argument FAILED

Expected "123456789.12346"

 to equal "123456789.123457"



Thanks,

-John



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Peter Bacon
Darwin
Sent: Thursday, October 09, 2008 12:00 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



Pushed the bug fixes to SVN r160.  Someone on MS side needs to look at
ironruby-tags and make sure it is up to date.

Pete



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of John Lam
(IRONRUBY)
Sent: Thursday,09 October 09, 2008 17:17
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



Looks good. Please check into SVN and I'll integrate. Note that I'm
pushing
out r159 in a few minutes, so you'll need to update and regenerate the
initializers before you check in.



Thanks,

-John



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Peter Bacon
Darwin
Sent: Thursday, October 09, 2008 7:21 AM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



Thanks Jim.  I pulled the latest rubyspecs and there are no unexpected
failures.



Still waiting for someone to review my code...



Pete



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Jim Deville
Sent: Wednesday,08 October 08, 2008 21:44
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



If you are running against the RubySpec's version of RubySpecs (as
opposed
to the IronRuby repo) you may want to sync and test again. I pushed some
changes last night that make some of the float comparison do numerical
comparisons instead of string comparisons.





JD



From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Peter Bacon
Darwin
Sent: Wednesday, October 08, 2008 10:09 AM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Code Review (External): NumericalFixes



Ping!



From: Peter Bacon Darwin [mailto:bacondarwin@googlemail.com]
Sent: Tuesday,07 October 07, 2008 14:38
To: 'ironruby-core@rubyforge.org'
Subject: Code Review (External): NumericalFixes



A number of fixes to pass most of the relevant rubyspecs.

                BignumOps.cs: Leftshift and Rightshift fixes

                FixnumOps.cs: Leftshift, Rightshift, Bitwise_Xor,
Bitwise_And and Bitwise_Or fixes

                FloatOps.cs: Constant and IsNegativeZero modification.
Also
partial fix to ToS

                Integer.cs: DownTo and UpTo fixes

                Numeric.cs: Remainder and Step fixes.



(There are now only 2 failures in Numeric, 1 in Float and a number in
Bignum.)
This topic is locked and can not be replied to.