(15/42/47): Floor and Ceiling Functions
|
11-04-2023, 12:46 AM
(This post was last modified: 12-23-2023 01:32 AM by Eddie W. Shore.)
Post: #1
|
|||
|
|||
(15/42/47): Floor and Ceiling Functions
HP 15C
(not accurate for -1 < x < 0) Three labels are used: D: floor function E: ceiling function 1: used in calculation for both (roll stack down one extra time when frac(x)≠0) Code assumed starts from line 000. Code: step #: key code : key DM 42 Code: 00 { 16-Byte Prgm } HP 27S Code: FLOOR=X-MOD(X:1) Sources: Wolfram Research, Inc. "Floor Function". Path: Integer Functions > Floor[z] > Representations through equivalent functions > With related functions. Retrieved October 30, 2023. https://functions.wolfram.com/IntegerFun.../27/01/05/ Wolfram Research, Inc. "Ceiling Function". Path: Integer Functions > Ceiling[z] > Representations through equivalent functions > With related functions. Retrieved October 30, 2023. https://functions.wolfram.com/IntegerFun.../27/01/05/ |
|||
12-22-2023, 08:28 AM
Post: #2
|
|||
|
|||
RE: (15/42/47): Floor and Ceiling Functions
Hello Eddie;
I'm afraid the 15C versions are not correct; both FLOOR and CEIL fail for X=-0.5, returning 0 and 1 respectively. Here's what I've been able to come up with for FLOOR; CEIL is similar 2 stack levels, 9 bytes without LBL and RTN. Using, but not changing I In: L.XYZT Out: X.FYZ- with F=FLOOR(X) INT X<> I LASTX FRAC TEST 2 ( X<0? ) DSE I ( always skips ) CHS ( nop ) Rv X<> I Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
12-22-2023, 01:55 PM
Post: #3
|
|||
|
|||
RE: (15/42/47): Floor and Ceiling Functions | |||
12-24-2023, 10:08 AM
Post: #4
|
|||
|
|||
RE: (15/42/47): Floor and Ceiling Functions
(12-22-2023 01:55 PM)Albert Chan Wrote:(12-22-2023 08:28 AM)Werner Wrote: Here's what I've been able to come up with for FLOOR; CEIL is similar ... Hi Albert; yes but that uses a subroutine level ;-) Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
03-23-2024, 03:47 PM
Post: #5
|
|||
|
|||
RE: (15/42/47): Floor and Ceiling Functions
A modest contribution
1) Some Curious Sequences Involving floor & ceiling functions: The American Mathematical Monthly; Vol. 109, No. 6 (Jun. - Jul., 2002) pp. 559-564 2) Solving Recurrence Relations involving floor & ceiling functions: Electronics Letters; 18th August 1994 Vol. 30 No. 17, pp.1391-1393 3) a Summation Formula for Sequences Involving floor & ceiling functions: ROCKY MOUNTAIN JOURNAL OF MATHEMATICS; Volume 36, Number 5, 2006, pp. 1595-1602 BEST! SlideRule |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)