Handbook
Glossary
fraction> ( a b -- a/b )
Vocabulary
math
.
ratios
.
private
Inputs
a
an
integer
b
a positive integer
Outputs
a/b
a
rational
Word description
Creates a new ratio, or outputs the numerator if the denominator is 1. This word does not reduce the fraction to lowest terms, and should not be called directly; use
/
instead.
Definition
USING:
kernel
math
;
IN:
math.ratios.private
:
fraction>
( a b -- a/b )
dup
1
number=
[
drop
]
[
ratio
boa
]
if
;
inline