
29 Nov
2006
29 Nov
'06
8:18 a.m.
Hi Slavomir,
On 11/28/06, Slavomir Kaslev
instance Num Float3 where ..... signum a | a == Float3 0 0 0 = 0 | otherwise = 1
signum has a natural generalization for vectors. signum v = vector with the same direction as v but with |v| = 1 where |v| is the absolute length of v. The problematic function in Num is abs. Ideally abs should be defined as: abs v = |v| but its type is Float3 -> Float while the Num class requires Float3 -> Float3. Cheers, Krasimir