Page MenuHomeFeedback Tracker

setHitPointDamage reacts weird.
New, WishlistPublic

Description

#1
_PreDamage = 0.8; vehicle player setHitPointDamage ["hitEngine",_PreDamage + 0.1]; -> Engine turns off (Result: 0.9)

#2
_PreDamage = 0.8; vehicle player setHitPointDamage ["hitEngine",0.9]; <-- Engine stays on

Both have the same result, but react different.

Details

Legacy ID
615158836
Severity
None
Resolution
Open
Reproducibility
Always
Category
Engine
Steps To Reproduce

Place an Offroad, get in, turn Engine on, Execute Script #1 -> Engine turns off
->
Vehicle player setDamage 0;
->
execute #2 -> Engine stays on.

Event Timeline

Dscha edited Steps To Reproduce. (Show Details)Sep 13 2015, 5:02 PM
Dscha set Category to Engine.
Dscha set Reproducibility to Always.
Dscha set Severity to None.
Dscha set Resolution to Open.
Dscha set Legacy ID to 615158836.May 8 2016, 12:42 PM

Nothing is strange about it. This is Arma's Single precision floating point for you.

https://en.wikipedia.org/wiki/Single-precision_floating-point_format

hint str ((0.8 + 0.1) > 0.9) true
hint str ((0.8 + 0.1) - 0.9)
5.96046e-008

It is just that at == 0.9 engine still ok, at > 0.9 it is not

Dscha added a subscriber: Dscha.May 8 2016, 12:42 PM
Dscha added a comment.Oct 8 2015, 8:32 PM

Ah, didn't noticed your Answer. Thx then, can be closed and ignored.