mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-14 19:26:56 -04:00
Review: a whole number past i64::MAX is past any maximum; ROADMAP (#1091)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
aecf88c1c1
commit
5e9b7d09a2
2 files changed
+4
-3
No files matched your search
@@ -206,8 +206,9 @@ impl Manifest {
|
||||
// Keep JSON integers exact: f64 cannot represent every i64 or its bounds.
|
||||
let value = if let Some(i) = v.as_i64() {
|
||||
i.clamp(*min, *max)
|
||||
} else if let Some(i) = v.as_u64() {
|
||||
i128::from(i).clamp(i128::from(*min), i128::from(*max)) as i64
|
||||
} else if v.is_u64() {
|
||||
// Past i64::MAX, so past any maximum.
|
||||
*max
|
||||
} else {
|
||||
let f = v.as_f64().filter(|f| f.is_finite()).ok_or_else(|| wrong("a number"))?;
|
||||
(f.round() as i64).clamp(*min, *max)
|
||||
|
||||
Reference in new issue
Block a user