Number - Fixed Width Number Conversion routines =============================================== File: Number - Update: 1.01 Author: J.G.Harston - Date: xx-xxx-xxxx The Number library provides functions to convert integers to fixed width strings in hexadecimal, decimal, octal and binary. Requirements and Dependancies ============================= None. Convert integer to hexadecimal string ===================================== DEFFNh0(A%,N%) - hexadecimal padded with zeros DEFFNh(A%,N%) - dehadecimal padded with spaces FNh0() converts the supplied number to a fixed width hexadecimal string padded with zeros, FNh() converts the supplied number to a fixed width hexidecimal string padded with spaces. For example, FNh(10,6) returns " A" and FNh0(-1,8) returns "FFFFFFFF". Convert positive integer to decimal string ========================================== DEFFNd0(A%,N%) - decimal padded with zeros DEFFNd(A%,N%) - decimal padded with spaces FNd0() converts the supplied positive integer to a fixed width decimal string padded with zeros, FNd() converts the supplied integer to a fixed width decimal string padded with spaces. For example, FNd(10,6) returns " 10" and FNd0(10,6) returns "000010". Convert positive integer to octal string ======================================== DEFFNo0(A%,N%) - octal padded with zeros DEFFNo(A%,N%) - octal padded with spaces FNo0() converts the supplied positive integer to a fixed width octal string padded with zeros, FNo() converts the supplied positive integer to a fixed width octal string padded with spaces. For example, FNo(10,6) returns " 12" and FNo0(10,6) returns "000012". Convert positive integer to binary string ========================================= DEFFNb0(A%,N%) - binary padded with zeros DEFFNb(A%,N%) - binary padded with spaces FNb0() converts the supplied positive integer to a fixed width binary string padded with zeros, FNb() converts the supplied positive integer to a fixed width binary string padded with spaces. For example, FNb(10,6) returns " 1010" and FNb0(10,6) returns "001010". Notes ===== The octal and binary functions will work for a restricted range of negative numbers. They do not work correctly when b31=1 and b30=0. The octal functions return the first digit incorrectly when converting a negative number to a 11-digit string. Version History =============== 1.00 09-Aug-1988 First version written.