replacement for C++ function 'modf'

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi, I was using the following function in a C++ program. I am now "porting"
it to C# and I can not find an equivalent to: modf function. As described
below.

double modf ( double x , double * ipart );
Split floating-point value into fractional and integer parts.
Breaks x in two parts: the integer (stored in location pointed by ipart)
and the fraction (return value).

So does any know of a function that i can use to find the fractional and
integer parts of a floating-point value?
thanks
 
Cast original to 64 or 32 bit integer - you'll get integer part.

Subtract integer part from the original - now you've got fractional part.



Best regards,



Ilya



This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top