[comp.databases] INFORMIX reportwriter help!

daveh@marob.MASA.COM (Dave Hammond) (07/07/88)

Using INFORMIX and its ACE ReportWriter package I am trying to print reports
which contain floating point values with from 1 to 4 decimal places (e.g. 1.2,
1.23, 1.234 or 1.2345). It seems no matter what print picture I use, numbers
which do not resolve to 4 decimal places are rounded down instead of filled
with zeros (e.g. 1.5 prints as 1.4999 instead of 1.5000).

Any suggestions on a means of accurately printing a less-than-4 decimal
place value in a 4-decimal-place picture would be much appreciated.

Please answer by e-mail or followup.

Dave Hammond
UUCP:   {uunet|sun|...}!hombre!marob!daveh
-----------------------------------------------------

rbp@investor.UUCP (Bob Peirce) (07/11/88)

> 
> Using INFORMIX and its ACE ReportWriter package I am trying to print reports
> which contain floating point values with from 1 to 4 decimal places (e.g. 1.2,
> 1.23, 1.234 or 1.2345). It seems no matter what print picture I use, numbers
> which do not resolve to 4 decimal places are rounded down instead of filled
> with zeros (e.g. 1.5 prints as 1.4999 instead of 1.5000).
> 
> Any suggestions on a means of accurately printing a less-than-4 decimal
> place value in a 4-decimal-place picture would be much appreciated.
> 
You don't say which release you are using, but the one we have on our
Altos 68000, called as acego, round up, while the one we have on our altos
3068, called by sacego, truncates.  On the latter, we just add 0.00005
for positive numbers and subtract 0.00005 for negative numbers.  This
adds a lot more code but allows you to handle it the way you want.
-- 
Bob Peirce, Pittsburgh, PA				 412-471-5320
uucp: ...!{allegra, bellcore, cadre, idis, psuvax1}!pitt!investor!rbp
	    NOTE:  Mail must be < 30K  bytes/message

allbery@ncoast.UUCP (Brandon S. Allbery) (07/15/88)

As quoted from <329@marob.MASA.COM> by daveh@marob.MASA.COM (Dave Hammond):
+---------------
| Using INFORMIX and its ACE ReportWriter package I am trying to print reports
| which contain floating point values with from 1 to 4 decimal places (e.g. 1.2,
| 1.23, 1.234 or 1.2345). It seems no matter what print picture I use, numbers
| which do not resolve to 4 decimal places are rounded down instead of filled
| with zeros (e.g. 1.5 prints as 1.4999 instead of 1.5000).
+---------------

Which Informix, on which computer?  Informix-SQL and Informix-4GL on an
Altos 1086 does this as well; after hacking at it for a couple of hours I
concluded that there was a bug in the number-formatting routines.  On the
other hand, Informix 3.3 on the same machine gets it right.  (And people
wonder why I prefer "old Informix"?)

DISCLAIMER: (Unless you're employed by Informix Software, you can skip this.)

Yes, O gurus of Informixdom, I have reported this to Altos (from whom the
packages were purchased).  Whether they report it to you or not is another
matter. . . .  Disclaimer provided because of what the then Data Language
Corp. did to me after a comparison of Progress to Accell.  I don't have any
great desire to be b*tched at by Informix's tech gurus.
-- 
Brandon S. Allbery, uunet!marque!ncoast!allbery			DELPHI: ALLBERY
	    For comp.sources.misc send mail to ncoast!sources-misc

daveh@marob.MASA.COM (Dave Hammond) (07/23/88)

In article <8245@ncoast.UUCP> allbery@ncoast.UUCP (Brandon S. Allbery) writes:
>As quoted from <329@marob.MASA.COM> by daveh@marob.MASA.COM (Dave Hammond):
>+---------------
>| Using INFORMIX and its ACE ReportWriter package I am trying to print reports
>| which contain floating point values with from 1 to 4 decimal places (e.g. 1.2,
>| 1.23, 1.234 or 1.2345). It seems no matter what print picture I use, numbers
>| which do not resolve to 4 decimal places are rounded down instead of filled
>| with zeros (e.g. 1.5 prints as 1.4999 instead of 1.5000).
>+---------------
>
>Which Informix, on which computer?  Informix-SQL and Informix-4GL on an
>Altos 1086 does this as well; after hacking at it for a couple of hours I
>concluded that there was a bug in the number-formatting routines.  On the
>other hand, Informix 3.3 on the same machine gets it right.  (And people
>wonder why I prefer "old Informix"?)

I experienced the problem in Informix-SQL 2.x and Informix-4GL on
'286 and '386 machines running SCO Xenix.

I also received an excellent tip from several sources (including an
Informix tech support person) - Simply add a fraction to the printing value
so that it forces the result one decimal place beyond the print picture.
In the case of printing using a 4 decimal place picture, add .00005 and
the value prints correctly. Example:

value = 1.5
`print value using "&.&&##"' results in 1.4999 being printed.

value = 1.5 + .00005
`print value using "&.&&##"' results in 1.5000 being printed.

The Informix tech support fellow said there was an ever-growing list
of disgruntled users concerning this subject. I suggested a print
option on the order of:

print rounded(value) using "&.&&##"
or
print value rounded using "&.&&##"

I don't know what side effects this might present, but it seems a
reasonable solution to me.

Dave Hammond
UUCP:   !{uunet|rutgers|spl1|...}!hombre!{marob|dsix2}!daveh
---------------------------------------------------------------

lukas@ihlpf.ATT.COM (00704a-Lukas) (07/28/88)

In article <337@marob.MASA.COM> daveh@marob.UUCP (Dave Hammond) writes:
>I also received an excellent tip from several sources (including an
>Informix tech support person) - Simply add a fraction to the printing value
>so that it forces the result one decimal place beyond the print picture.
>In the case of printing using a 4 decimal place picture, add .00005 and
>the value prints correctly. Example:

We have found another technique, to avoid the "+.00005". We turn
the computer to the west, then only run the programs on sunny
days in the afternoon. Appearantly, the extry energy from the
sunshine increases the numbers just enough to provide the desired
result.

I know that some of you out there are going to laugh, but I
think that our soulution is every bit as reasonable as the other.
-- 

	John Lukas
	ihnp4!ihlpf!lukas
	312-510-6290