Important Notice: Due to repeated WikiSPAM attacks it was nessesary to change the access policy! Only registered users can now edit.

Office/FX-602P/Diff

From UIQ3 open-source software

Jump to: navigation, search
Main Page > Office > FX-602P > Office/FX-602P/Diff

Contents


Missing Features

The following Features are missing in and will probably never be implemented:

Passwords  
Password protection will be more difficult to implement then to crack.
Music Mode  
We can't make Music as the original FX-602P could.

Anything which is not working as expected and not mentioned here should be reported on the project's bug tracker.

Memory Management

The original FX-602P used a single memory area for both registers and program steps. You could have 22 register with 512 steps, 88 register and 32 steps or (almost) anything in between.

With the memory available on current devices this make no sense any more. The FX-602P Simulator always has 999 steps available for the user and you can choose between 11 and 110 register. Of course only the two extremes make sense - With 11 register you save some typing (MR1 instead of MR01) and with 110 you have plenty of working space.

Arithmetic

The largest difference between the original FX-602P and the Simulator is the arithmetic system used. The original FX-602P used 7 byte (M-Register) or 8 byte (L-Register) BCD floating point. Java however only supports IEEE_754-1985 binary floating point. Here a comparison of the two formats used:

Arithmetic Comparison
FX-602P HP 35s Java
L-Register M-Register single double
Base BCD BCD BCD Binary Binary
Size 64 bit 56 bit 64 bit 32 bit 64 bit
Mantissa 12 10 12 ~6 ~16
Exponent 0 .. ±99 0 .. ±99 0 .. ±499 0 .. ±126 0 .. ±308

While on the first glance doubles seem superior in all aspects they have one weakness: precession.

As mentioned Doubles are binary based - instead using an 10 based exponent (x×10y) it uses a two based exponent (x×2y). Those need to be converted from and to decimal which often leads to recurring decimals which can not be represented properly by floating point numbers.

M-register

Ever wondered where the MF-register come from? You can trade 8 programming steps for an M-register. And then every 10 M-register Casio gives you an MF-register for free. No not for free - the opposite is true: The M-register are only 7-byte / 56 bit BCD register. You can try that out for yourself.

Try the following:

 MODE4
 AC 9 SIN - .156 =
 AC 9 SIN Min00 .156 M-00 MR00

The Result of both lines should be the same - but it is not. L-Register are 12 digits (8 byte / 64 bit) but M-Register are only 10 digits (7 byte / 56 bit).

However - this is not true for the Simulator where all register have the same size (however, when M-Register are stored to a file then they are capped to 10 digits). This might break existing programs - but then we don't have perfectly matching arithmetic inside the simulator anyway. See next chapter.

Arithmetic Libraries

In addition to the data type one also needs a mathematical library. Which JavaSE contains a fairly complete Java.lang.Math JavaSE only has a reduces set (without arc-trigonometric functions and without logarithm function).

So to get the simulator running a 3rd party mathematical library is needed. Three have been evaluated so far:

Float11 
Works on doubles and contains the missing parts of Java.lang.Math.
UPN-Calc 
UPN-Calc is a little JavaME calculator for non smart phone. Internally it uses a fairly complete mathematical library using an complete implementation of n-digit BCD arithmetic. For the test below we use n=14 (Test with n=12 and n=20 have been made as well. with n=12 the result was not as good at the FX-602P results, with n=20 - or even n=24 the precision of BCD20 could not be reached).
BCD20 
BCD20 is a 20-digit BCD library written in C++ which might be suitable after porting to Java. BCD20 is used inside the Free42, an simulator of the HP 42s calculator which was used to get the results for the list below (The simulator rounds result to 12 digits.). The Free42 is widely used and should be well tested.

Note that none of the mathematical libraries have Hyperbolic functions. Luckily they are fairly easy to implement provided loge and ex are available.

The following list compares the four libraries with some simple looking but difficult calculations against the real FX-602P and and modern HP 35s. Note that Forensic (x) = x and any difference shows the margin of error of a particular calculator or mathematical library.

Precision Comparison
Expression JavaSE Math JavaME Math + Float11 UPN-Calc BCD20 FX-602P HP 35s
Base Binary 64bit Binary 64bit BCD 14-digit BCD 20-digit BCD 64bit BCD 64bit
sin(9) 0.4121184852417566 0.4121184852417566 0.412118485243 0.412118485242 0.412118485272 0.412118485242
Forensic (9) 8.99999999983257 9.009873761444954 8.99999614924 9 9.00000716758 8.99999986001
Forensic (9) - 9 -1.674305138976706E-10 0.009873761444953999 -0.00000385076 -1.3929e-19 7.16758E-6 -1,3999E-7
loge 5 1.6094379124341003 1.6094379124341003 1.60943791244 1.60943791243 1.60943791243 1.60943791243
log10 5 0.6989700043360189 0.6989700043360187 0.698970004339 0.698970004336 0.698970004336 0.698970004336
e5 148.4131591025766 148.41315910257654 148.413159104 148.413159103 148.4131591 148.413159103
eloge 5 5.0 4.999999999999998 5.00000000003 5 5. 4.99999999998
10log10 5 5.000000000000001 4.9999999999999964 5.00000000003 5 5. 5.
sinh 9 4051.54190208279 4051.54190208279 4051.54190213 4051.54190208 4051.541902 4051.54190208
asinh 9 2.8934439858858716 2.8934439858858716 2.89344398571 2.89344398589 2.89344398587 2.89344398589
cosh 9 4051.5420254925943 4051.5420254925943 4051.54202554 4051.54202549 4051.54202547 4051.54202549
acosh 9 2.8872709503576206 2.887270950357621 2.88727095025 2.88727095036 2.88727095033 2,88727095036
tanh 9 0.999999969540041 0.9999999695400409 0.99999996954 0.99999996954 0.999999969541 0.99999996954
atanh 0.9 1.4722194895832204 1.4722194895832204 1.47221948933 1.47221948958 1.47221948958 1.47221948958
hyp Forensic (1.8) 1.8000000000413767 1.799999999871062 1.79996279905 1.8 1.80000712258 1.79999945093
hyp Forensic (1.8) - 1.8 4.1376679860150034E-11 -1.289379714108918E-10 -0.00003720095 -2.1306e-20 7.12258E-6 -5.4907E-7
e100 2.6881171418161356E43 1.5238371312643595E35 2.68811714219E43 2.68811714182e43 2.68811714186E43 2.68811714182E43
e100.5 4.4319559098458955E43 1.9277384353529438E35 4.43195591048E43 4.43195590985e43 4.43195590991E43 4.43195590985E43
e101 7.307059979368068E43 2.4359418494183853E35 7.30705998042E43 7.30705997937e43 7.30705997949E43 7.30705997937E43
 ?100 5.187848314319592E49 5.187848314319591E49 5.18784831438E49 5.18784831432e49 5.18784831534E49 5.18784831435E49
 ?100.5 9.195221722629452E49 1.1426397054203799E38 9.19522170281E49 9.19522172263e49 9.19522172445E49 9.19522172268E49
 ?101 1.6298106152204625E50 1.629810615220462E50 1.62981061524E50 1.62981061522e50 1.62981061554E50 1.62981061523E50

If you like to have a go at the tests yourself you find the sources inside the subversion archive.

In the end the decision went for UPN-Calc with 18 digits precision. The reasons where:

  1. UPN-Calc with 18 digits is sufficiently precise
  2. 18 digits is the maximum precision which allow for easy conversion ot the mantissa to a java long.
  3. UPN-Calc has no know bugs - this is unlike Float11 which has a bug in ex for large x.
  4. UPN-Calc is already JavaME - this is unlike BCD20 which is written in C++.

Speed

The simulated calculator is a lot faster. The following test where made with an un-throttled version of it the Simulator. The current Simulator is throttled which will give a more realistic feeling and saves battery of battery powered devices.

There is one interesting aspect highlighted by the test: There is no need for an "high-performance" language like C or C++ when simulation / emulating an classic pocked calculator. Still, I would have preferred Ada for the design but not for the performance advantage but for Ada's bug-finding capabilities.

strikeout values are those of the old java double based version. The source code and expected results of the used programs can be found on the Test page.

Test Program 1

Speed Comparison
System Full speed throttled (200)
Speed Comparison
Count after 60sec Faster then Original Count after 60sec Faster then Original
FX-602P 2.685 2.685
Symbian, ARM 208 Mhz 2.586.324 963× 2.092×
Windows 2000, Core Duo, 2.2Ghz 194.893.771 72.586× 279.722× 5284 1,9×
Mac OSX, Xeon Quad-Core, 2.8Ghz 281.171.746 104.719× 327.706×

Test Program 2

Speed Comparison
System Count after 60sec Faster then Original
FX-602P 300
Symbian, ARM, 208 Mhz 33.159 110× 125×
Windows 2000, Core Duo, 2.2Ghz 3.486.949 11.623× 50.369×
Mac OSX, Xeon Quad-Core, 2.8Ghz 18.068.189 60.227× 98.617×

Test Program 3

Speed Comparison
System Time Faster then Original
FX-602P 2'23"
Symbian, ARM, 208 Mhz 2.5" 57×
Windows 2000, Core Duo, 2.2Ghz 0'00" ∞×
Mac OSX, Xeon Quad-Core, 2.8Ghz 0'00" ∞×

Test Program 4

Speed Comparison
System Time Faster then Original
FX-602P 10"
Symbian, ARM, 208 Mhz 2.5"
Windows 2000, Core Duo, 2.2Ghz 0" ∞×
Mac OSX, Xeon Quad-Core, 2.8Ghz 0" ∞×

Enhancement Ideas

Once the FX-602P Simulator is fully implemented I might consider an enhanced version.

More Steps

The amount of program steps has been capped at 999 because the exponent field can't display more 999. If for whatever reason more is needed one could extend to 999 steps per program - giving a total of 9990 steps.

More Memory

The amount of memory register has been capped as 99 + 9F because more can't be handled by the 5 planes. If for whatever reason more is needed one could use indirect addressing to access more then a 100 register. The HP 35s for example has 26 (A-Z) direct and up to 800 indirect memory register.

FX-603P

FX-603P
Enlarge
FX-603P

My first idea was the FX-603P Simulator but there are a few problems:

  1. The FX-603P has a lot more features to implement.
  2. The FX-603P supports PEEK and POKE - a no go for a Simulator one needs an Emulator for those.
  3. The FX-603P has 2 two line main display and a two lines if indicators which take up a lot of space then the the FX-602P display.
  4. The FX-603P has 55 keys on 10 lines, 5 keys and - more importantly - one line more then the FX-602P.

All in all an FX-603P won't be possible on an QVGA Display - so it has to wait for S60 5th Edition.

Personal tools