Hello!
Is there a library word to return the fractional part of a real number? Sort
of like the following, except that it only works for positives:
: frac ( real -- fractional-part )
dup floor - ;
---=---
Александр
---
You could use ``1 mod`` to get the fractional part... which is actually
what ``truncate`` uses in its implementation.
On Wed, Mar 15, 2017 at 5:24 AM, Alexander Ilin wrote:
> Hello!
>
> Is there a library word to return the fractional part of a real number?
> Sort of like the following, except
Cool, thanks! 15.03.2017, 17:27, "John Benediktsson" :You could use ``1 mod`` to get the fractional part... which is actually what ``truncate`` uses in its implementation. On Wed, Mar 15, 2017 at 5:24 AM, Alexander Ilin wrote:Hello! Is there a library word to return the fraction