Programming the INT and FRAC functions
|
01-08-2016, 08:50 AM
Post: #17
|
|||
|
|||
RE: Programming the INT and FRAC functions
Well, i just tried something on the 11c (which has int and frac, but this might similarly work on other calcs, so i tried it anyway).
This will only work if you usually use the same display mode, e.g. FIX 3. For INT: Code: 42,21,11 LBL A Explanation: the two ->H.MS bring the fractional part below 0.5 so that the number is always rounded down. FIX0 rounds the number in the display, RND rounds the number internally to the displayed value, and FIX3 brings back the old display setting (ad has to be replaced by your favourite display mode). For FRAC: Code: 42,21,12 LBL B Explanation: The number gets copied to y, then the INT function is run. afterwards the integer part is subtracted from the number in y, so that only the fractional part stays displayed. This works well and needs 12 steps. Still it only works only with one display mode (but as i personally mostly use ENG3 i can live with that). Also, the T register gets destroyed by using FRAC. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)