ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » Workflow Engines - IBM MQ Workflow & Business Process Choreographer » Float numbers in WF

Post new topic  Reply to topic
 Float numbers in WF « View previous topic :: View next topic » 
Author Message
Milesi
PostPosted: Tue Oct 07, 2003 7:26 pm    Post subject: Float numbers in WF Reply with quote

Apprentice

Joined: 15 Apr 2002
Posts: 37

Hello,

When we first design our worflow, we decided to store various amounts using the float data type. Unfortunately we recently realized that float values are approximate of decimal value, as they are binary fractions.

The effect can be noticed if you look at a xml message from a float data type container with for example the value 0.5560, the xml message will show 0.5560000000000001.

The problem is that we use those container values in the short description field of activities. This field is limited in length to 256 characters and such behavior could cause the description to become too big. As this description is parsed on a custom client to show user relevant information about an activity, going over the limit will at best mess up the display at worst create an error on the client. On top of this, it is hard to explain to users (and managers…) that the value they are seeing is just a representation of the actual figures.

The issue was raised to IBM and they replied us that it is perfectly normal. Which I understand, but which doesn't solve my problem. I need to change my float data types. But to what?

Option 1: Strings. Why not, the client handles the conversions and significant figures accuracy. So far so good, except that I haven’t found any way to convert back this string value to a decimal value for routing conditions. For example a routing rule such as BETA > 0.125. The only conversion I have found is VALUE() which convert a string expression to an integer.

Option 2. Long. This option requires us to define for every entry the number of significant figures. First issue, it depends on other data (For example currencies) Second issue, any program that will have to work with the container must be able to understand this notation, and convert the two long values to float. Third issue, the description field to render the value properly will have to look like %BETA%.%ALPHA%, then what if alpha represent the number of cents and this number is actually 02, it will show .2 instead. Finally, we have an interface that uses DTD from workflow to map data to another system. Change in container structures means change in DTD and substantial work on there side.

Hopefully there is an option that I have missed out.
Sorry for the long post and thank you for your help.
Regards.
Back to top
View user's profile Send private message Yahoo Messenger
Ratan
PostPosted: Tue Oct 07, 2003 8:31 pm    Post subject: Reply with quote

Grand Master

Joined: 18 Jul 2002
Posts: 1245

If I get your question correctly, your only problem is the display. Have two Container members one to hold the actual Float value and another to hold a string representation of it. Use the actual Float value for transitions and the string value for display.

Is this what you are looking for?
_________________
-Ratan
Back to top
View user's profile Send private message Send e-mail
Milesi
PostPosted: Tue Oct 07, 2003 9:31 pm    Post subject: Reply with quote

Apprentice

Joined: 15 Apr 2002
Posts: 37

Ratan wrote:
If I get your question correctly, your only problem is the display. Have two Container members one to hold the actual Float value and another to hold a string representation of it. Use the actual Float value for transitions and the string value for display.

Is this what you are looking for?


Thank you for your suggestion.

It is an option indeed and we thought of it. It has two big impacts so: first the custom client code must be changed to handle this duality (always save both values in case of float values). It doesn't sound too bad as it is only when writing to container that we have to change this. The second issue is the interface of XML messages to other systems. If the container change the DTD will also change and all the maps will have to be changed.
Maybe an option to this is to put all the string values associated to a float in a separate data structure and only map the normal structures to the UPES activity that send the XML message.

This might be a possible work around, but I am wondering if there is anything simpler.
Back to top
View user's profile Send private message Yahoo Messenger
Milesi
PostPosted: Tue Oct 07, 2003 9:40 pm    Post subject: Reply with quote

Apprentice

Joined: 15 Apr 2002
Posts: 37

We are also concerned with the following that is part of the answer we had from IBM:

"In conclusion, a floating-point number is, in many ways, only
an approximation of a true integer or decimal value. For this reason,
this field type should NOT be used for monetary data, nor for other
data where exact precision is required."
Back to top
View user's profile Send private message Yahoo Messenger
jmac
PostPosted: Wed Oct 08, 2003 11:26 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Jun 2001
Posts: 3081
Location: EmeriCon, LLC

What version are you using... I seem to recall an issue with floating point numbers in XML that was fixed with SP1 or SP2 of V3.4. I dont have access to my doc at the moment, so you will have to have a look on your own.
GOOD LUCK
_________________
John McDonald
RETIRED
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Milesi
PostPosted: Wed Oct 08, 2003 5:31 pm    Post subject: Reply with quote

Apprentice

Joined: 15 Apr 2002
Posts: 37

jmac wrote:
What version are you using... I seem to recall an issue with floating point numbers in XML that was fixed with SP1 or SP2 of V3.4. I dont have access to my doc at the moment, so you will have to have a look on your own.
GOOD LUCK


Thanks for the info John.

We just installed SP3 for V3.4. We previously had XML issues on V3.2 where the number of significant digits was in certain cases 10 instead of 16 as mentionned in the documentation (Which mainly caused issues for large numbers). At the time it was corrected with a fix wich I thing was indeed included in a service pack. The issue we face now is not related to XML, what the XML shows is actually the value saved in DB2 as IBM confirmed. Our problem is that their is no simple solution to have exact decimal values in containers that are actually considered as numerical values (For the purpose of comparaison, routing, display from description). Using long or string data types are work around.
I was hoping I had missunderstood something along the way.
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » Workflow Engines - IBM MQ Workflow & Business Process Choreographer » Float numbers in WF
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.