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.
If you want to ensure your epsilon is valid for the current hardware/platform (now and in the future), why not compute it once at app startup and store it in a global variable?
The static in the computed property should behave that way already
Compute it once then just return it over & over
However, billions of accesses to the Get method may be slower than billions of access to a property on the app class or in a modules globals