开发者

Reduce the effect of float number (rounding) error

开发者 https://www.devze.com 2023-03-13 23:14 出处:网络
We are implementing some geometric algorithms but found the effect of float numb开发者_开发知识库er calculation error is big. Is there any guide lines to reduce this kind of effects?

We are implementing some geometric algorithms but found the effect of float numb开发者_开发知识库er calculation error is big. Is there any guide lines to reduce this kind of effects?

The algorithms contains many parts and is very complex. One of the example is to calculate the intersects between a line and a spline (serials of bezier curve). When the line position close to the end point of bezier the result is unstable.

Thanks


  • Use algorithms which are less sensitive to floating point error (see numerical stability)
  • Use wider types (ex. double instead of float)
0

精彩评论

暂无评论...
验证码 换一张
取 消