Board index » off-topic » Real variables question

Real variables question


2006-10-25 09:08:39 AM
off-topic2
Hi, im new to pascal, i have used it for about 2 weeks in school. Im having
a problem dealing with "real' numeric variables. Everytime i run my program
and write the value of a "real" variable i get it in exponent format; is
there any way to get over this and write the numbers without the exponent?
Thanks
 
 

Re:Real variables question

Write (V1:minimun width:Decimal places);
So if you want to print a variable in a space 10 cahrs wide to two decimal
places, you would use:
Write(V1:10:2);
This also works with writeln.
"Hernan Lara" < XXXX@XXXXX.COM >wrote in message
Quote
Hi, im new to pascal, i have used it for about 2 weeks in school. Im
having a problem dealing with "real' numeric variables. Everytime i run
my program and write the value of a "real" variable i get it in exponent
format; is there any way to get over this and write the numbers without
the exponent?
Thanks

 

Re:Real variables question

Hello,
another thing to consider is to use the data types extended or single
instead, as they can use the FPU and are standard where real is a
Borland construct.
Using the other "real" types requires this as the first line in your
program:
{$N+,E+}
This enables FPU usage and emulation.
Greetings
Markus
 

{smallsort}

Re:Real variables question

In message < XXXX@XXXXX.COM >, Wed, 25 Oct 2006 21:25:53,
Markus Humm < XXXX@XXXXX.COM >writes
Quote
another thing to consider is to use the data types extended or single
instead, as they can use the FPU and are standard where real is a
Borland construct.

Using the other "real" types requires this as the first line in your
program:

{$N+,E+}

This enables FPU usage and emulation.
That first line is NOT *required*; one can also do it by settings in one
of the IDE menus or by options for the command-line compiler.
--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
<URL:www.merlyn.demon.co.uk/>TP/BP/Delphi/&c., FAQqy topics & links;
<URL:www.merlyn.demon.co.uk/clpb-faq.txt>RAH Prins : c.l.p.b mFAQ;
<URL:garbo.uwasa.fi/pc/link/tsfaqp.zip>Timo Salmi's Turbo Pascal FAQ.
 

Re:Real variables question

Dr J R Stockton schrieb:
Quote
In message < XXXX@XXXXX.COM >, Wed, 25 Oct 2006 21:25:53,
Markus Humm < XXXX@XXXXX.COM >writes

[snip]

That first line is NOT *required*; one can also do it by settings in one
of the IDE menus or by options for the command-line compiler.

Yes one can, but if you share the code with another person who doesn't
have these settings and doesn't even know about them you won't make
friends will you? ;-)
Greetings
Markus