[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: math round woes

From: David Kastrup
Subject: Re: math round woes
Date: Sat, 30 Aug 2014 11:55:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Ivan Kanis <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]