help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: calc-eval and lsh/logand of large numbers


From: Sam Halliday
Subject: Re: calc-eval and lsh/logand of large numbers
Date: Tue, 28 Oct 2014 02:34:12 -0700 (PDT)
User-agent: G2/1.0

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 via email to

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