免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1575 | 回复: 1
打印 上一主题 下一主题

shell中的数学运算 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-05-06 23:27 |只看该作者 |倒序浏览
格式为:

$echo $((sqrt(2)))
1.41421356237309505
$

ksh中函数有:
abs acos acosh asin asinh atan atan2 atanh cbrt copysign cos cosh erf  erfc  exp  exp2  expm1  fabs  fdim
finite  floor  fma fmax fmod hypot ilogb int isinf isnan lgamma log log2 logb nearbyint nextafter nexttoward
pow remainder rint round sin sinh sqrt tan tanh tgamma trunc

每一个函数的用法都可以通过man的方式获得,如

$man nexttoward

       The nextafter() functions return the next representable neighbor of x in the direction  towards  y.   The
       size  of the step between x and the result depends on the type of the result.  If x = y the function sim-
       ply returns y.  If either value is NaN, then NaN is returned.  Otherwise a  value  corresponding  to  the
       value of the least significant bit in the mantissa is added or subtracted, depending on the direction.

       The  nexttoward() functions do the same as the nextafter() functions, except that they have a long double
       second argument.

......

论坛徽章:
0
2 [报告]
发表于 2009-05-06 23:54 |只看该作者
谢lz教导
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP