TheCherno / Sparky

Cross-Platform High Performance 2D/3D game engine for people like me who like to write code.
Apache License 2.0
1.09k stars 222 forks source link

Vec2 Addition (Possible floating point error) #103

Closed Jacob-Mango closed 8 years ago

Jacob-Mango commented 8 years ago

I have noticed that when adding vectors such as (10.51, -31) and (10.1, 2) it would output with a vector of (20.6100001, -29) in Sparky logger.

I noticed this after I started implementing Lua. I can confirm that it is still the same vec2 class though (no changes in history). When it outputs in Lua it does so as (20.610000610352, -29).

Could this be because of floating point errors? If so, I have never seen it be that much a difference.

Jacob-Mango commented 8 years ago

yea, must be floating point error. not really much can be done. going to close it. no point.