Reply to Re: 3 / 2=1? Strange result in expression...HELP!

Your name:

Reply:


Posted by Andy on 10/29/06 18:07

Hi Rick,

you are using integers and in integer division 3/2 is 1.
Use floats or cast your numbers to floats in the calculation:

float result=((float)Count(RecordID))/((float)NoOfClients);

Regards,
Andy

Rico schrieb:
> Hi Folks!
>
> I have a strange thing happening; I have a field that Counts the number of
> records and another field that shows the number of clients
> (Count(RecordID)=3 and NoOfClients=2) When I do a simple expression
> "Count(RecordID)/NoOfClients" the expected result should be 1.5. Instead
> the result I get is 1. Any ideas?
>
> Thanks!
> Rick

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация