Staredit Network

Staredit Network -> Computers and Technical -> Rounding Numbers Down
Report, edit, etc...Posted by O)FaRTy1billion on 2005-11-06 at 19:54:31
In what I am doing I need to round numbers down.
So like 3.9 would be 3, 2.3 would be 2, etc.
I tried and found Math.Round, but that just rounds to the nearest number (Like 3.9 would be 4, when I need it 3)

I'll look more while I wait for replies.
Report, edit, etc...Posted by Voyager7456(MM) on 2005-11-06 at 20:01:03
Heh, I'm doing JavaScript too.

If you parsed the number into an integer, it would truncate the decimal, which is what you want, right? There's probably an easier way, but I'm a JavaScript n00b.
Report, edit, etc...Posted by O)FaRTy1billion on 2005-11-06 at 20:11:08
Ya, I found a way around it.

HTML
document.Show.clicky.value=Math.round(eval('('+document.Show.MouseX.value+'-16)/32'))+Math.round(eval('('+document.Show.MouseY.value+'-16)/32'))"

(dunno if that is IE only, but I am only playing with it...)

EDIT: Yay! It does work in FF!
Next Page (1)