This math scares me

Steve Williams stevewilliams at wwc.com
Tue Mar 13 11:11:13 EST 2001


Grant Edwards wrote:

> In article <DZbr6.17917$Qb7.3117518 at newsb.telia.net>, Fredrik Lundh wrote:
> >costas at springmail.com wrote:
> >> I will also tell my customers that this is the new math.
> >
> >if you don't understand how floating point numbers work, you
> >probably shouldn't use them in customer projects.
>
> Fredrik is right.  Using floating point numbers requires that
> you know what you're doing.  They are _not_ exact.  If your
> customers are expecting exact results and you're using floating
> point numbers, then you did a bad thing.
>
> People should have to pass a test before they're allowed to use
> floating point numbers.    1/2 ;)
>

[snip]

Languages supporting serious commercial numeric processing have the dreaded
static typing.  Viz:

    Picture 99v99 in COBOL

or

    Decimal(4,2) in DDL

That way you 'do the right thing' in your *intermediate* calculations without
having to sit the exam for floating point or remembering to 'adjust the scale
and precision' for fixed point.

And using print formatting to solve the problem is [wait for it] missing the
point.





More information about the Python-list mailing list