Solved

decimal part of number.

Posted on 1998-09-01
2
263 Views
Last Modified: 2008-03-17
Easy quesion : I want to know if there is an operator to test if a number is int or a function to get the decimal par t of a number, like int for the integer part.
0
Comment
Question by:steph84
2 Comments
 
LVL 4

Accepted Solution

by:
binkzz earned 50 total points
Comment Utility
Say $numbertochop = 2314.123
then

$numberint = int $numbertochop           # $numberint is now 2314
$decimal   = $numbertochop - $numberint; # $decimal is now .123

Or in one line:

$decimals = $number - (int $number);

Hope this helps,
Binkzz
0
 
LVL 84

Expert Comment

by:ozo
Comment Utility
also POSIX::modf
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now