Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Preventing Rounding in Calculations and Display

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Preventing Rounding in Calculations and Display
 Login/Join
 
Member
posted
Hello all,

I have a situation with undesired rounding in calculations using the D format.

My code is basically..

DEFINE FILE TEST
A/I4 = 3;
B/I4 = 9;
C/I4 = 6;
END

TABLE FILE TEST
PRINT
COMPUTE VAR1/D6.1 = (A / B) * 100;
COMPUTE VAR2/D6.1 = (A / C) * 100;

COMPUTE RESULT/D6.1 = VAR1 / VAR2;
.....
END

I'm using D6.1 because the IBI documentation said that when using the D format, the numbers and precision are stored to the max length the field will allow, without rounding, and that rounding occurs on display.

So if VAR1 was 1.69 and VAR2 was 5.86, I want the calculation to be on 1.6 and 5.8 . So I used the D6.1 because I thought that's what would happen. The result of the calculation should also be the same format. Before I even displayed RESULT, I did an FTOA and some other conversion so what was displayed was a non-rounded value.

I know that nothing worked right though because I did this:

PRINT
COMPUTE VAR1/D6.1 = (A / B) * 100;
COMPUTE VAR1TEST/D6.2 = (A / B) * 100;

COMPUTE VAR2/D6.1 = (A / C) * 100;
COMPUTE VAR2/D6.2 = (A / C) * 100;

COMPUTE RESULT/D6.1 = VAR1 / VAR2;
COMPUTE RESULT/D6.2 = VAR1TEST / VAR2TEST;

.....
END

I did the display conversion on both RESULTs before displaying and they were the same, and diving 5.86 by 1.69 is different than 5.8 by 1.6 Frowner

Does this make sense? Does anyone have any ideas on how to be able to use one decimal place in my calculation without having to worry about rounding? I wish I could control rounding..


-******************-
WF Production Version: WF 7.1.3, 7.1.6, 7.6
WF Test Version: WF 7.1.3, 7.1.6, 7.6
Platform: UNIX, Windows, SUN
 
Posts: 7 | Registered: June 20, 2008Report This Post
Virtuoso
posted Hide Post
If you will do a SEARCH on the Forum...there are many discussions on rounding. Search on the ROUND OR ROUNDING.


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Virtuoso
posted Hide Post
Basically, use the P format instead of D format. Reasons and techniques are described in the many postsyou can find with the search utility as Prarie says.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Platinum Member
posted Hide Post
Prairie request the way to go to get the information you seek. Darin's solution is the solution to use. I might also suggst subtracting a .05 from each number before the calculation.


ira
aix 533 wf 533(d) 537 (p)


aix-533,websphere 5.1.1,apache-2.0,
wf 538(d), 537 (p),
==============
7.6.11 (t) aix 5312
websphere 6.1.19
apache 2.0
 
Posts: 195 | Registered: October 27, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Preventing Rounding in Calculations and Display

Copyright © 1996-2020 Information Builders