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

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -