-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Numerical tower #34
Comments
#i and #e are just syntax extensions that map to exact->inexact and inexact->exact
LISP not properly parses BigInt literals It now supports bigInt hex/octal/binary literals It now supports string->number on any radix that convert to BigInt if it's numerical value
The hack is in a form of literal parameter to Pair::toObject so you can create Object from alist when value are LIPS types (they are not converted to JS values)
so you can call #i1/2+1/2i and get 0.5+0.5i the same is the oposite
The parser handle those mnemonics because it would be hard to have them swapped with #[xob]
sign is optional like in Kawa #i10i fix parsing single number literals
it now show proper error 'Maximum BigInt size exceeded' if number is too big in Chrome
Fix case when calculating sub on rational and complex Fix error messages for invalid numbers in complex op
Arithmetic error: ;; Returns the arithmetic, geometric, and
;; harmonic means of a nested list of numbers
(define (means ton)
(letrec*
((mean
(lambda (f g)
(f (/ (sum g ton) n))))
(sum
(lambda (g ton)
(if (null? ton)
(+)
(if (number? ton)
(g ton)
(+ (sum g (car ton))
(sum g (cdr ton)))))))
(n (sum (lambda (x) 1) ton)))
(values (mean values values)
(mean exp log)
(mean / /)))) Note that evaluating LIPS devel returns:
|
This fixes division of complex that have +nan.0 or +inf.0 in on of the parts divided by non complex value.
Function |
Fix complex division that return non complex value Fix division of two idenntical complex numbers
Fix complex division that return non complex value Fix division of two idenntical complex numbers
Hi, |
@jpellegrini thanks I will make sure to add those to unit tests when will work on that function. |
fixed the simple case and Started adding tests for bigint + float combination, but still rational need some work:
there is a need to add different root calculations (I'm not sure if Scheme has something like this out of the box, it may be useful to expose). And also added an exception when invoking |
R7RS has only square roots... I usually do
Maybe And REAL: |
See PR #247 And I see you already have implemented complex |
@jpellegrini It matches the implementation of Kawa and doesn't have rounding errors when the power is an integer. |
TODO:
(make-rectangular 1/2 2/4)
(/ 10+10i 10+2i)
works in Kawa(Lips convert to Float)+nan.0+5.0i
3.0+inf.0i
#i1/2+2/4i
->(exact->inexact 1/2+2/4i)
.10e+10i
.#b
#o
#x
#d
)#b1/100
#b100+100i
#e
#i
exact inexact literals that do conversion#b#x
#x#b
replace in tokenizer(1/4 == 0.25)#i#b1/100
inexact rational binary#e1e-1000
or#e1.2e-1000
+nan.0
and-nan.0
return by parser#[ieoxb]
string->number
sqrt
abs
/
+
-
*
Bugs
The text was updated successfully, but these errors were encountered: