Lines Matching +full:form +full:- +full:factor
1 # SPDX-License-Identifier: CDDL-1.0
34 [ 1 -eq $(echo "$2 > $a" | bc) ] && a=$2 || b=$2
37 [[ $a =~ [1-9] ]] || return 1
41 [ 1 -eq $(echo "scale=2; $p >= $percent" | bc) ]
45 # Return 0 if value is within +/-tolerance of target.
60 typeset diff=$((abs(val - target)))
61 log_note "Checking if $val is within +/-$tol of $target (diff: $diff)"
66 # Return 0 if the human readable string of the form <value>[suffix] can
72 typeset value=$(echo "$size" | grep -o '[0-9]\+')
75 *PB|*pb|*P|*p) factor='1024^5' ;;
76 *TB|*tb|*T|*t) factor='1024^4' ;;
77 *GB|*gb|*G|*g) factor='1024^3' ;;
78 *MB|*mb|*M|*m) factor='1024^2' ;;
79 *KB|*kb|*K|*k) factor='1024^1' ;;
80 *B|*b) factor='1024^0' ;;
81 *[!0-9.]*) return 1 ;;
82 *) factor='1024^0' ;;
85 echo "$value * ($factor)" | bc
100 if [[ $a -ne $b ]]; then
115 if [[ $a -eq $b ]]; then
130 typeset -i min=$1
131 typeset -i max=$2
132 typeset -i count
133 typeset -i i
135 if [[ -z "$3" ]]; then
142 echo $(( (RANDOM % (max - min + 1)) + min ))