Bug in reading reals.
This commit is contained in:
parent
79f7492390
commit
cf1b09c62a
|
@ -39,15 +39,15 @@ lisp_add( struct stack_frame *frame, struct cons_pointer env ) {
|
||||||
bool is_int = true;
|
bool is_int = true;
|
||||||
|
|
||||||
for ( int i = 0; i < args_in_frame && !nilp( frame->arg[i] ); i++ ) {
|
for ( int i = 0; i < args_in_frame && !nilp( frame->arg[i] ); i++ ) {
|
||||||
struct cons_space_object arg = pointer2cell( frame->arg[i] );
|
struct cons_space_object current = pointer2cell( frame->arg[i] );
|
||||||
|
|
||||||
switch ( arg.tag.value ) {
|
switch ( current.tag.value ) {
|
||||||
case INTEGERTV:
|
case INTEGERTV:
|
||||||
i_accumulator += arg.payload.integer.value;
|
i_accumulator += current.payload.integer.value;
|
||||||
d_accumulator += numeric_value( frame->arg[i] );
|
d_accumulator += numeric_value( frame->arg[i] );
|
||||||
break;
|
break;
|
||||||
case REALTV:
|
case REALTV:
|
||||||
d_accumulator += arg.payload.real.value;
|
d_accumulator += current.payload.real.value;
|
||||||
is_int = false;
|
is_int = false;
|
||||||
default:
|
default:
|
||||||
lisp_throw( c_string_to_lisp_string( "Cannot add: not a number" ),
|
lisp_throw( c_string_to_lisp_string( "Cannot add: not a number" ),
|
||||||
|
|
|
@ -24,7 +24,7 @@ extern "C" {
|
||||||
* @param value the value to wrap;
|
* @param value the value to wrap;
|
||||||
* @return a real number cell wrapping this value.
|
* @return a real number cell wrapping this value.
|
||||||
*/
|
*/
|
||||||
struct cons_pointer make_real( double value );
|
struct cons_pointer make_real( long double value );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue