(41) Round To The Nearest 1/n
|
04-13-2018, 06:27 PM
Post: #4
|
|||
|
|||
RE: (41) Round To The Nearest 1/n
(04-12-2018 08:24 PM)Mike (Stgt) Wrote: I get the same this way: Wow, that's a quite ...creative solution. I'm not sure if I understand completely how this works. For a more straightforward approach see below. (04-12-2018 08:24 PM)Mike (Stgt) Wrote: Note: Do not round "twice", rounding a result to a new n-th. Sure. You once round \(\pi\) and once \(\frac{101}{32}\). So the results are different. (04-12-2018 08:24 PM)Mike (Stgt) Wrote: Dieter's hint int(x+0,5) would take two bytes less. Right – 9 bytes without LBL and END. But here x and n must have identical signs: Code: 01 LBL "RNR" But with 2 bytes more there is a way to handle also different signs: Code: 01 LBL "RNR" Finally, here is a TI-59 version. Data entry is done "the HP way": x [x<>t] n. ;-) Code: 000 LBL Or with the already mentioned EE INV EE rounding method: Code: 000 LBL Of course real TI-59 programmers would avoid "=" and use parentheses instead. ;-) Dieter |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(41) Round To The Nearest 1/n - Eddie W. Shore - 04-12-2018, 01:10 PM
RE: (41) Round To The Nearest 1/n - hth - 04-12-2018, 06:12 PM
RE: (41) Round To The Nearest 1/n - Dieter - 04-12-2018, 06:57 PM
|
User(s) browsing this thread: 1 Guest(s)