Floating point variables
Michael Monschau
michael at brainydata.co.uk
Sun Apr 25 21:30:51 UTC 2021
Hi Bastiaan,
A bit of a late response. I have not been monitoring the list for a while as I have been very busy. Was just going through two weeks worth of messages and came across this.
Internally, at c++ level, all floating point arithmetic uses the Omnis qreal type which is defined either as a a double or long double, depending on the compilation.
When I compile a component on the Mac, sizeof(qreal) returns 8, so it is compiled with qreal as a 8 byte double.
I suspect this is true on Windows also.
Consequently, any Omnis variable type that is floating point will operate at that level of accuracy, as far as I am aware. Specifying different dp only alters the final display of the value when converting from floating point to string.
Kind regards,
Michael
Brainy Data Limited
The Home for Omnis components
Web: www.brainydata.com
GitHub: https://github.com/BrainyData
> On 14 Apr 2021, at 05:18, Bastiaan Olij <bastiaan at muxworks.com.au> wrote:
>
> Hey All,
>
> Does anyone know if there is some info about how Omnis handles floating point variables behind the scenes? Mainly the 5d, 10dp, etc variants?
>
> It looks like a normal floating point variable is just a standard 32bit float? It seems to be the fixed variants have a higher precision level.
>
> --
> Kindest Regards,
>
> Bastiaan Olij
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en
mailing list