![]() ![]() For encoding digits 1 through 9, B and A are zero and the digit value represented by standard 4-bit BCD in bits 8 through 1. The IBM 1400 series are character-addressable machines, each location being six bits labeled B, A, 8, 4, 2 and 1, plus an odd parity check bit ( C) and a word mark bit ( M). Burroughs systems used 1101 (D) for negative, and any other value is considered a positive sign value (the processors will normalize a positive sign to 1100 (C)). These match the EBCDIC zone for digits without a sign overpunch. ILE RPG uses 1111 (F) for positive and 1101 (D) for negative. Most implementations also provide unsigned BCD values with a sign nibble of 1111 (F). ![]() IBM System/360 processors will use the 1010 (A) and 1011 (B) signs if the A bit is set in the PSW, for the ASCII-8 standard that never passed. Other allowed signs are 1010 (A) and 1110 (E) for positive and 1011 (B) for negative. This convention comes from the zone field for EBCDIC characters and the signed overpunch representation. Only when you have a working algorithm and code that you believe implements that algorithm but doesn't produce the correct result do you need to post here.Standard sign values are 1100 (hex C) for positive (+) and 1101 (D) for negative (−). ![]() At every step, you can compare the code to the algorithm to confirm that it does what it is supposed to do. If it works for a manual process then it will work in code, so you can then write code to implement the algorithm specifically. Formalise those steps into an algorithm and follow that algorithm. Think about the steps that need to be performed and perform them. Put the code away for now and do the process manually. the steps to get to a result rather than just the result. This is what happens when you try to write code without knowing what that code has to do, i.e. Why would you think that working on eight bits at a time was appropriate when there are obviously two sets of four bits representing the two digits? Why would you think that converting a number to a char was appropriate when the whole point of the exercise is to convert chars to numbers? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |