Path: utzoo!utgpu!water!watmath!clyde!bellcore!rutgers!cmcl2!phri!marob!daveh From: daveh@marob.MASA.COM (Dave Hammond) Newsgroups: comp.databases Subject: Re: INFORMIX reportwriter help! Message-ID: <337@marob.MASA.COM> Date: 22 Jul 88 20:55:19 GMT References: <329@marob.MASA.COM> <8245@ncoast.UUCP> Reply-To: daveh@marob.UUCP (Dave Hammond) Organization: 18th Street Construction Company (ESCC). NY, NY Lines: 45 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 ---------------------------------------------------------------