david850067064 / nape

Automatically exported from code.google.com/p/nape
0 stars 0 forks source link

Possible division by zero in FastMath invsqrt #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. compiler flag "cpp" should be true
2. function invsqrt(x) should be called with 0

What is the expected output? What do you see instead?
Applet freezes

What version of the product are you using? On what operating system?
Win32, haXe (with flash9, using cpp version of fastmath)

Please provide any additional information below.

Original issue reported on code.google.com by bramdenh...@gmail.com on 1 Jun 2010 at 11:17

GoogleCodeExporter commented 9 years ago
compiling nape for use with cpp is something i've not tried yet, a quick test 
shows
it has general issues with the cpp target it seems. I'll have a try today and 
get it
working properly in cpp and include this in it.

Original comment by lucadelt...@googlemail.com on 2 Jun 2010 at 8:43

GoogleCodeExporter commented 9 years ago
Ah, well, I wasn't using the cpp version, but I am compiling with haXe using 
fp9.
That means that the fastmath lib is not compatible, so I override it with it's 
cpp
version. That is how I noticed this possible div0 error.
Anyway, thank you for publishing nape, I'm very happy with it. It is very fast,
complete, seems stable and it is very user-friendly.

Original comment by bramdenh...@gmail.com on 2 Jun 2010 at 11:18

GoogleCodeExporter commented 9 years ago
Ahhh i see now, it slipped my mind that you said fp9! I saw that you said you 
were
compiling with cpp mode and assumed you were going to c++ :P

And yes, the FastMath lib is not compatible with fp9 as it uses fp10 features, 
i've
modified it slightly to do the same as cpp with a small check to stop divide by 
zero
errors should they ever occur in practice (In nape itself, the only time you'll 
ever
get divide by zeroes is when you have two circles occupying the exact same 
spot, or a
circle occupying the exact same spot as a polygon's vertex it is colliding 
against,
and a couple other cases which would rarely happen, but for which it won't 
happen now
either anyways)

Original comment by lucadelt...@googlemail.com on 2 Jun 2010 at 11:24

GoogleCodeExporter commented 9 years ago
Ah great, thanks. That should also explain why I encountered it: I randomly 
placed
about 200 circle objects onto the screen. So every once in a while, two circles 
must
have been overlapping exactly.

Original comment by bramdenh...@gmail.com on 3 Jun 2010 at 10:21