Elektrine lite

← Feed

@oblomov@sociale.network

Post #2797266

2026-04-14 18:05 UTC

@lisyarus@mastodon.gamedev.place OK, let's get started 8-D 1. when an epsilon check *is* made, the epsilon should never be arbitrary, but at the very least be based on machine epsilon and the the magnitude of the numbers involved (e.g. something like fabs(x - y) < (x+y)*FLT_EPSILON/2 rather than fabs(x-y) < 1.e-4, unless additional information is known about the process by which the numbers are obtained.

Replies (1)

  • @oblomov@sociale.network 2026-04-14 18:19

    @lisyarus@mastodon.gamedev.place 2. I like the recommendation to use hypot for the vector length, but it might be worth mentioning that for maximum accuracy it's preferrable to sort the components, or at the very least identify which one is largest. Computationally, this spares one (expensive) division and one multiplication at the expense of two swaps, but adding the lower terms squared to 1 is more consistently accurate than the three squared terms added in arbitrary order.

    Open ##2797267