FRAC
- Source: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgFrac
- Last revised: 2016-10-29
Returns the decimal part of a number
Syntax
vb
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 uintegerUsage
` result = Frac( number )
`
Parameters
number
the 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.
Examples
start GeSHi
vb
Print frac(10.625) '' will print 0.625
Print frac(-10.625) '' will print -0.625end GeSHi
Dialect Differences
- In the -lang qb dialect, this operator cannot be overloaded.
Differences from QB
- New to FreeBASIC
See also
FixOperator
Back to DocToc