all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sam Halliday <sam.halliday@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: calc-eval and lsh/logand of large numbers
Date: Tue, 28 Oct 2014 02:34:12 -0700 (PDT)	[thread overview]
Message-ID: <3dfc548c-5076-47e8-841c-1b394129a83a@googlegroups.com> (raw)
In-Reply-To: <bcee5025-f781-4fb6-9ede-9c47c6ae76e4@googlegroups.com>

On Monday, 27 October 2014 22:58:39 UTC, Sam Halliday  wrote:
>   (require 'calc)
>   (defmath bitIndex (i)
>     (lsh 1 i))
> 
>   (calc-eval "bitIndex(64)") ; "0"
> 
> I would have expected this to return "18446744073709551616".

I got it. The default word length is 32 bits and needs to be specified explicitly for left-shift.

http://www.gnu.org/software/emacs/manual/html_node/calc/Binary-Functions.html

  (defmath bitIndex (i) 
    (lsh 1 i (+ 1 i)))




      reply	other threads:[~2014-10-28  9:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27 22:58 calc-eval and lsh/logand of large numbers Sam Halliday
2014-10-28  9:34 ` Sam Halliday [this message]

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=3dfc548c-5076-47e8-841c-1b394129a83a@googlegroups.com \
    --to=sam.halliday@gmail.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.
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.