all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
To: emacs-devel@gnu.org
Subject: Re: math round woes
Date: Sat, 30 Aug 2014 11:55:31 +0200	[thread overview]
Message-ID: <87sikemhd8.fsf@fencepost.gnu.org> (raw)
In-Reply-To: 87egvyl3e1.fsf@kanis.fr

Ivan Kanis <ivan@kanis.fr> writes:

> Hello,
>
> I am having problem this week with org-drill failing due to a rounding
> error.
>
> (round 586514472.354) -> eval: Arithmetic range error: "round",
> 586514472.354
>
> I thought I'd patch things with calc:
>
> (require 'calc-arith)
> (math-round 586514472.354) -> 586514472.354
>
> I looked at math-round and it calls math-trunk:
>
> (math-trunk 1.1) -> 1.1
>
> What's going on?

Uh, calc does calculations with its own number representation rather
than Lisp floating point numbers.  But calc cannot actually help you in
any way since the basic problem is that the result _will_ _not_ _fit_
into a Lisp integer.

If you are fine with putting it in a floating point number, use fround
rather than round.

-- 
David Kastrup




  reply	other threads:[~2014-08-30  9:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-30  9:42 math round woes Ivan Kanis
2014-08-30  9:55 ` David Kastrup [this message]
2014-08-30  9:57 ` Andreas Schwab
2014-08-30 15:59   ` Ivan Kanis
2014-08-30 16:02     ` Andreas Schwab
2014-08-30 10:29 ` Rüdiger Sonderfeld
2014-08-30 20:01   ` Ivan Kanis

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

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

  git send-email \
    --in-reply-to=87sikemhd8.fsf@fencepost.gnu.org \
    --to=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.