[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: New library num-base-converters
From: |
Drew Adams |
Subject: |
RE: New library num-base-converters |
Date: |
Mon, 14 Aug 2017 22:25:18 -0700 (PDT) |
> > this functionality is present in calculator.el --
> Sure, you can get this functionality with calc.el as well:
> indeed num-base-converters.el internally calls `calc-number-radix'.
>
> One point of this library is the convenience of not having to
> know anything about neither calculator.el nor calc.el to get
> the answer with easy.
>
> Every Emacs user will understand the following:
> M-x nbc-hex2dec ff RET
> "ff hexadecimal = 255 decimal"
>
> M-: (nbc-oct2dec "644") RET
> => 420
>
> ;; Or just `hex2dec' and `oct2dec' if you customize
> ;; `nbc-define-aliases' to non-nil.
(format "%d" #xff) ; hex to decimal
--> "255"
(format "%x" 255) ; decimal to hex
--> "ff"
(format "%d" #o644) ; octal to decimal
--> "420"
(format "%o" 420) ; decimal to octal
--> "644"
And didn't Pascal B. point this out in the thread previously cited?
(format "#8r%o #10r%d #16r%x" 42 42 42)
--> "#8r52 #10r42 #16r2a"
https://lists.gnu.org/archive/html/help-gnu-emacs/2011-03/msg00531.html
Re: New library num-base-converters, Stefan Monnier, 2017/08/15