linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabio Miranda Hamburger <fabmirha@ns.isi.ulatina.ac.cr>
To: linux-c-programming@vger.kernel.org
Subject: Remove x number of decimals form a float
Date: Tue, 11 Jul 2006 12:12:25 -0600 (CST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0607111211270.17950@ns.isi.ulatina.ac.cr> (raw)

Hello,

I am trying to implement a 100% math function ( avoid handle the float as 
a char array), that remove x number of decimals from the right to the 
float point.

Example:
Given x= 12345.6789 I call the function with (x,2) and the returned number 
is: x= 12345.67, for (x,4) returned value is x=12345

I was trying to implement this function using datatype casting, abs() and 
other functions from math.h library.

Thanks for any advice,


---
Fabio Andres Miranda
Ingenieria de sistemas informaticos
Universidad Latina - Costa Rica


                 reply	other threads:[~2006-07-11 18:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0607111211270.17950@ns.isi.ulatina.ac.cr \
    --to=fabmirha@ns.isi.ulatina.ac.cr \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).