[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] arithmetic error in mapm egg
From: |
Cs. Henk |
Subject: |
[Chicken-users] arithmetic error in mapm egg |
Date: |
Fri, 12 Nov 2004 15:35:14 +0100 |
User-agent: |
Mutt/1.5.6i |
Hi!
On my linux-2.6 box with chicken-1.70 and mapm-4.9.2 the following code:
(require 'mapm)
(display (apm->integer-string
(apm/ (apm- (apm-expt (apm 7) (apm 19)) mm-1) (apm 6))))
(newline)
produces 1899815864228856. (In a clearer notation, a'la python/ruby:
(7**19 - 1)/6 is calculated; it's value is 1899815864228857.)
Note that coding it directly in C++:
#define NULL 0
#include <m_apm.h>
#include <stdio.h>
#include <stdlib.h>
int main(void) {
MAPM a = 7;
MAPM r;
char obuf[64];
r = (a.ipow(19)-1)/6;
r.toString(obuf,50);
printf("%s\n",obuf);
}
gives the correct value.
Csaba
- [Chicken-users] arithmetic error in mapm egg,
Cs. Henk <=