You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pub fun round(number: Num): Num {
let operator = "+"
if number > 0 {
operator = "-"
}
return unsafe $echo "({number}{operator}0.5)/1" | bc$ as Num
}
Generates:
round__1_v0() {
local number=$1
local operator="+"
if [ $(echo ${number} '>' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then
operator="-"
fi
__AMBER_VAL_0=$(echo "(${number}0.5)/1" | bc${operator})
__AS=$?
__AF_round1_v0="${__AMBER_VAL_0}"
return 0
}
The text was updated successfully, but these errors were encountered:
An example code:
Generates:
The text was updated successfully, but these errors were encountered: