2004-08-04 22:43:58 -04:00
|
|
|
#include "factor.h"
|
|
|
|
|
2004-09-18 22:29:29 -04:00
|
|
|
/* Does not reduce to lowest terms, so should only be used by math
|
|
|
|
library implementation, to avoid breaking invariants. */
|
|
|
|
void primitive_from_fraction(void)
|
|
|
|
{
|
2004-12-24 17:29:16 -05:00
|
|
|
CELL numerator, denominator;
|
2004-12-24 02:52:02 -05:00
|
|
|
F_RATIO* ratio;
|
2004-10-12 23:49:43 -04:00
|
|
|
|
2005-06-16 18:50:49 -04:00
|
|
|
maybe_gc(0);
|
2004-10-12 23:49:43 -04:00
|
|
|
|
2004-12-24 17:29:16 -05:00
|
|
|
denominator = dpop();
|
|
|
|
numerator = dpop();
|
2004-12-24 02:52:02 -05:00
|
|
|
ratio = allot(sizeof(F_RATIO));
|
|
|
|
ratio->numerator = numerator;
|
|
|
|
ratio->denominator = denominator;
|
2005-03-29 20:34:29 -05:00
|
|
|
dpush(RETAG(ratio,RATIO_TYPE));
|
2004-08-04 22:43:58 -04:00
|
|
|
}
|