GLBasic forum

Codesnippets => Code Snippets => Topic started by: FutureCow on 2012-Jun-23

Title: Returning the fraction / decimal / remainder part of a number
Post by: FutureCow on 2012-Jun-23
I'm contributing this here because even though it's really simple, I was surprised there was no command to return it directly.

If you have a number (eg. 63.45) and want to return the ".45" part only it's as simple as
Code (glbasic) Select

FUNCTION FractionOnly : Number
Return (Number - INTEGER(Number))


Title: Re: Returning the fraction / decimal / remainder part of a number
Post by: mentalthink on 2012-Jun-23
Hi Future thanks for this simple but I think usefully code...  :good:
Title: Re: Returning the fraction / decimal / remainder part of a number
Post by: Kitty Hello on 2012-Jun-26
fmod(number, 1.0)