Help Center
Help CenterFreeBASIC

Fracfunction

Returns the decimal part of a number

Mathematical Functionsfunctiondocumented

Syntax

Declare Function Frac ( ByVal number As Double ) As Double
Declare Function Frac ( ByVal number As Integer ) As Integer
Declare Function Frac ( ByVal number As UInteger ) As UInteger

Parameters

NameDescription
numberthe number or expression to get the fraction part of.

Return value


Returns the fractional part of a number or expression.

Description


Equivalent to: (number - Fix(number)).
For example, Frac(4.25) will return 0.25, and Frac(-1.75) will return -0.75. For integer types, the value 0 is always returned.

The Frac unary Operator can be overloaded with user defined types.

Remarks

Usage


result = Frac( number )

Dialect Differences


  • In the -lang qb dialect, this operator cannot be overloaded.

Differences from QB


  • New to FreeBASIC

See also


Example


Print Frac(10.625)  '' will print  0.625

Print Frac(-10.625) '' will print -0.625 


Reference

  • Documented in KeyPgFrac.html