maths
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
maths [2015/05/09 21:20] – luke7858 | maths [2024/05/23 07:26] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 27: | Line 27: | ||
<sxh bash> | <sxh bash> | ||
bc -l <<< | bc -l <<< | ||
+ | </ | ||
+ | \\ | ||
+ | === Comparing Decimals with bc === | ||
+ | You are able to compare decimal numbers using bc. The output will return 1 or 0 depending on the results. You can then use this with an if statment -le / -ge etc | ||
+ | <sxh bash> | ||
+ | 1.4 '<' | ||
+ | </ | ||
+ | \\ | ||
+ | <sxh bash> | ||
+ | example= $(echo 1.4 '<' | ||
+ | if [ $example-eq 0 ]; then | ||
+ | elif [ $example-eq 1 ]; then | ||
+ | fi | ||
</ | </ |
maths.1431206404.txt.gz · Last modified: 2024/05/23 07:26 (external edit)