Mainly, work on investigating the bignum arithmetic problem(s).
This commit is contained in:
parent
51ad977e04
commit
fa99dd6990
|
@ -32,6 +32,16 @@
|
||||||
#include "arith/real.h"
|
#include "arith/real.h"
|
||||||
#include "memory/vectorspace.h"
|
#include "memory/vectorspace.h"
|
||||||
|
|
||||||
|
// We can't, I think, use libreadline, because we read character by character,
|
||||||
|
// not line by line, and because we use wide characters. So we're going to have
|
||||||
|
// to reimplement it. So we're going to have to maintain history of the forms
|
||||||
|
// (or strings, but I currently think forms). So we're going to have to be able
|
||||||
|
// to detact special keys, particularly, at this stage, the uparrow and down-
|
||||||
|
// arrow keys
|
||||||
|
// #include <readline/readline.h>
|
||||||
|
// #include <readline/history.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* for the time being things which may be read are:
|
* for the time being things which may be read are:
|
||||||
* * strings
|
* * strings
|
||||||
|
@ -325,7 +335,7 @@ struct cons_pointer read_number( struct stack_frame *frame,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case L',':
|
case L',':
|
||||||
// silently ignore it.
|
// silently ignore commas.
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result = add_integers( multiply_integers( result, base ),
|
result = add_integers( multiply_integers( result, base ),
|
||||||
|
|
|
@ -121,6 +121,30 @@
|
||||||
*/
|
*/
|
||||||
#define LOOPTV 1347374924
|
#define LOOPTV 1347374924
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Tag for a lazy cons cell.
|
||||||
|
*
|
||||||
|
* A lazy cons cell is like a cons cell, but lazy.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define LAZYCONSTAG "LZYC"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Tag for a lazy string cell.
|
||||||
|
*
|
||||||
|
* A lazy string cell is like a string cell, but lazy.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define LAZYSTRTAG "LZYS"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Tag for a lazy worker cell.
|
||||||
|
*
|
||||||
|
* A lazy
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define LAZYWRKRTAG "WRKR"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The special cons cell at address {0,0} whose car and cdr both point to
|
* The special cons cell at address {0,0} whose car and cdr both point to
|
||||||
* itself.
|
* itself.
|
||||||
|
|
|
@ -129,6 +129,51 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# add two small bignums to produce a bigger bignum
|
||||||
|
|
||||||
|
a=1152921504606846977
|
||||||
|
c=`echo "$a + $a" | bc`
|
||||||
|
echo -n "adding $a to $a: "
|
||||||
|
expected='t'
|
||||||
|
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>psse.log`
|
||||||
|
|
||||||
|
actual=`echo $output |\
|
||||||
|
tail -1 |\
|
||||||
|
sed 's/\,//g'`
|
||||||
|
|
||||||
|
if [ "${expected}" = "${actual}" ]
|
||||||
|
then
|
||||||
|
echo "OK"
|
||||||
|
else
|
||||||
|
echo "Fail: expected '${expected}', got '${actual}'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# add five small bignums to produce a bigger bignum
|
||||||
|
|
||||||
|
a=1152921504606846977
|
||||||
|
c=`echo "$a * 5" | bc`
|
||||||
|
echo -n "adding $a, $a $a, $a, $a: "
|
||||||
|
expected='t'
|
||||||
|
output=`echo "(= (+ $a $a $a $a $a) $c)" | target/psse -v 2 2>psse.log`
|
||||||
|
|
||||||
|
actual=`echo $output |\
|
||||||
|
tail -1 |\
|
||||||
|
sed 's/\,//g'`
|
||||||
|
|
||||||
|
if [ "${expected}" = "${actual}" ]
|
||||||
|
then
|
||||||
|
echo "OK"
|
||||||
|
else
|
||||||
|
echo "Fail: expected '${expected}', got '${actual}'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# add two bignums to produce a bignum
|
# add two bignums to produce a bignum
|
||||||
a=10000000000000000000
|
a=10000000000000000000
|
||||||
|
|
Loading…
Reference in a new issue