precision lose using Pos2 and Vec2
- Dominant language
- Rust
- Stars
- 30.6k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 72
Description
Hello
**Describe the bug**
I have a very big ScrollArea and want to place an element, let's say, in the middle of it
If I want to place my element at `345045100`
But if I want to place my next element at `345045100 + 15.125 = 345045115.125`
It will not work, because the f32 isn't precise enough
```rs
fn main() {
let a: f32 = 345045100_f32;
let b: f32 = 15.125_f32;
println!("{a} + {b} = {} (f32)", a + b);
println!("a.next_up() = {} (f32)", a.next_up());
let a: f64 = 345045100_f64;
let b: f64 = 15.125_f64;
println!("{a} + {b} = {} (f64)", a + b);
println!("a.next_up() = {} (f64)", (a as f64).next_up());
}
// 345045100 + 15.125 = 345045100 (f32)
// a.next_up() = 345045120 (f32)
// 345045100 + 15.125 = 345045115.125 (f64)
// a.next_up() = 345045100.00000006 (f64)
```
I think it would be nice to have Pos2 and Vec2 as f64 available !
Contributor guide
Research direction
Start by running the Rust precision reproduction from the issue and reviewing the existing Pos2 and Vec2 APIs. Determine the scope and compatibility requirements for making f64-based position and vector types available; done means large ScrollArea coordinates can represent the requested fractional offset accurately.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100