fix bug in std where stol would return 0 for positive numbers
This commit is contained in:
parent
25b9fd97ff
commit
a077789685
1 changed files with 5 additions and 1 deletions
|
@ -139,6 +139,9 @@ func ltos {
|
|||
|
||||
def c0 "0" char =c0
|
||||
|
||||
n 0 gt not if {
|
||||
"0" =s
|
||||
}
|
||||
while { n 0 gt } {
|
||||
( ( ( n 10 _long % _char ) c0 + ) _char 1 anewput _string ) s strconcat =s
|
||||
n rem =n "divide by ten to remove last digit" #
|
||||
|
@ -168,7 +171,8 @@ func stol {
|
|||
s rem =s "remove first digit" #
|
||||
}
|
||||
|
||||
n ne -1 * _long *
|
||||
ne if { n neg =n }
|
||||
n
|
||||
}
|
||||
|
||||
func char { _array 0 aget }
|
||||
|
|
Loading…
Add table
Reference in a new issue