HP Forums
Help with a Program - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Help with a Program (/thread-16042.html)



Help with a Program - WrongWay - 12-11-2020 10:01 PM

I have a program tossing a DATA ERROR on the v41 software halting on line 62. I'm trying to run a stack trace to see why it's failing. Any help is appreciated.

Code:

001    LBL "DALT"
002    "TEMP C?"
003    PROMPT
004    STO 00    
005    STO 01    
006    XEQ "VP"
007    STO 02
008    "DEWPOINT C?"
009    PROMPT
010    STO 00
011    STO 03
012    XEQ "VP"
013    STO 04
014    "APORT LAT DMS?"
015    PROMPT
016    HR
017    D-R
018    STO 05
019    "APORT ELEV FT?"
020    PROMPT
021    3.2808
022    /
023    STO 06
024    XEQ "GEOALT"
025    STO 07
026    "QNH INCHES?"
027    PROMPT
028    33.8639
029    *
030    RCL 07
031    X<>Y
032    8.417286 E-05
033    *
034    X<>Y
035    0.190263
036    Y^X
037    -1
038    0.190263
039    /
040    Y^X
041    RCL 04
042    -
043    100
044    *
045    RCL 01
046    273.15
047    +
048    287.05
049    *
050    /
051    RCL 04
052    100
053    *
054    RCL 01
055    273.15
056    +
057    461.49
058    *
059    /
060    +
061    0.234969
062    Y^X
063    42.2665
064    *
065    44.3308
066    X<>Y
067    -
068    1000
069    *
070    STO 06
071    XEQ "GEOALT"
072    3.2808
073    *
074    "D. ALT: "
075    ARCL X
076    AVIEW
077    RTN
078    LBL "GEOALT" ;CONVERTS ELEVATION AND LAT TO GEOPOTENTIAL ALTITUDE
079    RCL 05
080    COS
081    6378137.0
082    X^2
083    *
084    X^2
085    RCL 05
086    SIN
087    6356752.314
088    X^2
089    *
090    X^2
091    +
092    RCL 05
093    COS
094    6378137.0
095    *
096    X^2
097    RCL 05
098    SIN
099    6356752.314
100    *
101    X^2
102    +
103    /
104    STO Y
105    RCL 06
106    *
107    X<>Y
108    RCL 06
109    +
110    /
111    RTN
112
113    LBL "VP" 
114    RCL 00
115    -0.30994571 E-19 ;C9
116    *
117    0.11112018 E-16 ;C8
118    +
119    RCL 00
120    *
121    -0.17892321 E-14 ;C7
122    +
123    RCL 00
124    *
125    0.21874425 E-12    ;C6
126    +
127    RCL 00
128    *
129    -0.29883885 E-10    ;C5
130    +
131    RCL 00
132    *
133    0.43884187 E-08 ;C4
134    +
135    RCL 00
136    *
137    -0.61117958 E-06    ;C3
138    +
139    RCL 00
140    *
141    0.787736169 E-04 ;C2
142    +
143    RCL 00
144    *
145    -0.90826951 E-02    ;C1
146    +
147    RCL 00
148    *
149    0.99999683
150    +
151    8
152    Y^X
153    6.1078
154    X<>Y
155    /
156    RTN
157    END



RE: Help with a Program - Joe Horn - 12-11-2020 10:06 PM

I suspect that line 62 is trying to raise a negative number to a fractional power, which the 41 cannot do, but says "DATA ERROR" instead.

It would help us if you gave us a hint about the program's purpose and inputs.


RE: Help with a Program - WrongWay - 12-12-2020 01:24 AM

I think I found my error, i got lost in my flow chart and forgot to actually finish the program


RE: Help with a Program - WrongWay - 12-12-2020 04:13 AM

I think I found an error in an equation. But im not sure how to implement this equation in rpn efficiently with 4 stacks.
T is a variable and the c_* arguments are constants.
(c0+T*(c1+T*(c2+T*(c3+T*(c4+T*(c5+T*(c6+T*(c7+T*(c8+T*(c9))))))))))
any help is greatly appreciated


RE: Help with a Program - Craig Bladow - 12-12-2020 05:43 AM

Assuming T is present in the X register, your program could fill the stack with T using a series of ENTER commands. Then the program basically works from C9 to C0 doing something like this in RPN for each constant: C9 * C8 + * C7 + * .......

This takes advantage of the stack duplicating the value in the T register when an operation, * in this case, causes the stack to drop.