[Ironruby-core] System.Double question
John Lam (DLR)
jflam at microsoft.com
Thu Jan 10 10:06:48 EST 2008
I fixed this on our side and will go out in the next push to SVN.
The fix was easy - rather than emitting the constant value, we emit a reference to the constant:
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Peter Bacon Darwin
Sent: Thursday, January 10, 2008 12:01 AM
To: ironruby-core at rubyforge.org
Subject: [Ironruby-core] System.Double question
I added this to the FloatOps class:
public const double MAX = double.MaxValue;
But this generated the following code in InitializerGenerated.cs:
This won't compile.
The compiler says that this number is too large for a double. Double.MaxValue is actually 1.7976931348623157E+308.
The initializer generator code calls ToString on the value of the constant to generate the SetConstant line of code. Unfortunately this only outputs 15 significant figures, causing the number to be rounded up to 1.79769313486232E+308, which of course is larger than double.MaxValue.
Any good ideas on how to work around this?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironruby-core