(12C) Fractional Part Function - Printable Version +- HP Forums ( https://www.hpmuseum.org/forum)+-- Forum: HP Software Libraries ( /forum-10.html)+--- Forum: General Software Library ( /forum-13.html)+--- Thread: (12C) Fractional Part Function ( /thread-14302.html) |

(12C) Fractional Part Function - Gamo - 01-03-2020 05:34 AM
The HP-55 doesn't have FRAC and INT funtions and I'm happen to see some program example from HP-55 User's Manual that program the fractional part routine in program. Try this Fractional Part routine and it work as expected on HP-12C Since this type of problem still exist on some programmble calculator that doesn't have these funtion, couple friend of my have ask me about this type of problem before and I didn' t know any good solution yet, until now. This FRAC functions routine only work on "Positive Integer" Example: FIX 9 2 [√X] display 1.414213562 [R/S] display 0.414213562 -------------------------------- 355 [ENTER] 113 [÷] display 3.141592920 [R/S] display 0.141592920 Program: FRAC function Quote:01 ENTER Remark: Program line 03 to 07 by itself canbe use as INT function. Gamo 1/3/2020 RE: (12C) Fractional Part Function - Joe Horn - 01-03-2020 06:15 AM
Doesn't the 12C have a FRAC function built in? RE: (12C) Fractional Part Function - Gamo - 01-03-2020 06:26 AM
Joe Horn The HP-12C got these functions. Just demonstrate this routine on 12C as an example, so that people who got other HP programmable calculator that doesn't have this function can adapt to it. Also HP-55 manual use this algorithm so it must be good to share for those who interested. Gamo RE: (12C) Fractional Part Function - Joe Horn - 01-03-2020 02:13 PM
Aha, I understand now. Thanks, Gamo! RE: (12C) Fractional Part Function - Albert Chan - 01-03-2020 06:53 PM
(01-03-2020 05:34 AM)Gamo Wrote: Remark: Program line 03 to 07 by itself canbe use as INT function. I think it is more like ROUND function. We may go for FLOOR instead, remove the branching code. Quote:01 ENTER For -1E9 < v ≤ 8E9: above defined FRAC(v) as v - FLOOR(v) = v - (ROUND(v - 0.5 + 2E9) - 2E9) Example: 123.45 R/S → 0.45 123.45 CHS R/S → 0.55 |