# Float operations in BP

sure I’m missing something but I can not understand why substraction operations between float numbers no so big show these results. Would appreciate any clarification,
Thanks

That are nature of floating point, the way they are stored in memory (and you can’t have fraction of bytes) make there precision dependable to how big number is as it need to fit in specific number of bits, the bigger the number the less precise it becomes (part before “.”), so if oyu use float you need to be more error tolerant and put that in to account in your code. They way float fix precision depends on how your CPU computes them. Here you have wiki about it:

Note that BP exlusivly use single-precision floating points, in C++ you have also use double-precision floating point (“double” type) which are more precise, but UE4 code overall use single so you can’t really use double in practice in UE4.

Use of integer is you want absolute precision.

I understand. I thought that BP would use double precision in floating arithmetic

To fix that you can write simple BP function that receives floating points, calculates this operation in double precision - and then returns results as float again. Problem disappears.

andrew-r-lukasik

can you pls elaborate or give an example n your post

"
To fix that you can write simple BP function that receives floating points, calculates this operation in double precision - and then returns results as float again. Problem disappears."

would be nice to get some examples pls

You can try to implement [Double] but even simpler way around this would be to use integers for arithmetic. Floating-point is good enough in most situations but when you need precision then float is just not built for that. Just be aware that Int has it’s own limit - it can represent precise integer numbers but ONLY in range -2147483647 to +2147483647. Going beyond these will result in [overflow].