Search found 4 matches

by Linux_x189
Thu May 01, 2014 9:09 am
Forum: Anything else we might add?
Topic: A strange problem. Quite confusing
Replies: 6
Views: 10165

Re: A strange problem. Quite confusing

cormullion wrote:Don't forget to use + - * / % rather than add sub mul div mod for integers...

If you find any errors or can add suggestions http://en.wikibooks.org/wiki/Introducti ... th_numbers, please do! :)

Thx, I will check the website for some detiles.
by Linux_x189
Thu May 01, 2014 8:19 am
Forum: Anything else we might add?
Topic: A strange problem. Quite confusing
Replies: 6
Views: 10165

Re: A strange problem. Quite confusing

I think something may be wrong in newlisp. I write my pow Integer-version of "pow" : (define (** x y , (.pow 1)) (dotimes (i y) (set '.pow (* .pow x)))) and It just works fine with 9^17: (** 9 17) returns: 16677181699666569 It's fine. So I continued: (mod (** 9 17) 17) returns 8 It's wrong again! No...
by Linux_x189
Wed Apr 30, 2014 10:53 pm
Forum: Anything else we might add?
Topic: A strange problem. Quite confusing
Replies: 6
Views: 10165

Re: A strange problem. Quite confusing

I don't think pow is big-integer friendly - has (pow 9 17) already exceeded 64-bit integer range and converted to float? The addition of bigint into newLISP is very recent, and at the moment I don't think all arithmetic operations can handle them. newLISP isn't designed to be as maths-aware a langu...
by Linux_x189
Wed Apr 30, 2014 9:38 pm
Forum: Anything else we might add?
Topic: A strange problem. Quite confusing
Replies: 6
Views: 10165

A strange problem. Quite confusing

Hi guys! I am new to newlisp, and recently I encounting a really strange problem. I type the following code in newlisp: (mod (bigint (pow 9 17)) 17) the answers ( I typed it in windows xp(32bit) and Archlinux(64bit)) is: 10 (winxp) 8 (Archlinux) but the answer should be 9. And the 'pow' part is also...