Ratio arithmetic separated out into its own files.
This commit is contained in:
parent
a5e1d3ccd8
commit
ad9b1cd7f8
8 changed files with 393 additions and 230 deletions
|
|
@ -247,31 +247,6 @@ struct cons_pointer make_nlambda( struct cons_pointer args,
|
|||
return pointer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a ratio frame from these two pointers, expected to be integers
|
||||
* or (later) bignums, in the context of this stack_frame.
|
||||
*/
|
||||
struct cons_pointer make_ratio( struct stack_frame *frame,
|
||||
struct cons_pointer dividend,
|
||||
struct cons_pointer divisor ) {
|
||||
struct cons_pointer result;
|
||||
if ( integerp( dividend ) && integerp( divisor ) ) {
|
||||
inc_ref( dividend );
|
||||
inc_ref( divisor );
|
||||
result = allocate_cell( RATIOTAG );
|
||||
struct cons_space_object *cell = &pointer2cell( result );
|
||||
cell->payload.ratio.dividend = dividend;
|
||||
cell->payload.ratio.divisor = divisor;
|
||||
} else {
|
||||
result =
|
||||
make_exception( c_string_to_lisp_string
|
||||
( "Dividend and divisor of a ratio must be integers" ),
|
||||
frame );
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a string from this character (which later will be UTF) and
|
||||
* this tail. A string is implemented as a flat list of cells each of which
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue