C++ modf function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mcruz

    C++ modf function

    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
    --
    Maria Cruz
    MTC Technologies.co m
  • Stelrad Doulton

    #2
    Re: C++ modf function

    double orig, ipart, fractional = 0;
    orig = 1.234;

    fractional = orig - (ipart = Math.Floor(orig ));


    "mcruz" <mcruz@discussi ons.microsoft.c om> wrote in message
    news:F77F9CC1-C4DF-4C7C-A362-2256C4B0C787@mi crosoft.com...[color=blue]
    > 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
    > --
    > Maria Cruz
    > MTC Technologies.co m[/color]


    Comment

    Working...