fix: support large min/max values without precision loss#152
fix: support large min/max values without precision loss#152trnila wants to merge 8 commits intooxibus:mainfrom
Conversation
Min/max values are no longer represented as f64 internally that caused precision loss or value that couldnt fit in u64. For example 2**64 was represented as 18446744073709552000 instead of 18446744073709551615.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
I did a bunch of small changes - see what you think. I still feel i don't have enough domain expertise to make judgement calls on what it actually should do - i.e. if multiplexor is |
|
Domain expert advise is needed: What should be the DBC multiplexer behavior if the min/max values are signed or floating point values? |
|
Thanks @nyurik - changes looks fine although I haven't personally used muxed messages deeply. |
|
The issue is that we must define our behavior for all of these - and it doesn'tt matter if we have seen these or not: in other words, it could be totally ok to generate an error if the user used Int or Double - which would avoid the problem completely - if that's the valid behavior. I am just not certain we should automatically fallback to u16::MAX if the user gave -1 as multiplexor - but I'm not an expert in this, so no idea what is "right" |
|
@nyurik Multiplex values candb++ editor behaviour for setting multiplex value:
Currently, we are selecting multiplexed signals based on physical value (after applying linear conversion): Is this correct? Physical values might be negative or floating and cannot be compared with unsigned multiplex value m<value>? Shouldnt we rather compare directly with raw extracted bits? Its not caught in any test, as all multiplexed signals are having identity linear conversion.
codegen
|
|
Should any of the values/types result in an error? A failure to generate is a perfectly valid result in some cases |
|
I think there shouldnt be any error in dbc-codegen.
And this value could be compared to raw unsigned value of multiplexor signal like: We are now comparing the same things, so there shouldnt be any issues, if i am not mistaken. |
Min/max values are no longer represented as
f64internally that caused precision loss or value that couldnt fit inu64.For example
2**64was represented as18446744073709552000instead of18446744073709551615.