Fix mlr -O to return strings for all octal numbers along with 0* numbers like 07 and 08 (#766)

This commit is contained in:
John Kerl 2021-12-01 21:18:19 -05:00 committed by GitHub
parent d22cd2012a
commit 7642f7ede6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 1 deletions

View file

@ -159,7 +159,7 @@ func inferNormally(input string, inferBool bool) *Mlrval {
func inferWithOctalSuppress(input string, inferBool bool) *Mlrval {
output := inferNormally(input, inferBool)
if output.mvtype != MT_INT {
if output.mvtype != MT_INT && output.mvtype != MT_FLOAT {
return output
}

View file

@ -2,6 +2,8 @@ x t y z
123 float 124 123.5
123.45 float 124.45 123.95
0123 float 84 83.5
07 float 8 7.5
08 float 9 8.5
0b0100 float 5 4.5
0x1000 float 4097 4096.5
-123 float -122 -122.5
@ -9,3 +11,5 @@ x t y z
-0123 float -82 -82.5
-0b0100 float -3 -3.5
-0x1000 float -4095 -4095.5
-07 float -6 -6.5
-08 float -7 -7.5

View file

@ -2,6 +2,8 @@ x t y z
123 int 124 123.5
123.45 float 124.45 123.95
0123 string (error) (error)
07 string (error) (error)
08 string (error) (error)
0b0100 int 5 4.5
0x1000 int 4097 4096.5
-123 int -122 -122.5
@ -9,3 +11,5 @@ x t y z
-0123 string (error) (error)
-0b0100 int -3 -3.5
-0x1000 int -4095 -4095.5
-07 string (error) (error)
-08 string (error) (error)

View file

@ -2,6 +2,8 @@ x t y z
123 string (error) (error)
123.45 string (error) (error)
0123 string (error) (error)
07 string (error) (error)
08 string (error) (error)
0b0100 string (error) (error)
0x1000 string (error) (error)
-123 string (error) (error)
@ -9,3 +11,5 @@ x t y z
-0123 string (error) (error)
-0b0100 string (error) (error)
-0x1000 string (error) (error)
-07 string (error) (error)
-08 string (error) (error)

View file

@ -2,6 +2,8 @@ x t y z
123 int 124 123.5
123.45 float 124.45 123.95
0123 int 84 83.5
07 int 8 7.5
08 float 9 8.5
0b0100 int 5 4.5
0x1000 int 4097 4096.5
-123 int -122 -122.5
@ -9,3 +11,5 @@ x t y z
-0123 int -82 -82.5
-0b0100 int -3 -3.5
-0x1000 int -4095 -4095.5
-07 int -6 -6.5
-08 float -7 -7.5

View file

@ -2,6 +2,8 @@ x
123
123.45
0123
07
08
0b0100
0x1000
-123
@ -9,3 +11,5 @@ x
-0123
-0b0100
-0x1000
-07
-08

1 x
2 123
3 123.45
4 0123
5 07
6 08
7 0b0100
8 0x1000
9 -123
11 -0123
12 -0b0100
13 -0x1000
14 -07
15 -08