User Forum :: Powered by YaBB
« MIDI-OX User Forum - Conditional tests take wrong branches »
Welcome, Guest. Please Login or Register.
Oct 25th, 2020, 10:28am


Home Home Help Help Search Search Members Members Login Login Register Register


   MIDI-OX User Forum
   HP16C Emulator
   HP16C Bug Reports
(Moderator: Jamie OConnell)
   Conditional tests take wrong branches
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Conditional tests take wrong branches  (Read 928 times)
RickN
Member
**



HP Calculator Enthusiast

   


Gender: male
Posts: 45
Conditional tests take wrong branches
« on: Jan 6th, 2015, 11:51pm »
Quote Quote Modify Modify

I am using version 2.1.0.036 of the emulator.  Load this "minimum value" program:
 
LBL A
x>y?
x><y  (x exchange y)
RTN
 
With default calculator settings it will work as expected.  For example, 5 ENTER 8 GSB A results in the minimum value of 5.  But set 4-bit unsigned math (4 WSIZE UNSGN) and it returns the wrong answer of 8.  The real HP-16C gives the right answer of 5.
 
My guess is that the 8 conditional tests ("Conditional Tests" on p88 of my April 1982 manual) do not correctly account for all complement modes.  There is a caveat in the manual on p88 saying "in 1's comp -0 = +0" that shows the implementation of the tests takes into account 2's comp, 1's comp, or unsigned.  Likely in this case 8 (unsigned 1000) gets interpreted as -8 (2's comp 1000) and as such is less than 5.  I found this working on a program that involves 4-bit unsigned registers to hold BCD digits.
IP Logged
Jamie OConnell
Administrator
*****






   
WWW Email

Gender: male
Posts: 2005
Re: Conditional tests take wrong branches
« Reply #1 on: Jan 21st, 2015, 12:22pm »
Quote Quote Modify Modify

Thanks for the report!  I will look into it.
IP Logged

--Jamie
Music is its own reward.

Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »


MIDI-OX User Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB 2000-2003. All Rights Reserved.