Ints as ints and floats - Question on style

Jorge Adriano jadrian@mat.uc.pt
Sat, 8 Feb 2003 23:25:04 +0000


Hello, 
Lately I've been coding functions where I have to use Int elements, both as 
Ints (e.g. as an array or list index) and Doubles/Floats (e.g. when 
performing arithmetic operations with Doubles/Floats).

How do you usually deal with this? Some options I can think of are,
1. using "fromIntegral" when needed (some formulas become unredable). 
2. duplicating all those ints to float elements. (not very readable either, 
you end up with two distinct elements that mean the same thing).
3. creating new operators perform arithmetic operations with Ints/Integers and 
Float/Doubles.

Cheers,
J.A.