I’m porting a Java physics engine to Xojo.
In the engine, epsilon is used in a lot of calculations. It’s determined within a computed property:
Public Shared Property E as Double Get Static e_ As Double = Compute Return e_ End Get End Property
Public Shared Function Compute() as Double Var e As Double = 0.5 While (1.0 + e > 1.0) e = e * 0.5 Wend Return e End Function
This works fine. On my iMac Pro it consistently returns the value
0.0000000000000001 which I believe is 2-53. Am I right in thinking that this will always be the case on every platform that Xojo supports since (according to this article) that is the machine epsilon for double precision floats? If so, it means I can put that value in a constant and save a computed property access. This adds up as the computed property is accessed millions of times.