Giter Site home page Giter Site logo

thomasokken / plus42desktop Goto Github PK

View Code? Open in Web Editor NEW
56.0 56.0 11.0 9.88 MB

Plus42 : An Enhanced HP-42S Calculator Simulator

Home Page: https://thomasokken.com/plus42/

License: GNU General Public License v2.0

Shell 0.26% Python 0.19% C 16.71% C++ 76.85% Makefile 0.17% Objective-C 0.77% Objective-C++ 4.82% Batchfile 0.23% Vim Script 0.01%

plus42desktop's People

Contributors

thomasokken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plus42desktop's Issues

TVM rate guess

This is from core_commands9.cc do_i_pct_yr()

phloat i = 0.0001; // Arbitrary starting guess...

I think I have a robust guess for this.

First, what's wrong with above ?
NPMT=0 with unique rate solution, nothing's wrong.
Any reasonable guess (even crazy ones) will lead to the root.

Problem is when NPMT=0 had 2 rate roots.
NPMT curve look like a concave-up V.

Hard-coded rate might be located where slope of NPMT is small.
Newton's method may over-shoot it to no man's land.
If it overshoot to the right, possbily no harm is done.

If rate overshoot below −100%, code will break.
But, if we use rate guess from the edges, we are safe.

"Outside" guess for concaved-up curve, Newton's method never overshoot.

lua> n, pv, pmt, fv = 10, 50, -30, 80
lua> g = loan_rate(n,pv,pmt,fv, 0.0001) -- hard-coded guess
lua> g(), g()
-2.0050595733488947     -NaN    -NaN

lua> pmt/fv, pmt/-pv    -- rate edges
-0.375  0.6

lua> g = loan_rate(n,pv,pmt,fv, pmt/fv) -- low rate edge
lua> g(), g(), g()
-0.3689508127377895     -0.36893369888346206    -0.3689336987417774
lua> g = loan_rate(n,pv,pmt,fv, -pmt/pv) -- high rate edge
lua> g(), g(), g()
0.5846625273989696      0.5846195530179824      0.5846195526622099

For how rate edges are derived:
https://www.hpmuseum.org/forum/thread-18359-post-160156.html#pid160156

simpler tvm_eq()

From core_commands9.cc

static phloat tvm_eq(phloat i) {
    phloat pmt = tvm_pmt;
    if (tvm_m)
        pmt *= 1 + i;
    if (i == 0)
        return pmt + (tvm_pv + tvm_fv) / tvm_n;
    else
        return pmt + ((tvm_pv + tvm_fv) / expm1(tvm_n * log1p(i)) + tvm_pv) * i;
}

Let phloat tvm_m = tvm_pv + (mode==1) * tvm_pmt, above is simplified.
(I have not studied mode ranges, if it is just 0 or 1, remove ==1 part)

It is calculated outside rate search loop, thus also more efficient.
It is based from identity:

loan_rate(n, pv, pmt, fv, mode=1) = loan_rate(n, pv+pmt, pmt, fv-pmt, mode=0)

Revised tvm_eq():

static phloat tvm_eq(phloat i) {
    if (i == 0)
        return tvm_pmt + (tvm_pv + tvm_fv) / tvm_n;
    else
        return tvm_pmt + ((tvm_pv + tvm_fv) / expm1(tvm_n * log1p(i)) + tv_m) * i;
}

Rate iteration close to 0% bug

Regarding TVM I%YR rate search ...

A rare bug, when initial guess, or one of the iteration, is very close to 0%
Catastrophic cancellations could mess up derivatives, see here

Instead of special cased to test exactly i=0, we widen it:

        local eps, f = i*i
        if 1+eps==1 then
            local a, b = (pv+fv)/n, pv-fv
            local fp, fpp = (a+b)*0.5, (n*n-1)*a/6
            f, fp = (a+pmt)+fp*i, fp+fpp*i
            eps = -f / fp

Above simply use an approximation, for tiny i

f(i) ≈ f(0) + f'(0)*i
f'(i) ≈ f'(0) + f''(0)*i

New "A...F" FCN isn't appearing in catalog, assign lists, etc. How to access?

I cannot find any indication of 1.0.11's new "A...F" function anywhere in the Plus42 UI/UX. I can't find it in CATALOG, nor ASSIGN-able, and am not sure where i should be looking (or if it somehow isn't available). Please advise?

Thanks as always for all the hard work on Free42 and Plus42, it is very greatly appreciated!!

-John W

[Request] Ability to adjust font size and/or use (clearer) alternative font?

The default font can be a bit difficult to read (3's vs 9's, for example), so it would be great if we could adjust the sizing of the font within the display. Ideally, if we could select a different font (SwissMicros forums have a few donations worth exploring), that'd be even better.

I looked extensively in the docs for Free42 and Plus42 because I really believed there was already something available in layout settings or such, but if such settings exist, I was unable to locate them. Unrelated, but a single consolidated Plus42 manual (instead of a delta from Free42) would be helpful, and likewise w.r.t. layout file formatting.

Top (blank) row buttons mimicking row "Σ+" through "XEQ" by default

Unclear if intentional or not, but by default as of 1.0.11, the top (blank) row of buttons in Plus42 now do the same as the buttons in the row "Σ+" through "XEQ", which is surprising, unexpected (and arbitrary) behavior. I do not recall this being their behavior in 1.0.10 or prior, but could be misremembering in that regard, feels like new behavior in 1.0.11.

Please advise if intentional, and if so, would be nice if there was a preference to have them do nothing instead (until assigned).

P.S. Thanks for "A..F" function!

-John Wiederhirn

UNITS? function is missing

I'm running Plus42 1.0.19 (decimal) on MacOS 13.3.1 (Ventura) on an Intel Mac.
The UNITS? function as mentioned in the documentation doesn't appear in either the catalog or the UNIT.FCN menu.
There's no up/down indicator when the UNIT.FCN menu is displayed.
image

Display Expansion (of free42 skin) is not full width

Fixed: DisplaySize needed to be exactly correct.
skin is here

(btw I would probably* like the display lines to be changeable from the menu, as my default choice is 3 lines i.e. I can see x,y when the menu is displayed, but sometimes would like it longer)


Trying to make an existing skin work with plus42, and 3 lines. (linux)

If I don't specify DisplaySize, then it stretches the whole calculator longer.
But if I do specify it, and 3 lines, then the expanded zone appears to be the width of the pixel array only, and expands the screen area sown over the keyboard instead of making the calculator longer.

Skin: 0,0,320,460
Display: 12,18 2.25 3 caffbf 000000 
DisplaySize: 22,3 20 3 3   #has the problem described
DisplaySize: 22,2 18 3 3   #works properly.

image

power evaluated in wrong order

Hp50g: '2^3^4' EVAL, it produced 2^(3^4) ≈ 2.41785E24

Plus42: XSTR "2^3^4" PARSE EVAL, it produced (2^3)^4 = 4096

Is this worth fixing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.