28 bytes with alpha lables Message #38 Posted by Allen on 30 Oct 2011, 11:06 p.m., in response to message #1 by M. Joury
Here's a 28 byte version, including 17 bytes for the alpha labels:
Using D. Knuth's definitions (Concrete Mathemetics, Ch. 3, p.67
FLOOR(x)="the greatest integer less than or equal to x."
CEIL(x) ="the least integer greater than or equal to x."
For CIEL, we increment 1 for negative input, for FLOOR we decrement 1 for positive input, then return the IP of the result in all 4 cases (pos,neg input and CIEL,FLOOR selection).
00 { 28Byte Prgm }
01>LBL "CIEL"
02 X>0?
03 ISG ST X
04 IP
05 GTO 00
06>LBL "FLOOR"
07 X<0?
08 DSE ST X
09>LBL 00
10 IP
11 .END.
Note: Does not account for integer inputs when ciel(x>0) or floor(x<0).
Edited: 30 Oct 2011, 11:29 p.m. after one or more responses were posted
