huangxz的笔记 https://passport2.21ic.com/?73035 [收藏] [复制] [RSS]

日志

linux calc hexadecimal 的简单使用。

已有 202 次阅读2020-4-8 17:36 |系统分类:兴趣爱好

calc 是linux 下的一个方便的计算器,以前用做hexadecimal - decimal时,不得不使用ipython,
In [4]: import math

In [5]: hex(math.floor(100*1024/64))
Out[5]: '0x640'

In [6]:
可惜的是ipython 的启动速度真让人捉急。配置低点的差不多要6+ seconds,才能启动完成,后来一直想找个替代方案。试验了linux bc, dc, gcalc, qcalc, 等等都没有效果,
今天试验一下calc感觉还是可以的,在calc启动后运行base2(16), 这样可以在结果同时显示hexadecimal. 已经很方便了。特别做个记录。
[big1@big ~]$ calc
C-style arbitrary precision calculator (version 2.12.7.1)
Calc is open software. For license details type:  help copyright
[Type "exit" to exit, or "help" for help.]

        0 /* 0 */
; 0x1c*128*1024
        3670016 /* 0x380000 */
; 131072
        131072 /* 0x20000 */
; 131072/1024
        128 /* 0x80 */
;
已经有快两年没有写日志了。仅作为开端,勉励自己。

路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)