c# - Convert double (0.1) to BigRational and back -


i must missing something, when try create bigrational double value 0.1 gives me long nonsense value. converting gives 0.0:

double d = 0.1;                      // 0.1 bigrational br = new bigrational(d); // 3602879701896397/71213961919824440... double d2 = (double)br;              // 0.0 

what missing? know 0.1 not representable in system.double surely bigrational can approximate enough round-trip it?

as @elgonzo explains:

this known issue year ago: bcl.codeplex.com/workitem/13051.

a commenter on referenced work item uploaded fix reads in 0.1 correctly.


Comments

Popular posts from this blog

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -