Rounding problem

mprabu_p

New Member
Hi All,
I am running the below small query in progress editor.
I am having two memory variable , which having 2 different formats. If enter the same value in both the fields it displays the different results.

{mfdtitle.i}
define variable a as decimal format "->>,>>>,>>9.9<<<<<<".
define variable b as decimal format "->>>>,>>>,>>9.99<<<".
form
a
b
with frame a .

update
a
b
with frame a.

display
a
b
with frame b.


Input:
a b
69,876.75551 69,876.75551

Output:
a b
69,876.7555 69,876.75551

Expected Result:
I am expecting the value 69,876.75551 with out any rounnding for "a".

Can anyone please explain me why it behaving differently? Why value "a" is rounded and value "b" is not rounded ?

Thanks in advance.

Regards
M.Prabu
 

TomBascom

Curmudgeon
It is a display format. No actual rounding has taken place. All you are seeing is that Progress is obeying your display formatting instructions. Which are different.

You can expect to be confused any time the "<" format character is being used. It is affectionately known as the "fsck up my display" format. Add another ">" to both formats and everything will be ok.
 

LarryD

Active Member
EDIT: Tom beat me to it. ;)
----------------
It's a function of the formatting.

For every character within the ">" available to the left of the decimal point, it will display one less on the right.

In your first format for a, you have 7 '>' to the left, and 7 '<' to the right. With the value 69,876, it will use 4 of the '>'. That means it will only display 3 of the '<' on the right (7 - 4). Which means it will display only 4 to the left of the decimal ( the '.9' + 3 of the '<'). If you had made the number 6,987.7551, it would have display all the decimals. If you made the number 699,876.75551 the value displayed would be 699,876.756 .

In the second format, you only have 3 '<' to the right and 9 '>' to the left, and the format is such that it would not allow you to enter more than 3 decimals if you have a number using 9 digits to the left (8 '>' and the '9'). If you entered a number with all of the '>' filled to the left (9 '>' + the '9'), you could only enter 2 decimals.

You can easily try this by adding an additional '>' to the left in the first example, and you would get all 5 decimal places.
 
Top