Wrong answer. Should be 10. Note that the rounding methodology considers
any remainder > 2 to be worth bringing up to 5.
woops - i took the comments in the python example ("A program to round
a number to nearest multiple of 5.") to be what was required.
cheers
justin
_
On Wed, Jun 14, 2006 at 12:50:54PM +1000, justin randell wrote:
> question: why use float and not int?
Because we were dealing with money. Discussions as to why floating point
numbers and money do not mix will be left to a later time -- I'm trying to
keep the set of concepts learnt in one hit man
On Wed, Jun 14, 2006 at 10:52:06 +1000, Matthew Palmer wrote:
> > On Wed, Jun 14, 2006 at 09:11:49 +1000, Matthew Palmer wrote:
> > > >
> > > > const int x = remainder > 2 ? 5 : 0;
> > >
> > > That's not the same thing.
> >
> > How so?
>
> You're setting a value for x regardless of whether
On Wed, Jun 14, 2006 at 09:30:23AM +1000, John Clarke wrote:
> On Wed, Jun 14, 2006 at 09:11:49 +1000, Matthew Palmer wrote:
> > >
> > > const int x = remainder > 2 ? 5 : 0;
> >
> > That's not the same thing.
>
> How so?
You're setting a value for x regardless of whether the conditional is
On Wed, Jun 14, 2006 at 09:11:49 +1000, Matthew Palmer wrote:
> >
> > const int x = remainder > 2 ? 5 : 0;
>
> That's not the same thing.
How so?
Cheers,
John
--
News Flash: Microsoft acquires Electrolux, makes extensive design
revisions. Finally releases a product that doesn't suck.
On Wed, Jun 14, 2006 at 08:51:12AM +1000, John Clarke wrote:
> On Wed, Jun 14, 2006 at 08:02:43 +1000, James Crisp wrote:
> > Erik de Castro Lopo wrote:
> > > 4/ Ocaml lets you set a value based on the result of an if statment.
> > >
> > Ruby also lets you do this, as the 'if' statement is an ex