shell脚本浮点数计算方法
摘要:使用bc进行浮点数计算 bc是一个支持任意精度的计算,适用于整数和浮点数的运算。 加法: #!/bin/bash num1=3.5 num2=2.1 result=$(echo "$num1 + $num2" | bc) echo "Result of addition: $result" 减法:
阅读全文
posted @ 2025-01-02 10:37
posted @ 2025-01-02 10:37