Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to get the decimal part alone from a float number.

Posted on 2006-06-19
5
Medium Priority
?
1,210 Views
Last Modified: 2013-12-13
How to get the decimal part alone from a float number.
for eg : $x= 15.25
what to get .25 from $x

Thanks in advance.
LWord
0
Comment
Question by:lword
[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
  • 3
  • 2
5 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1500 total points
ID: 16933063
$x= 15.25;
$f = $x - (int)$x;
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16933179
$f = fmod($x, 1);
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16933181
Oh!

Hadn't been answered as I typed in my response.

Oh!
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 16933616
Interesting answer, RQuadling. will try to remember that...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

610 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