Day 003: SGN - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: Official Links (https://staging.qb64phoenix.com/forumdisplay.php?fid=16) +--- Forum: Learning Resources and Archives (https://staging.qb64phoenix.com/forumdisplay.php?fid=13) +---- Forum: Keyword of the Day! (https://staging.qb64phoenix.com/forumdisplay.php?fid=49) +---- Thread: Day 003: SGN (/showthread.php?tid=1079) Pages:
1
2
|
RE: Day 003: SGN - Pete - 11-08-2022 (11-08-2022, 05:47 PM)SMcNeill Wrote:(11-08-2022, 04:11 PM)Pete Wrote: Nice. Without it, I'd probably just code: Agreed. I do like having keywords to handle things but I also like figuring out my own "functions" to make things I want happen. You have to admit the way I used that IF/THEN to avoid a division by zero error, in the code above, was PFC. Pete Pretty fine coding... Sure, let's go with that. RE: Day 003: SGN - bplus - 11-08-2022 I had some rounding code fixed for negative numbers with Sgn() in SmallBASIC board at Syntax Bomb this is QB64 version: Code: (Select All) $Console:Only Should be OK if stay out of exponential notation. RE: Day 003: SGN - Pete - 11-08-2022 That's a good one, too. It would otherwise take... Code: (Select All) FUNCTION roundDP$ (num, digits) ' fixed with sgn 2022-11-08 Pete RE: Day 003: SGN - bplus - 11-08-2022 @Pete check case > 0 in otherwise RE: Day 003: SGN - Pete - 11-08-2022 Feeling better but still missing stuff. Noticed it immediately. Forgot to change sign after paste. Edited. Thanks, Pete RE: Day 003: SGN - bplus - 11-08-2022 Yeah bus stations will do that ;-)) RE: Day 003: SGN - Pete - 11-08-2022 I'd say my wife has a frying pan with my name on it... but hey, we're pretty modern folks. The one she uses has facial recognition. Pete RE: Day 003: SGN - OldMoses - 11-09-2022 I've found SGN to frequently be quite useful. One of my better success stories in the use of SGN was this little snippet from a role playing character generator. Code: (Select All) FUNCTION Bonus% (mode AS INTEGER, stat AS INTEGER, PCin AS INTEGER) While it doesn't look like much to a casual observer, those two equations essentially replaced 16 lines of SELECT CASE block. Oh yes, and _CEIL was new to me when this was written too. RE: Day 003: SGN - Pete - 11-09-2022 And stirring the pot producing yet another beauty! + 1 Pete |