linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Remove x number of decimals form a float
@ 2006-07-11 18:12 Fabio Miranda Hamburger
  0 siblings, 0 replies; only message in thread
From: Fabio Miranda Hamburger @ 2006-07-11 18:12 UTC (permalink / raw)
  To: linux-c-programming

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-07-11 18:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-11 18:12 Remove x number of decimals form a float Fabio Miranda Hamburger

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).