int to float problem

Matthew Donadio m.p.donadio@ieee.org
Thu, 06 Mar 2003 19:22:45 -0500


b.i.mills@massey.ac.nz wrote:
> > I agree with what you said,
> > but I think you may have missed my point.
> 
> Sounds likely on both counts.

Probably.  I get confused a lot. :)
 
> So now I have to say ...
> 
>    denominator $ fromInteger (floor (23 % 45))
> 
> Is this the same malarkey that you are complaining about?

Yup.  I just looked at some of the code I am workong on.  In 2000 lines
of DSP code, 85 contain fromIntegral.  That is roughly 1 out of every
25, and it doesn't count instances where fromIntegral appears more than
once in a line of code.  All are needed solely to placate the type
system.
 
> So, you want some way to define a default manner in which
> other types can be mapped to the type that is used in the
> definition of the function? (Do I understand correctly)?

Yup, and by doing so I would accept the numeric shenanigans that may
result.

[ I'm not sure what I want to say in response to the points you made in
the rest of the message, so there will probably be a part two tomorrow.
]
 
-- 
Matthew Donadio (m.p.donadio@ieee.org)