TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Jasen Betts
from: Jasen Betts
date: 2004-04-10 07:07:58
subject: [C] way out ?

06-Apr-04 16:55:18, Jasen Betts wrote to Kurt Kuzba

 JB> #include 
 JB> float stepup_if_above( float num, float step)
 JB> {
 JB>     float rounded = floor(num/step)*step;
 JB>     return rounded + ( (rounded==num) ? 0 : step );
 JB> }

what a waste of space that was... all that I needed was this:

 #include 
 float stepup_if_above( float num, float step)
  {
   return ceil(num/step)*step;
  }

a triumph of arithmetic over logic.

 -=> Bye <=-

---
(3:640/1042)
* Origin: You think "I'm no fool!" but I am! - Spike Milligan
SEEN-BY: 633/267 270
@PATH: 640/1042 531 954 774/605 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.