I don't know if this will help or not... if not, just chunk it.
Anyway... this is a DEFINE FUNCTION I came up with about 4 years ago to do arbitrary precision before WF had the decimal alignment feature.
The output is an A30 field, but it give you the ability to specify ARBITRARY PRECISION with MINIMUM PRECISION define on your output format.
For example:
Assume you needed to always have a minimum of 3 decimal places displayed, but you also need to retain FULL precision for values that have more than 3 decimal places.
COMPUTE NEWFIELD/A30=PRECISN(NUMBER,'(D18.6B)',x);
INPUT Value of 'x' OUTPUT
20.0097 3 20.0097
20.0 2 20.00
20.0097000 4 20.0097
DEFINE FUNCTION PRECISN (VAL/D20,FMT/A9,SIGNIF/D2)
-* Convert value to Alpha and left justify
VAL1/A30=TRIM('L',FTOA(VAL,FMT,'A30'),30,' ',1,'A30');
-* Find the first ')' or space (due to memory not being cleared
-* between function calls).
POS0/I2 =IF (VAL1 CONTAINS '(')
THEN
POSIT(VAL1,30,')',1,'I2')
ELSE
POSIT(VAL1,30,' ',1,'I2') - 1;
-* Substring up to POS0 to get our value to work with.
VAL2/A30=IF (VAL1 CONTAINS '(')
THEN
SUBSTR(30,VAL1,1,POS0,30,'A30')
ELSE
SUBSTR(30,VAL1,1,POS0,30,'A30');
-* Find the first '.'
POS1/I2 =POSIT(VAL1,30,'.',1,'I2') + 1 + SIGNIF;
-* Get the length of the string
LEN1/I2 =ARGLEN(30,VAL2,'I2');
-* Pull off the last part of the number
-* after the '.' and after the specified significant number of digits.
LASTPART/A30=IF (VAL2 CONTAINS '(')
THEN
SUBSTR(30,VAL2,POS1,LEN1 - 1,30,'A30')
ELSE
SUBSTR(30,VAL2,POS1,LEN1,30,'A30');
-* Trim any zero's at the end of the non-significant digits
TRIM1/A30 =TRIM('T',LASTPART,30,'0',1,'A30');
-* Create value which will remove the '.' if SIGNIF is 0 and everything right
-* of the decimal is 0.
RMDEC/I1=IF (SIGNIF EQ 0) AND (TRIM1 EQ ' ') THEN -1 ELSE 0;
-* Put the number back together, include trailing ')' if negative.
TEMP1/A80 =IF (VAL2 CONTAINS '(')
THEN
SUBSTR(30,VAL2,1,POS1 - 1 + RMDEC,30,'A30') ||
(TRIM1 || ')')
ELSE
SUBSTR(30,VAL2,1,POS1 - 1 + RMDEC,30,'A30') ||
TRIM1;
-* Output the value.
PRECISN/A30=SUBSTR(80,TEMP1,1,30,30,'A30');
END