[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 803
  • Last Modified:

"Floating Point Arithmetic" with Perl

How can I use Perl for Floating Point Arithmetic in a manner like a calculator does.

For Example:

#!/usr/bin/perl

$number = 0.5299 - 0.5300;

print $number;

...

Prints: -9.9999999999989e-05

I want: -0.0001

Any help is appreciated!!!

Thanks,
Dan
0
dyoung520
Asked:
dyoung520
  • 4
  • 2
4 Solutions
 
ozoCommented:
printf "%.4f",-9.9999999999989e-05

0
 
ozoCommented:
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
dyoung520Author Commented:
Thank You...

"printf "%.4f",-9.9999999999989e-05"
I read something to that effect, but I didn't think it as the problem...

Again thank you!
0
 
dyoung520Author Commented:
thanks!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now