Core Function Modf

From Sputnik Wiki
Jump to: navigation, search
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
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox