[Ironruby-core] System.Double question

Peter Bacon Darwin bacondarwin at googlemail.com
Thu Jan 10 03:00:51 EST 2008

I added this to the FloatOps class:



        public const double MAX = double.MaxValue;


But this generated the following code in InitializerGenerated.cs:


        def11.SetConstant("MAX", 1.79769313486232E+308);


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...
URL: http://rubyforge.org/pipermail/ironruby-core/attachments/20080110/889fb2ab/attachment-0001.html 

More information about the Ironruby-core mailing list