unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Tino Calancha <tino.calancha@gmail.com>, raman <raman@google.com>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: RE: New library num-base-converters
Date: Mon, 14 Aug 2017 22:25:18 -0700 (PDT)	[thread overview]
Message-ID: <84387000-0545-4a51-8644-772b6b53165c@default> (raw)
In-Reply-To: <alpine.DEB.2.20.1708151141030.2105@calancha-pc>

> > 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



  reply	other threads:[~2017-08-15  5:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-14 17:26 New library num-base-converters Tino Calancha
2017-08-14 17:48 ` Ted Zlatanov
2017-08-15  2:11   ` raman
2017-08-15  2:50     ` Tino Calancha
2017-08-15  5:25       ` Drew Adams [this message]
2017-08-15  6:35         ` Tino Calancha
2017-08-15  7:55 ` Stefan Monnier
2017-08-15  9:49   ` Tino Calancha
2017-08-15 15:24     ` Stefan Monnier
2017-08-15 13:40   ` Ted Zlatanov

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=84387000-0545-4a51-8644-772b6b53165c@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=raman@google.com \
    --cc=tino.calancha@gmail.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).