Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Feedback on: irt.org FAQ Knowledge Base Q535

irt.org | About | Feedback | 1326 [ previous next ]

Feedback on:
irt.org FAQ Knowledge Base Q535

Sent by
Simon Bate on June 06, 2000 at 12:19:07:

Worth:
Worth reading

Length:
Just right

Technical:
Not technical enough

Comments:
The solution doesn't tell the whole story, because if the number is negative, Math.floor will return the next LOWER integer, which is probably not a desirable result.

The answer should really be implemented as:

function getint(v) {
if (v<0) {
return(Math.ceil(v));
} else {
return(Math.floor(v));
}
}

Simon Bate



Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 21st December 2007. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.