Hi does anybody know do I get the next nearest integer? Not just rounding to the NEAREST, it needs to always round in the same direction cos It's for a color picker and My gradient goes wrong if it round down for a particular value when all the others were rounded up
So 1.3 => 2 (not 1)
and 1.6 => 2 also
etc
Rounding numbers UP not down
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
perhaps the ceil() funtion is what you are lookign for
http://uk2.php.net/manual/en/function.ceil.php
http://uk2.php.net/manual/en/function.ceil.php
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Nice one thanks.... got it working now.
Only issue is the fact that it takes ages to process my script cos i have two loops each with 64 iterations nested one inside the other (one moves to the next row, the other moves to the adjacent cell) so that 64x64 = 4096 repetitions just to create a table with 4096 cells... even higher if the user wants to modify the max num colors available in the configuration...
Maybe I'll post my code in another thread and see if I could cut it down at all....
EDIT: this is just the initial pallette that loads... javascript will be used to change the pallette based on the user's hue selection... that's gonna crash the browser i'd say
Only issue is the fact that it takes ages to process my script cos i have two loops each with 64 iterations nested one inside the other (one moves to the next row, the other moves to the adjacent cell) so that 64x64 = 4096 repetitions just to create a table with 4096 cells... even higher if the user wants to modify the max num colors available in the configuration...
Maybe I'll post my code in another thread and see if I could cut it down at all....
EDIT: this is just the initial pallette that loads... javascript will be used to change the pallette based on the user's hue selection... that's gonna crash the browser i'd say
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia