I have been having a strange maths day, using blueprints in Unreal 4.26
Start with a new blank blueprint project, create a new actor blueprint, drag an instance of that into the scene, open up the event graph, and drag off event BeginPlay
Add a ‘float + float’ node and then output the result of that sum using a PrintString node.
Enter 20000000 (that is 20 million) into the first pin of the add node.
Enter 1 (that is one) into the second pin of the add node.
Compile, save and then play the scene in the editor viewport.
The print string node outputs the erroneous sum as 20000000 that is 20 million instead of 20000001 as expected
If you change the second pin to have a value of 10 (that is ten) then the print string node correctly prints 20000010
Furthermore, if I enter the value 16777217 into the first pin of the add node, and press enter, then it overrides my entry and changes the value to 16777216
When the scene is played the print string node incorrectly prints 16777216 as the sum of 16777216 + 1
But if change the second pin of the add node to 10 instead of 1, then the print string node correctly prints 16777226 as the sum of 16777216 + 10
What is so special about 16777216 ?
2 to the power of 24 equals 16777216
It appears that my floats are behaving like 24 bit numbers when adding small values to big values.
Is this normal for unreal editor 4.26, or is there something wrong with my installation ?
My operating system Windows 10 updated itself just a few days ago; could this be the reason?