Skip to content

fix: support large min/max values without precision loss#152

Draft
trnila wants to merge 2 commits intooxibus:mainfrom
trnila:minmax
Draft

fix: support large min/max values without precision loss#152
trnila wants to merge 2 commits intooxibus:mainfrom
trnila:minmax

Conversation

@trnila
Copy link
Member

@trnila trnila commented Mar 18, 2026

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.

trnila added 2 commits March 19, 2026 00:04
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.
@trnila trnila requested a review from nyurik March 18, 2026 23:19
@codecov
Copy link

codecov bot commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment on lines +212 to +213
min: can_dbc::NumericValue::Double(0.0),
max: can_dbc::NumericValue::Double(0.0),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shorter paths look easier to read (need a use at the top).

Suggested change
min: can_dbc::NumericValue::Double(0.0),
max: can_dbc::NumericValue::Double(0.0),
min: NumericValue::Double(0.0),
max: NumericValue::Double(0.0),

More strategically - should this be NumericValue::default() instead? And I wonder if min/max = 0 is the right value -- if there was no min/max, perhaps we should use Option::None ?

features = ["std"]

[patch.crates-io]
can-dbc = { git = "https://github.com/trnila/can-dbc", rev = "3a074924789c59954905186261133825907ed678" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no way we can merge this :)

let sig = signal.field_name().to_uppercase();
let min = signal.min;
let max = signal.max;
let min = &signal.min;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

min/max should be copyable types

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

Successfully merging this pull request may close these issues.

2 participants