Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Another stupid problem

0 views
Skip to first unread message

Ben Peachey

unread,
Apr 7, 2002, 7:58:51 AM4/7/02
to
new problem

I have a real number and i want to turn it into a interger is there a
command of procedure i cant find anything that helps.

Ben

ps
what i'm doing wrong

For Count:=1 to 200 do

Disp.Canvas.Lineto ( (Count * 2) + 10 , ((Sin (E1 * Pi * Count / 200)* 300)
+ 20) );


The second coordinate is real needs to be an integer!


Eric Schreiber

unread,
Apr 7, 2002, 8:59:33 AM4/7/02
to
"Ben Peachey" <Talb...@btopenworld.com> wrote:

>I have a real number and i want to turn it into a interger is there a
>command of procedure i cant find anything that helps.

The function you're looking for is "trunc". From the (D6) help file...

function Trunc(X: Extended): Int64;

Description

The Trunc function truncates a real-type value to an integer-type
value. X is a real-type expression. Trunc returns an Int64 value that
is the value of X rounded toward zero.


--

Kobayashi Software
www.kobayashi.com

Ben Peachey

unread,
Apr 7, 2002, 9:33:16 AM4/7/02
to
Thanks guys you all stars!!!

I would buy you a drink!


"Ben Peachey" <Talb...@btopenworld.com> wrote in message
news:a8pc9q$s4a$1...@helle.btinternet.com...

Jan Philips

unread,
Apr 7, 2002, 10:28:13 AM4/7/02
to
On Sun, 7 Apr 2002 11:58:51 +0000 (UTC), "Ben Peachey"
<Talb...@btopenworld.com> wrote:

>The second coordinate is real needs to be an integer!

Trunc() truncates to an integer, Round() rounds to the nearest
integer. Here round would be more accurate.

0 new messages