stefangs Posted March 23, 2004 Posted March 23, 2004 Does anyone know an easy calc formula to convert decimal into hex numbers? Version: v6.x Platform: Mac OS 9
Lee Smith Posted March 23, 2004 Posted March 23, 2004 Here is a FMI tech article that may help. http://www.filemaker.com/ti/102254.html Lee
CyborgSam Posted March 23, 2004 Posted March 23, 2004 This will work for up to 32 bit numbers. And I came up with it before I read the tech article... Sometimes being an old bit-banger actually helps! This version is the instructional version, substitute the actual 2^x numbers to make it execute faster. Middle("0123456789ABCDEF", Mod( Int(theInteger / 2^28), 2^4) + 1, 1) & Middle("0123456789ABCDEF", Mod( Int(theInteger / 2^24), 2^4) + 1, 1) & Middle("0123456789ABCDEF", Mod( Int(theInteger / 2^20), 2^4) + 1, 1) & Middle("0123456789ABCDEF", Mod( Int(theInteger / 2^16), 2^4) + 1, 1) & Middle("0123456789ABCDEF", Mod( Int(theInteger / 2^12), 2^4) + 1, 1) & Middle("0123456789ABCDEF", Mod( Int(theInteger / 2^8), 2^4) + 1, 1) & Middle("0123456789ABCDEF", Mod( Int(theInteger / 2^4), 2^4) + 1, 1) & Middle("0123456789ABCDEF", Mod( theInteger, 2^4) + 1, 1) For those who don't know: a bit-banger is someone who worked on computers with front panel switches and lights (for each bit). The switches allowed data and instructions to be entered and the processor to be stopped, started, and single stepped through instructions. Many were the hours spent debugging operating systems & hardware... Fond memories of my Data General Nova and Teletype ASR-33.
stefangs Posted March 24, 2004 Author Posted March 24, 2004 just what the doctor ordered - thank you! i'll take a look at the teech articel also. bitbanger... i love it :-)
stefangs Posted April 11, 2004 Author Posted April 11, 2004 i thought i could just reverse the logic to make decimals from hex numbers. seems to be more involved. is there another formula that can do it or would i need to script it to convert one digit at a time?
BobWeaver Posted April 12, 2004 Posted April 12, 2004 This will give you the decimal value of a hex number that's up to 8 digits long: (((((((( (Position("0123456789ABCDEF",Middle(Right("00000000"&TheHexNumber,8),1,1),1,1 )-1))*16+ (Position("0123456789ABCDEF",Middle(Right("00000000"&TheHexNumber,8),2,1),1,1 )-1))*16+ (Position("0123456789ABCDEF",Middle(Right("00000000"&TheHexNumber,8),3,1),1,1 )-1))*16+ (Position("0123456789ABCDEF",Middle(Right("00000000"&TheHexNumber,8),4,1),1,1 )-1))*16+ (Position("0123456789ABCDEF",Middle(Right("00000000"&TheHexNumber,8),5,1),1,1 )-1))*16+ (Position("0123456789ABCDEF",Middle(Right("00000000"&TheHexNumber,8),6,1),1,1 )-1))*16+ (Position("0123456789ABCDEF",Middle(Right("00000000"&TheHexNumber,8),7,1),1,1 )-1))*16+ (Position("0123456789ABCDEF",Middle(Right("00000000"&TheHexNumber,8),8,1),1,1 )-1)) The field "TheHexNumber" must be text.
stefangs Posted April 12, 2004 Author Posted April 12, 2004 i wouldn't have come up with this in a million years! thanks much!
Recommended Posts
This topic is 7600 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now