From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sam Halliday Newsgroups: gmane.emacs.help Subject: Re: calc-eval and lsh/logand of large numbers Date: Tue, 28 Oct 2014 02:34:12 -0700 (PDT) Message-ID: <3dfc548c-5076-47e8-841c-1b394129a83a@googlegroups.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1414488929 19875 80.91.229.3 (28 Oct 2014 09:35:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Oct 2014 09:35:29 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 28 10:35:24 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xj3BT-0002gm-Nr for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Oct 2014 10:35:23 +0100 Original-Received: from localhost ([::1]:38155 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xj3BT-0002kW-CP for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Oct 2014 05:35:23 -0400 X-Received: by 10.66.65.133 with SMTP id x5mr1388914pas.37.1414488852432; Tue, 28 Oct 2014 02:34:12 -0700 (PDT) X-Received: by 10.140.92.140 with SMTP id b12mr14458qge.14.1414488852328; Tue, 28 Oct 2014 02:34:12 -0700 (PDT) Original-Path: usenet.stanford.edu!h15no667087igd.0!news-out.google.com!u5ni13qab.1!nntp.google.com!u7no670496qaz.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=83.244.128.25; posting-account=kRukCAoAAAANs-vsVh9dFwo5kp5pwnPz Original-NNTP-Posting-Host: 83.244.128.25 User-Agent: G2/1.0 Injection-Date: Tue, 28 Oct 2014 09:34:12 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:208358 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:100633 Archived-At: 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)))