当前位置:网站首页>Usage of BC
Usage of BC
2022-04-23 14:22:00 【Small ash pier】
bc
Linux The calculator under
Common options :
-i: Force into interactive mode ;
-l: Define the standard math library to use
-q: Don't print normal GNU bc environmental information ;
usage :
- Command line
root@ubuntu:~# bc
bc 1.07.1
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
10/3
3
scale
0
scale=5
scale
5
10/3
3.33333
quit
root@ubuntu:~#
- echo The Conduit
root@ubuntu:~# echo "2^8" |bc
256
root@ubuntu:~# echo "ibase=2;11111111" |bc
255
root@ubuntu:~# echo "scale=3;10/3" |bc
3.333
root@ubuntu:~# echo "scale=3;num=10/3;if(length(num)==scale(num)) print 0;print num" |bc |xargs echo
3.333
root@ubuntu:~# echo "scale=3;num=1/3;if(length(num)==scale(num)) print 0;print num" |bc |xargs echo
0.333
- Hexadecimal conversion
ibase Enter a decimal number
obase Output digit base
root@ubuntu:~# echo "obase=8;10" |bc
12
root@ubuntu:~# echo "ibase=2;11011" |bc
27
root@ubuntu:~# echo "ibase=2;11111" |bc
31
root@ubuntu:~# echo "ibase=10;obase=16;12" |bc
C
root@ubuntu:~# echo "ibase=10;obase=8;7" |bc
7
root@ubuntu:~# echo "ibase=10;obase=2;12" |bc
1100
root@ubuntu:~# echo "ibase=2;obase=8;110101" |bc
65
root@ubuntu:~# echo "ibase=8;obase=16;14357" |bc
247D
版权声明
本文为[Small ash pier]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231409158424.html
边栏推荐
猜你喜欢
随机推荐
API Gateway/API 网关(三) - Kong的使用 - 限流rate limiting(redis)
在Clion中给主函数传入外部参数
01-nio basic ByteBuffer and filechannel
微信小程序轮播图swiper
时间复杂度计算举例
循环队列的基本操作,你学会了吗?
基于TLC5615的多路可调数控直流稳压电源,51单片机,含Proteus仿真和C代码等
获取线程返回值Future接口与FutureTask类使用介绍
LLVM - 生成for循环
After entering the new company, the operation and maintenance engineer can understand the deployment of the system from the following items
ssh限制登录的四种手段
JS recursion (1)
How does void * exist?
顺序表的操作,你真的学会了吗?
浅谈skiplist在LevelDB的应用
修改Firebase Emulators的默认侦听IP
C语言知识点精细详解——初识C语言【1】
Mysql的安装过程(已经安装成功的步骤说明)
Five ways of using synchronized to remove clouds and fog are introduced
1分钟看懂执行流程,永久掌握for循环(附for循环案例)