NOP0 / rustmatic

PLC programming in Rust!
Apache License 2.0
35 stars 2 forks source link

Engineering floats #22

Open NOP0 opened 4 years ago

NOP0 commented 4 years ago

I think I'm on thin ice and might need some mentoring here. Trying to implement "engineering floats" that is

3.14E-1 // 0.314

There's a lot of unwrapping going on, is this ok? The exponent is max u32, but I think that is large enough by the IEEE standard?

Another thing I see now, is that this rule might need to be over the float rule? (Most specific first?)

NOP0 commented 4 years ago

Redid this, tried in principle to do it like the different variants of Integer. What do you think?

Edit: I'm used to the convention asserteq(expected, actual), but in ast.rs it's used asserteq(got, should_be). Is it there any reason for this?