首页 > 系统服务 > 详细

shell脚本之使用bc工具实现数值转换(浮点转二进制)

时间:2016-12-10 13:55:44      阅读:193      评论:0      收藏:0      [点我收藏+]
#! /bin/bash
echo -n input float:
read num
echo power of the operation:
echo $num^2 |bc
echo converted to binary
echo "obase=2;$num" |bc

  

[root@lenny Desktop]# ./zhuanhuan.sh 
input float:3.1415926
power of the operation:
9.8696040
converted to binary
11.001001000011111101101001

  

shell脚本之使用bc工具实现数值转换(浮点转二进制)

原文:http://www.cnblogs.com/leonarcohen/p/6155415.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!