Followers 0

# 64 bit IEEE double-precision Question

## 38 posts in this topic

Thanks for covering me on that exponent ContrConn. I just ASSumed that eveyone would understand that I was speaking decimal (10**38) and not binary (2**127) - but its always better to make those things precisely clear. Its easy to see how someone could come along and find this thread and misunderstand. The bit DINTTAG[1].30 is the sign bit for the exponent. If it is set then the exponent is negative, making our 64 bit floating point number less than 1. For converting very very small numbers, numbers that would have more than 38 leading zeros between the decimal point and the first non zero digit if we were to write it in base 10 decimal, we could run into conversion problems. This is very possible with 64 bit numbers from instruments because the instrumentation very rarely measures exactly zero. This rung will trap for out of range exponents at near zero values (negative exponents that are less than -127 binary) and just make the converted value zero. XIC DINTTAG[1].30 BST XIC DINTTAG[1].29 NXB DINTTAG[1].28 NXB XIC DINTTAG[1].27 BND CLR REAL_TAG As I said earlier though, the need to trap for expnents larger than 38 (decimal) is probably rare, but if you do need it the following will do the trick: BST XIC DINTTAG[1].29 NXB DINTTAG[1].28 NXB XIC DINTTAG[1].27 BND BST XIO DINTTAG[1].30 MOV 1065353216 BUFF NXB XIC DINTTAG[1].30 MOV 2139095040 BUFF NXB COP BUFF REAL_TAG 1 BND. This will set the result real tag to + or - infinity. Edited by Alaric

##### Share on other sites
Ok it looks like this thread is on its way to being resolve so I just got to ask, what type of applications would require 64 bit floating numbers?

##### Share on other sites
I dont think it is the application so much as it is the instrument. Some instruments just return double precision floats rather than single precision floats. You may have an instrument that speaks Modbus and so you get back 4 16 bit words that you need to convert to a single precison float. Maybe the instrument was designed by an ANALytical engineer who did it just because he could.

##### Share on other sites
Oh ok, that makes sense. I was just trying to find a practical application that requires this. I am sure there are some but they are just not in any industries that I have worked in I guess Thanks TW

##### Share on other sites
This as been very well resolved for me and I now have a working model. Thanks for the help and detailed explanations David

##### Share on other sites
Motion control. We use 64 bit floating point in some cases where accuracy is necessary. Our newest motion controller uses a PowerPC. However we can't use the 64 bit floats when talking to the outside world because of PLC don't understand 64 bit floats. Functions that motion controllers use like exp(), ln(), cos(), sin(), asin() etc are computed using approximations that are caluclated using Taylor series. There is a lot of adding and subtracting in these routines and floating point results lose accuracy when small numbers are added or subtracted from large numbers. Round of errors will always occurs but single precision floats provide about 6-7 digits of accuracy and doulbe precision float provide about 15-16 digits. So if you make a series of short moves all day and the error build up, what precision floating point do you want to use? Believe me, just because you have a floating point processor doesn't mean you can ignore round off and other precision errors. We often see problems when people try to accumuate milliseconds. A millisecond or .001 seconds can't be truely represent by a floating point number. If you add 0.001 1000 times it will not add up to 1. We have to tell people to accumulate millisecond as integer milliseconds and then mulitply by 0.001.

##### Share on other sites
Yes, good point Peter. Guess that's why I couldn't see it, mine are much simpler. Run, cut, on to the next part, run, cut, on to the next part, run.......

##### Share on other sites
Congratulations everyone. MRPLC got its first Rockwell Technote recognition http://domino.automation.rockwell.com/appl...B4?OpenDocument Look right above the download

##### Share on other sites
Congratulations. Im glad to have been a part of it and im sure it will help many more people in times to come. Regards David

##### Share on other sites
I just want to know how TW finds these so easily. You need to write a technote search primer.

##### Share on other sites
TW was out for a week, so I guess he had too much time for these searches... Or maybe he has some good friends Edited by Contr_Conn

##### Share on other sites
Yes Bob, I must admit I can't take the credit. I might would have gotten away with it but I am still catching up on my emails which contains my technote readings from being out for a week. I learned about it in the same manner you have. I good friend informed me of it. Well let me clarify this, I learned about it from a good friend, don't know what you would consider your source to be I do read all technote titles which I subscribe to through email, but I don't always read everyone though I do try to. Have you subscribed to the technote notification system? http://support.rockwellautomation.com/Pref...Information.asp

##### Share on other sites
Here is a search hint: Go to knowledgebase, and select technotes published within last 30 days. Select Programmable controllers This technote will be on the top.

## 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 account