Core Function Modf
From Sputnik Wiki
(Difference between revisions)
(→Example) |
m (1 revision) |
Revision as of 21:41, 11 August 2014
Modf( <x>, <intpart> )
Contents |
Description
Breaks x into an integral and a fractional part.
The integer part is stored in the variable pointed by intpart, and the fractional part is returned by the function.
Both parts have the same sign as x.
Parameters
x
Floating point value to break into parts.
intpart
Pointer to a variable (of the same type as x) where the integral part is stored with the same sign as x.
Return Value
The fractional part of x.
Remarks
None.
Example
my $intpart = 0.0; my $param = 3.14159265; my $fractpart = modf ($param, $intpart); printf ("%f = %f + %f \n", $param, $intpart, $fractpart); // Prints: 3.141593 = 3.000000 + 0.141593