(32S) Accurate TVM with direct solutions
|
01-01-2016, 02:11 PM
(This post was last modified: 01-01-2016 06:03 PM by Dieter.)
Post: #12
|
|||
|
|||
RE: (32S) Accurate TVM with direct solutions
(12-31-2015 02:08 PM)Dave Britten Wrote: Whoops, I mis-transcribed it in my haste. I'll correct it above. It still isn't perfect. The ln(1+x) code does not work for very small arguments where 1+x rounds to 1. In this case x+1–1 becomes zero and the following division throws an error. That's why the original (Kahan) code included a x≠y? test.This consumes one more stack level, but it doesn't hurt as the initial calculation of 100/I + B can be done later so this value does not have to be saved on the stack. In general, there is no need for any temporary registers (here T and L), all this can be done on the stack. (12-31-2015 02:08 PM)Dave Britten Wrote: The 100 vs. 10^2 thing is a peculiarity of the way the 32S stores numbers. Integers from 0-99 take up 1.5 bytes. Anything else is 9.5 bytes. So 100 is 9.5 bytes, whereas 2 10^x is only 3 bytes. I see. But still 10 x^2 is faster than 2 10^x, and there also is a percent function that returns x/100 with a simple 1 %. ;-) Edit: I could not believe the 0...99 limit, so I wanted to know what the 32s II manual says. Here is what I found on page 12-20/21: "Numbers use 9.5 bytes, except for integer numbers from 0 through 254 which use only 1.5 bytes". There you are: you can safely use "100" and "200" in your program and they still won't require more than 1.5 bytes. Addendum: Here is what I got – I hope there are not too many errors. ;-) Code: LBL T At least it's shorter than the previous version (42 lines) and does not require any additional registers. Dieter |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(32S) Accurate TVM with direct solutions - Dave Britten - 05-17-2015, 12:55 AM
HP 35s - TVM from Gene Wright - PedroLeiva - 12-03-2015, 12:39 PM
RE: (32S) Accurate TVM with direct solutions - Jeff_Kearns - 12-26-2015, 11:24 PM
RE: (32S) Accurate TVM with direct solutions - Dieter - 12-30-2015, 08:22 AM
RE: (32S) Accurate TVM with direct solutions - Dave Britten - 12-30-2015, 12:13 PM
RE: (32S) Accurate TVM with direct solutions - Jeff_Kearns - 12-30-2015, 03:05 PM
RE: (32S) Accurate TVM with direct solutions - Dieter - 12-31-2015, 12:23 PM
RE: (32S) Accurate TVM with direct solutions - Dave Britten - 12-31-2015, 01:37 PM
RE: (32S) Accurate TVM with direct solutions - Dieter - 12-31-2015, 01:49 PM
RE: (32S) Accurate TVM with direct solutions - Dave Britten - 12-31-2015, 02:08 PM
RE: (32S) Accurate TVM with direct solutions - Dieter - 01-01-2016 02:11 PM
RE: (32S) Accurate TVM with direct solutions - Jeff_Kearns - 12-31-2015, 02:04 PM
|
User(s) browsing this thread: 1 Guest(s)