× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I am changing some old code and there seems to be a difference in how the
divide statement works.

if I compile this and debug it, on my box, each time the field ratio is
calculated it is 1.40 until the last statement where the ratio becomes
1.00

this seems to be the offending statement
RATIO = (LSTQTR - (YEAR /4)) / (YEAR /4) ;

Does it do this on your box? If yes, is this the way it is suppossed to
be? Is there something with my brackets I don't understand?

Still on v5r4.


0136
C

0136 C SETON
LR
0136
C

0117 C CLEAR LSTQTR 7
0
0117 C CLEAR YEAR 7
0
0117 C CLEAR AVEQTR 7
0
0117 C CLEAR DIFQTR 7
0
0117 C CLEAR RATIO 5
2
0117
C

0117 C EVAL YEAR =
20
0117 C EVAL LSTQTR =
12
0117
C

0117 C YEAR DIV 4
AVEQTR
0117 C LSTQTR SUB AVEQTR
DIFQTR
0117 C DIFQTR DIV AVEQTR
RATIO
0117 C EVAL RATIO = DIFQTR /
AVEQTR
0136
/FREE

0136 AVEQTR = YEAR /
4;
0136 DIFQTR = LSTQTR - AVEQTR;
0136 RATIO = DIFQTR / AVEQTR;
0136 RATIO = (LSTQTR - (AVEQTR)) / (AVEQTR) ;
0136 RATIO = (LSTQTR - AVEQTR) / AVEQTR ;
0136 RATIO = (LSTQTR - (YEAR /4)) / (YEAR /4) ;
0136 /END-FREE

Just so you know, this is a snippet of an inventory seasonality ratio
calculation.
lstqty is last quarters sales
year is last years sales
aveqty is last years sales / 4
difqtr is the difference between last qtr and the average qty
ratio is the difference divided by the average




Jim Horn
CATCO 651-697-6314 JDHorn@xxxxxxxxxxxxxx
Cell 612-791-3924

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.