Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Explanation pls
Message
De
06/03/2011 03:35:04
 
 
À
05/03/2011 15:12:40
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Divers
Thread ID:
01502561
Message ID:
01502758
Vues:
49
>>>Question 2: Why does this throw an exception :-} :
Double d2 = Double.Parse(Double.MaxValue.ToString());
>
>OK... you made me go and write a large number library. <grin> (I've always wanted one LOL.)
>
1.79769313486232E+308 = ((2^971) * ((2^53)-1)) = 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368
>
>Here you can see the rounding problem:
>
179769313486232
>1797693134862315
>
>So... the ToString() value actually does exceed the max.
>
>That was fun.

No it wasn't ! I had to buy a bigger monitor :-}
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform