On Thu, Apr 10, 2014 at 2:43 PM, Kevin Fishburne
<kevinfishbu...@eightvirtues.com> wrote:
> I have an array (Plan) of a structure (PlanStructure) which contains
> several other structures (PlanPortalStructure, etc.):

>     Plan[p].Portal[Index].Orientation = 180.2
>
>
> the value is assigned as 180.1999969.
>
> Any idea why this is happening?Seems strange that explicitly setting a
> type Single to a value would immediately cause precision to be lost;
> maybe it has to do with a structure being embedded in another structure?
i doubt structures are the issue. floating point values are stored in
binary internally so there is a translation between decimal for humans
and binary which imparts a slight rounding error
can you try Double: this won't fix the problem but will reduce it at a
cost of more RAM

if you need 100% decimal accuracy (it's usually only high-end
financial stuff where you do), then look at gb.gmp component. Again it
will cost you in RAM and speed.

Ian

------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to