lmms icon indicating copy to clipboard operation
lmms copied to clipboard

Fixed issue #5734 (FreeBoy Division by zero)

Open aidan-mueller opened this issue 4 years ago • 3 comments

Added comments and used more descriptive variable names for noise channel initialization block.

Also indented the nested for loop to improve code clarity. The reasons for doing this can be found in this answer: https://softwareengineering.stackexchange.com/a/362796

aidan-mueller avatar Jun 13 '21 06:06 aidan-mueller

:robot: Hey, I'm @LmmsBot from github.com/lmms/bot and I made downloads for this pull request, click me to make them magically appear! :tophat:

Windows

macOS

:robot:
{"platform_name_to_artifacts": {"Windows": [{"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://output.circle-artifacts.com/output/job/a6c96e21-44d6-430f-981c-ff3c08e34903/artifacts/0/lmms-1.3.0-alpha.1.217+g476add8ab-mingw-win32.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/17749?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://output.circle-artifacts.com/output/job/81a673a2-7217-42ef-a5ed-9d5a101b71d1/artifacts/0/lmms-1.3.0-alpha.1.217+g476add8ab-mingw-win64.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/17747?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/4kpgsthd78n3dqbi/artifacts/build/lmms-1.3.0-alpha-msvc2017-win32.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/44120268"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/0nmxn1lg7nkx4hd4/artifacts/build/lmms-1.3.0-alpha-msvc2017-win64.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/44120268"}], "macOS": [{"artifact": {"title": {"title": "", "platform_name": "macOS"}, "link": {"link": "https://output.circle-artifacts.com/output/job/983c2c87-1b0e-4663-8842-7e84ecb2819d/artifacts/0/lmms-1.3.0-alpha.1.217+g476add8ab-mac10.14.dmg"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/17748?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}]}, "commit_sha": "32e98b7bf8338479b0530d63927a4bcd0cff645f"}

LmmsBot avatar Jun 13 '21 06:06 LmmsBot

@PhysSong noted this in the associated issue:

Also, (r, s) = (0, n) is equivalent to (r, s) = (1, n - 1), so we don't have to check for r = 0 unless s = 0.

Perhaps it would be simpler to use r = 0 and s = 0 for the initial guess outside the loops, then start the inner loop from r = 1?

DomClark avatar Jun 15 '21 16:06 DomClark

@DomClark You are correct. I actually saw that comment, but for some reason I didn't quite understand what he was saying until now (facepalm).

Edit:

Perhaps it would be simpler to use r = 0 and s = 0 for the initial guess outside the loops, then start the inner loop from r = 1?

I was thinking the same thing.

I'll add a commit to change this, and perhaps while I'm at it I'll also spend a bit of time trying to optimize further if I can.

aidan-mueller avatar Jul 06 '21 01:07 aidan-mueller