Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behavior with float arrays in CTE #29

Open
kengruven opened this issue Jun 13, 2021 · 3 comments
Open

Strange behavior with float arrays in CTE #29

kengruven opened this issue Jun 13, 2021 · 3 comments

Comments

@kengruven
Copy link

In float arrays, enctool sometimes tries to write numbers in base-16, but doesn't quite use valid syntax:

$ echo 'c1 |f16 1|' | ./enctool convert -df cte
c0
|f16x 1p+00|

The enctool parser correctly reports this as an error:

$ echo 'c1 |f16 1|' | ./enctool convert -df cte | ./enctool convert -df cte
c0
offset 10 (line 2, col 8): unexpected [p] while decoding hex float

My first thought was that "1" is an int, not a float, and "f16" might be expecting only a float (despite there being only one 'numeric type'?). But it fails the same way for some floats, too:

$ echo 'c1 |f16 1.0|' | ./enctool convert -df cte
c0
|f16x 1p+00|

It's not just forgetting the ".0" when writing base-16 values inside an array, though. There's something weirder going on. Here, it prints an invalid number, and also flips the sign:

$ echo 'c1 |f16 -1|' | ./enctool convert -df cte 
c0
|f16x 1p+00|
@kstenerud
Copy link
Owner

There's a bug in the value printer somewhere. I had to put special code in for float16 values since it's not a native format, so something broke along the way I bet.

@kengruven
Copy link
Author

Hmm, you're right that most of these issues are f16-specific. Even with f32/f64, though:

$ echo 'c1 |f32 -1|' | ./enctool convert -df cte 
c0
|f32x 1|

Perhaps that's a separate bug.

@kengruven
Copy link
Author

Just to confirm, are |f32 1| and |i32 1.0| both considered valid?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants