Skip to content

build_matrix includes weird imaginary numbers #9241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gm-bug-reporter bot opened this issue Feb 1, 2025 · 2 comments
Closed

build_matrix includes weird imaginary numbers #9241

gm-bug-reporter bot opened this issue Feb 1, 2025 · 2 comments
Labels
project This issue has a sample project attached runner-bug In-game bugs with the "GameMaker Studio 2" runtimes

Comments

@gm-bug-reporter
Copy link

Description

making a matrix like matrix_build(0,0,0,90,0,0,1,1,1)
should make a matrix at position 0, rotated 90 degrees on the "x" axis
in gamemaker that appears like this.

Image

specifically -4.371... so on. Appears incorrect. I think it should be 0
if you take that number and round it. It also becomes 0, depsite not being close to 0.

squaring the number however, doesn't give the result -4.371.... should give either. but gives 1.9106....

show_debug_message on the number also simply displays 0

in short, i think there is some decimal error shenanigans with how matrices are created and handled, that makes these 0's in disguise appear that can cause issues, if you need to use them directly.

Steps To Reproduce

  1. Start GameMaker
  2. create code in create event of an object. placed in a room

var rotation_mat = matrix_build(0,0,0,90,0,0,1,1,1)
var odd_number = rotation_mat[5]

var rounded = round(odd_number) //becomes 0
var squared = sqr(odd_number) //becomes 1.910605....

  1. place breakpoint, on odd_number, and observe the result of the different variables.

Which version of GameMaker are you reporting this issue for?

IDE v2024.11.0.179 Runtime v2024.11.0.227

Which operating system(s) are you seeing the problem on?

Windows 10.0.19045.0

Which platform(s) are you seeing the problem on?

Windows

e86cae4a-7ab0-480a-8fcc-a736a5778e5d

@gm-bug-reporter gm-bug-reporter bot added project This issue has a sample project attached runner-bug In-game bugs with the "GameMaker Studio 2" runtimes labels Feb 1, 2025
@L-Clouds
Copy link

L-Clouds commented Feb 1, 2025

Those are numbers in scientific notation, not imaginary numbers.

They are close to zero. -4.371...E-08 means -4.371*10-8, which is -0.00000004371

They likely are not exactly 0 due to imperfect numerical precision for better speed and memory use, a very normal and standardized concept in computing.

@stuckie
Copy link

stuckie commented Feb 3, 2025

Closing as above.

@stuckie stuckie closed this as not planned Won't fix, can't repro, duplicate, stale Feb 3, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Team Workload Feb 3, 2025
@YYBartT YYBartT moved this from Done to Not Planned in Team Workload Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project This issue has a sample project attached runner-bug In-game bugs with the "GameMaker Studio 2" runtimes
Projects
Status: Not Planned
Development

No branches or pull requests

2 participants