View Issue Details

IDProjectCategoryView StatusLast Update
0007389Multi Theft Auto : San AndreasServerpublic2014-01-11 11:42
ReporterAxel Assigned Toccw  
Status resolvedResolutionfixed 
Target Version1.3.5Fixed in Version1.3.5 
Summary0007389: Problem with network floaters

Floating numbers by transfer from the server on the client and back change oddly.

Steps To Reproduce

For example:

Set number 10.67 in setElementData(getRootElement(), "number", 10.67) on the server.
Then receive number on the client of outputChatBox(getElementData(getRootElement(), "number")) we will receive 10.670000076294.

TagsNo tags attached.


has duplicate 0006802 closed New issues Sync Problem with setElementData 



2012-10-14 11:05

administrator   ~~0017750

Last edited: 2012-10-14 11:05

That's caused by how floating point numbers are stored internally. As all numbers have to be represented in a binary form, (most) floating point numbers stored are approximated values. (Some further details: )

If you'd do getElementData(root, "number") on the serverside you wouldn't get 10.67 as result either. If you need an exact floating point number on the clientside (for example in a GUI) you can use math.ceil or math.floor to round them.


2012-10-17 07:24

viewer   ~~0017787

sbx320, is not the solution.


2012-10-17 11:24

manager   ~~0017788

Storing the float as a string is a solution.


2012-10-17 16:15

viewer   ~~0017791

That's what had to solve the problem, but it is not a perfect solution, besides not only setElementData problem, but in general with all the numbers, such getElementHealth likewise transferred.


2012-10-17 20:05

administrator   ~~0017793

I think this is a duplicate to #5854:


2013-12-20 14:18

manager   ~~0019814

It's not actually duplicate of that since I just tested it and this is still reproducible after the client precision fix.


2013-12-20 16:14

updater   ~~0019817

Last edited: 2013-12-20 18:56

@arranTuna, the precision fix wasnt merged yet, so thats to be expected.


2013-12-21 10:00

administrator   ~~0019818

This issue to different to client precision - It is to do with the loss of precision when data is sent over the network.


2013-12-21 11:48

manager   ~~0019819

@ Dutchman101, I know I was using 1.4

@ ccw, Would it be more feasible if we just document the loss of precision? In all my years of scripting I've never had a problem with this so I can't see it been worth the extra bandwidth and if we document it we can tell people to just tostring() the number if they're desperate for full precision.


2013-12-21 16:26

administrator   ~~0019821

Fixed in

Precision loss is still there, but numbers (for element data and event arguments) are automatically rounded so no one will ever know.

Issue History

Date Modified Username Field Change