unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#13031: large numbers
@ 2012-11-29  8:42 Jozef Chraplewski
  2012-11-29 19:08 ` Noah Lavine
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Jozef Chraplewski @ 2012-11-29  8:42 UTC (permalink / raw)
  To: 13031

Hi,

It looks that guile returns incorrect results when it works with really big numbers.

I've found it during resolving problem 48 from Project Euler:

http://projecteuler.net/problem=48

The solution is trivial:

(define (problem-48 limit)
 (define (F)
   (let loop ((n 1)
              (sum 0))
     (if (<= n limit)
         (loop (+ n 1) (+ sum (expt n n)))
         sum)))

 (let* ((str (number->string (F)))
          (len (string-length str)))
   (substring str (- len 10) len)))

(display (problem-48 1000))
(newline)


The proper answer is 9110846700 but guile returns 6457854188

I've tested solution under other scheme implementations (MIT scheme, petite and mzscheme) and it works as it should.

Does such a big numbers in guile require any special treatment or just they are not supported?

Best,
Jozef




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-12-07 17:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-29  8:42 bug#13031: large numbers Jozef Chraplewski
2012-11-29 19:08 ` Noah Lavine
2012-11-29 19:15 ` Stefan Israelsson Tampe
2012-11-29 22:11 ` Ludovic Courtès
2012-11-30 11:54   ` Jozef Chraplewski
2012-11-30 16:27     ` Ludovic Courtès
2012-11-30 17:33     ` Mark H Weaver
2012-12-01  5:22 ` Mark H Weaver
2012-12-03 16:35   ` Jozef Chraplewski
2012-12-04  0:13     ` Mark H Weaver
2012-12-05 16:20       ` Mark H Weaver
2012-12-07 10:40         ` Jozef Chraplewski
2012-12-07 17:06           ` Mark H Weaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).