We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexSuggestions & BugsSoftware,  Documentation,  Website Suggestions › docs suggestion: map function can return inf
Page Index Toggle Pages: 1
docs suggestion: map function can return inf (Read 1235 times)
docs suggestion: map function can return inf
Nov 30th, 2008, 8:50pm
 
Chasing for a weird bug in code, I found out that map returns inf if low1 and high1 have the same value. From looking at the source code (and many might guess it without looking at it), it's clear why, as it ends up dividing by zero.

I know the function is useless if these values are the same, and adding a conditional to that function is probably unnecessary overhead, but it could happen with arbitrary variables, so maybe there should be some warning about that in the reference, so if that could happen, folks would know they'd have to that function in a conditional.

note: I haven't made the jump to 1.0 yet, and I looked into beta code, so ignore this post if there were design changes on the map function.
Page Index Toggle Pages: 1