unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
To: Jozef Chraplewski <jozef@applicake.com>
Cc: 13031@debbugs.gnu.org
Subject: bug#13031: large numbers
Date: Thu, 29 Nov 2012 20:15:26 +0100	[thread overview]
Message-ID: <CAGua6m08PNCVg4fF0bu_SJw2_3fNUnzTjrKCNDV-_w3DBWvb5g@mail.gmail.com> (raw)
In-Reply-To: <7B53D3D8-EDFE-47B5-93C1-FD52B21A3F39@applicake.com>

[-- Attachment #1: Type: text/plain, Size: 1066 bytes --]

Hi,

Which version of guile do you use, I get the correct value for guile
2.0.5.91-de6d8

/Stefan


On Thu, Nov 29, 2012 at 9:42 AM, Jozef Chraplewski <jozef@applicake.com>wrote:

> 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
>
>
>

[-- Attachment #2: Type: text/html, Size: 1554 bytes --]

  parent reply	other threads:[~2012-11-29 19:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGua6m08PNCVg4fF0bu_SJw2_3fNUnzTjrKCNDV-_w3DBWvb5g@mail.gmail.com \
    --to=stefan.itampe@gmail.com \
    --cc=13031@debbugs.gnu.org \
    --cc=jozef@applicake.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).