Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Modulus Makes Things Easy! (but not for me)
Modulus Makes Things Easy! (but not for me)
2004-10-04, 5:53 PM #1
I'm one of those weirdos who loves programming, learned algebra through Q-BASIC way before it was offered in school and then did horribly when it was in fact offered in school, and generally isn't all that amazing at math. Nor operators.

What's the procedure for using modulus to, say, cut the GetSoundLen() of a sound into three integer thirds and kill the remainder?
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2004-10-04, 6:42 PM #2
value = GetSoundLen() / 3 - (GetSoundLen() % 3) / 3;

I think. The fraction leftover is the remainder over the divisor... Subtract this from the full decimal and you get a whole number.
May the mass times acceleration be with you.
2004-10-05, 1:07 AM #3
Or...

value = GetSoundLen() % 3;

It's only if you want the remainder that you need to mess around with something like that

remainder = GetSoundLen() - ((GetSoundLen() % 3) * 3)
2004-10-05, 5:03 AM #4
Thanks!
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.

↑ Up to the top!