Mandelbrot example only zooms out and 0.9 < 1.0 == false #19766
Labels
Bug
This tag is applied to issues which reports bugs.
Unit: Examples
Bugs/feature requests, that are related to the examples.
Describe the bug
In the Mandelbrot example, attempting to scroll up or down results in only zooming out. The
zoom
function takes in thezoom_factor
argument of typef64
, however it does not behave normally.link to Mandelbrot zoom function
println(zoom_factor)
->0.9090909090909091
println(typeof(zoom_factor))
->f64
zoom_factor < 1
->false
zoom_factor < 1.0
->false
f64(zoom_factor) < 1
->true
f64(zoom_factor) < 1.0
->true
Despite already being an
f64
,zoom_factor
does not function correctly until cast as anf64
again.Unfortunately, fixing this issue still results in the Mandlebrot only zooming out despite the
state.scale
increasing.Reproduction Steps
v/examples/gg/mandelbrot.v
Line 132 in 2ef49b8
println(zoom_factor)
println(typeof(zoom_factor))
println(zoom_factor < 1)
println(zoom_factor < 1.0)
println(f64(zoom_factor) < 1)
println(f64(zoom_factor) < 1.0)
Expected Behavior
all evaluate to true
Current Behavior
evaluates to false unless recast as f64
Possible Solution
A git bisect identified the bad commit as: 055e113
I have made a pull request that comments out the lines causing the bug #19773
Additional Information/Context
Issue is not present using V 0.4.1, with the same
mandelbrot.v
file0e2dc38
V version
0.4.2 fbefe68
Environment details (OS name and version, etc.)
V full version: V 0.4.2 fbefe68
OS: windows, Microsoft Windows 11 Pro v22621 64-bit
Processor: 16 cpus, 64bit, little endian,
getwd: C:\Users\matt_\Documents_scripts\repos\v\examples
vexe: C:\Users\matt_\Documents_scripts\repos\v\v.exe
vexe mtime: 2023-11-03 16:35:02
vroot: OK, value: C:\Users\matt_\Documents_scripts\repos\v
VMODULES: OK, value: C:\Users\matt_.vmodules
VTMP: OK, value: C:\Users\matt_\AppData\Local\Temp\v_0
Git version: git version 2.37.2.windows.2
Git vroot status: weekly.2023.44-30-gfbefe685-dirty (16 commit(s) behind V master)
.git/config present: true
CC version: Error: 'cc' is not recognized as an internal or external command,
operable program or batch file.
thirdparty/tcc status: thirdparty-windows-amd64 e90c2620
The text was updated successfully, but these errors were encountered: