robpike / ivy

ivy, an APL-like calculator
Other
1.32k stars 103 forks source link

bad number syntax for 08 & 09 #114

Closed sylr closed 2 years ago

sylr commented 2 years ago
0 60 decode 1 07
67

0 60 decode 1 08
bad number syntax: 08

0 60 decode 1 09
bad number syntax: 09

0 60 decode 1 10
70
$ go version -m $(which ivy)
/Users/sylvain/go/bin/ivy: go1.18.3
    path    robpike.io/ivy
    mod robpike.io/ivy  v0.2.8  h1:Z6y5MU6p415h2cMo1ab8A5EOuIdnIh2ES905k4DSMAI=
    build   -compiler=gc
    build   CGO_ENABLED=1
    build   CGO_CFLAGS=
    build   CGO_CPPFLAGS=
    build   CGO_CXXFLAGS=
    build   CGO_LDFLAGS=
    build   GOARCH=arm64
    build   GOOS=darwin
robpike commented 2 years ago

You are in base 0, the default, which means that 0x is a hex prefix and 0 is an octal prefix. 08 is not an octal number.


% ivy
0 60 decode 1 09
bad number syntax: 09

08    
bad number syntax: 08

)base 
ibase   0
obase   0

)base 10

08
8

0 60 decode 1 09
69
sylr commented 2 years ago

Thanks!