Sum a lot of numbers...

Justin Whear via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 10 10:20:26 PDT 2014


On Thu, 10 Jul 2014 17:17:40 +0000, Justin Whear wrote:

> On Thu, 10 Jul 2014 17:16:00 +0000, Alexandre wrote:
> 
>> Hi :)
>> 
>> I need to sum a list of numbers... but, when I calculate the sum of
>> this numbers, I got a simplify representation of sum:
>> 
>> 2.97506e+,12
>> 
>> How I can make to get the correctly representation of this number ?
> 
> A full decimal representation can be gotten with `format("%f", n);`

And if you need more than the default 6 digits of precision after the 
decimal, you can use a precision specifier, e.g. for 10 digits: `format
("%.10f", n)`


More information about the Digitalmars-d-learn mailing list