printing long decimal numbers

M

Mark Hobley

How do I get Perl to display a long decimal number, without converting to
scientific notation or rounding?

print 6/45*5/44*4/43*3/42*2/41;
4.91095215995953e-06

printf "%lf",6/45*5/44*4/43*3/42*2/41;
0.000005

I would like the following output:
0.00000491095215995953

Thanks in advance.

Mark.
--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE

Telephone: (0121) 247 1596
International: 0044 121 247 1596

Email: markhobley at hotpop dot donottypethisbit com

http://markhobley.yi.org/
 
D

DJ Stunks

Mark said:
How do I get Perl to display a long decimal number, without converting to
scientific notation or rounding?

print 6/45*5/44*4/43*3/42*2/41;
4.91095215995953e-06

printf "%lf",6/45*5/44*4/43*3/42*2/41;
0.000005

I would like the following output:
0.00000491095215995953

my $result = 6/45*5/44*4/43*3/42*2/41;
printf "%.20f\n",$result;

?

-jp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top