From: "Pascal J. Bourguignon" <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Inconsistency: sometimes an integer, sometimes a float
Date: Thu, 23 Jan 2014 22:42:06 +0100 [thread overview]
Message-ID: <87ppnijryp.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: 4ce73e74-a069-4e8d-b606-5aa76b848940@googlegroups.com
djc <peter.kaiser@gmail.com> writes:
> "(/ 536870911 1000000)" is an integer.
>
> "(/ 536870912 1000000)" is a float.
>
> I know why, but it's still unpleasant to have to program around it. I suppose this begs the question of when there will be a supported 64-bit release of Emacs.
>
> GNU Emacs 24.3.1 (i386-mingw-nt6.1.7601)
A 64-bit emacs wouldn't be a solution, you'd just increase the number of
cases where (/ (1+ n) p) is not of the same type as (/ n p).n
Instead, write:
(defun float/ (dividend divisor &rest divisors)
(apply (function /) (float dividend) divisor divisors))
and use it instead of /.
(float/ 536870911 1000000) --> 536.870911
(float/ 536870912 1000000) --> 536.870912
(float/ 536870.912 1000.000) --> 536.870912
--
__Pascal Bourguignon__
http://www.informatimago.com/
"Le mercure monte ? C'est le moment d'acheter !"
next prev parent reply other threads:[~2014-01-23 21:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-23 10:39 Inconsistency: sometimes an integer, sometimes a float djc
2014-01-23 15:50 ` Rasmus
2014-01-23 16:03 ` Nicolas Richard
2014-01-23 16:07 ` Nicolas Richard
2014-01-23 16:33 ` Eli Zaretskii
2014-01-23 21:42 ` Pascal J. Bourguignon [this message]
2014-01-24 14:39 ` Doug Lewan
[not found] ` <mailman.12685.1390574401.10748.help-gnu-emacs@gnu.org>
2014-01-24 19:28 ` Pascal J. Bourguignon
2014-01-25 1:18 ` Drew Adams
[not found] ` <mailman.12661.1390513424.10748.help-gnu-emacs@gnu.org>
2014-01-24 22:25 ` djc
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/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ppnijryp.fsf@kuiper.lan.informatimago.com \
--to=pjb@informatimago.com \
--cc=help-gnu-emacs@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.
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).