Repository: godotengine/godot (language: cpp)

Issue:
Regression in Grid Snapping + Ruler on Godot 3.6, becomes inaccurate when zooming in
### Tested versions

- Reproducible in Godot v3.6.stable.official [de2f0f147]
- Works fine in Godot 3.5.x

### System information

Fedora 40 Linux, tested on both AMD Vega + Intel Iris GPUs

### Issue description

This appears to be a regression of this issue in 3.6: godotengine/godot#70186

When working with a Tilemap, of any size but say 64x64, and then you zoom in with a grid set to 64x64, the grid + ruler become inaccurate the more you zoom in, and it becomes more noticeable and less accurate the further right you go from the origin Vector2(0,0)

### Steps to reproduce

Here's a screencast showing this issue from my own project.

[grid-inaccurate-zoomed-godot-3.6.webm](https://github.com/user-attachments/assets/4044fe97-8d68-465f-b70f-253631d026f5)


### Minimal reproduction project (MRP)

Here's a simple project with a tilemap you can use to see the issue, just turn on grid snap the same size as tilemap, go a bit right from the origin and zoom in a lot, and you will notice the ruler + grid becoming more inaccurate

[SnapProblem.zip](https://github.com/user-attachments/files/17494925/SnapProblem.zip)



Discussion / hints:

Fix patch:
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index 4d48cf307d6f..bf9c29055fbe 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -87,7 +87,7 @@ void Range::set_value(double p_val) {
 
 void Range::set_value_no_signal(double p_val) {
 	if (shared->step > 0) {
-		p_val = Math::round((p_val - shared->min) / shared->step) * shared->step + shared->min;
+		p_val = Math::round(p_val / shared->step) * shared->step;
 	}
 
 	if (_rounded_values) {


Test patch: