🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5147

Re: Another delphi translation please!

#5147
From: Bruce Knowles
Date: Mon, 26 Sep 2005 13:29
36 lines
1891 bytes
Hi,

My apologies, I have made a fundamental error, I saw 1 case of i:= b div 8 
and copied it right through my code, instead of the other cases of b mod 8 
that existed in the original code.

I will post a correction of my code.

Regards

Bruce

"Andrue Cope [TeamB]" <no.spam@not.a.valid.address> wrote in message 
news:4337f2a2$1@newsgroups.borland.com...
> Bruce Knowles wrote:
>
>> x mod y      ->   x % y
>> x div  y       ->   (int) (x / y)
>
> I don't understand what you're saying there.
>
> if 'x' and 'y' are both 'ints' then the expression 'x/y' is implicitly
> an 'int' and the decimal part is lost (exactly what Delphi's 'div'
> does)  There's no need to cast it.
>
> Even if you're assigning it to a float..
>
>  int x=1, y=2;
>  float a=x/y;
>
> ..'a' will be zero not 0.5
>
> -- 
> Andrue Cope [TeamB]
> [Bicester, Uk]
> http://info.borland.com/newsgroups/guide.html 
Technical Details
Message-ID: <4337f756$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <43370a81@newsgroups.borland.com> <4337b0dd$1@newsgroups.borland.com> <4337e343@newsgroups.borland.com> <4337f2a2$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6ea8b2c4d2578842
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Bruce Knowles" <knowle_b@mtn.co.za>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <43370a81@newsgroups.borland.com> <4337b0dd$1@newsgroups.borland.com> <4337e343@newsgroups.borland.com> <4337f2a2$1@newsgroups.borland.com>
Subject: Re: Another delphi translation please!
Date: Mon, 26 Sep 2005 15:29:15 +0200
Lines: 38
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 196.11.239.43
Message-ID: <4337f756$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1127741270 196.11.239.43 (26 Sep 2005 06:27:50 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail