?
Solved

"Floating Point Arithmetic" with Perl

Posted on 2009-04-13
6
Medium Priority
?
790 Views
Last Modified: 2013-12-25
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
Comment
Question by:dyoung520
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 24131521
printf "%.4f",-9.9999999999989e-05

0
 
LVL 84

Assisted Solution

by:ozo
ozo earned 2000 total points
ID: 24131562
0
 
LVL 84

Assisted Solution

by:ozo
ozo earned 2000 total points
ID: 24131623
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 84

Assisted Solution

by:ozo
ozo earned 2000 total points
ID: 24131732
0
 

Author Comment

by:dyoung520
ID: 24131808
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
 

Author Closing Comment

by:dyoung520
ID: 31569601
thanks!
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Healthcare organizations in the United States must adhere to the guidance of both the HIPAA (Health Insurance Portability and Accountability Act) and HITECH (Health Information Technology for Economic and Clinical Health Act) for securing and protec…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question