Dear Mr. Heckenbach,
I apologize for belaboring my issue, but hopefully, your answers are of benefit to others as well as myself. I took your suggestion and used the --automake flag when compiling my test program and your solution worked great! There is one additional twist, though. Real numbers are only output correctly if there is no precision needed beyond the decimal point. For example, this test code,
program testprog(input,output);
uses GPC;
var x : real; fieldwidth : integer; fieldprec : integer;
begin x := 1000.909;
fieldwidth := 0; fieldprec := 0;
writeln('The value of x is ', longReal2Str (x,fieldwidth,fieldprec));
fieldwidth := 0; fieldprec := 3;
writeln('The value of x is ', longReal2Str (x,fieldwidth,fieldprec)); end.
produces the following output:
The value of x is 1001 The value of x is 10091009
Is there a solution for the case where decimal precision is needed? Thanks again for your help.
--- Frank Heckenbach frank@g-n-u.de wrote:
Ernst-Ludwig Bohnen wrote:
On Wed, 13 Sep 2000, Frank Heckenbach wrote:
in the current GPC version, I've included a StringUtils unit for general string handling routines (on a higher level than the built-in and RTS routines).
Up to now, it only contains routines for a string hash table, but I'm planning to add some more routines. Perhaps some of you also have some routines to contribute (or features to request).
May be a unit in my tool box is a candidate. Everybody can read it at: http://www.desy.de/~bohnen/gpc/dictionary.pas
I think this unit is good as a standalone unit. Be welcome to contribute it to GPC (if you agree to release it under some free license). If you like to upload it to some "official" place, Peter Gerwinski can arrange for that.
Frank
-- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/ GPC To-Do list, latest features, fixed bugs: http://agnes.dida.physik.uni-essen.de/~gnu-pascal/todo.html
===== --------------------------------------------------------- ! Stuart Pope ! ! GEOLAB/Computer Sciences Corporation ! ! Hampton, VA (757) 864-5775 ! ! ! ! This email was generated without any harm ! ! whatsoever to laboratory animals. !
__________________________________________________ Do You Yahoo!? Get Yahoo! Mail - Free email you can access from anywhere! http://mail.yahoo.com/
Hi
On Mon, 16 Oct 2000, Stuart Pope wrote:
program testprog(input,output);
uses GPC;
var x : real; fieldwidth : integer; fieldprec : integer;
begin x := 1000.909;
fieldwidth := 0; fieldprec := 0;
writeln('The value of x is ', longReal2Str (x,fieldwidth,fieldprec));
fieldwidth := 0; fieldprec := 3;
writeln('The value of x is ', longReal2Str (x,fieldwidth,fieldprec)); end.
produces the following output:
The value of x is 1001 The value of x is 10091009
tried it here: got ...is 1001 ...is 1000.909
it also works using writeln('the value of x is ', x:fieldwidth:fieldprec );
gpc version 20000917, based on 2.95.2 19991024 (release)
hope this helps Russ
Stuart Pope wrote:
Dear Mr. Heckenbach,
I apologize for belaboring my issue, but hopefully, your answers are of benefit to others as well as myself. I took your suggestion and used the --automake flag when compiling my test program and your solution worked great! There is one additional twist, though. Real numbers are only output correctly if there is no precision needed beyond the decimal point. For example, this test code,
program testprog(input,output);
uses GPC;
var x : real; fieldwidth : integer; fieldprec : integer;
begin x := 1000.909;
fieldwidth := 0; fieldprec := 0;
writeln('The value of x is ', longReal2Str (x,fieldwidth,fieldprec));
fieldwidth := 0; fieldprec := 3;
writeln('The value of x is ', longReal2Str (x,fieldwidth,fieldprec)); end.
produces the following output:
The value of x is 1001 The value of x is 10091009
Is there a solution for the case where decimal precision is needed? Thanks again for your help.
That seems to be another bug. Could you please try it with some other values, like:
x := 123456789.987654321; x := -123456789.987654321E40;
Did you try the C test programs about varargs?
Frank