www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Flaoting point operations : unexpected results

reply seany <seany uni-bonn.de> writes:
I have (as mentioned before) an AI project in D.
It is doing several million Floating Point operations.

However, i sometimes see, that the results are _radically_ 
different.

The same input, fed to the same system .

I do not have and random values. There are some *foreach* loops.

By radically different, i mean, that the computation whether some 
points are within some bound or not goes completely out of 
control. Sometimes they produce correct result, sometimes all 
results are zero.

Is there a "reproducability" problem?

Thank you.
Jun 10 2021
parent reply Dennis <dkorpel gmail.com> writes:
On Thursday, 10 June 2021 at 19:37:36 UTC, seany wrote:
 However, i sometimes see, that the results are _radically_ 
 different.
Are you using uninitialized memory or multi-threading?
Jun 10 2021
parent reply seany <seany uni-bonn.de> writes:
On Thursday, 10 June 2021 at 19:51:51 UTC, Dennis wrote:
 On Thursday, 10 June 2021 at 19:37:36 UTC, seany wrote:
 However, i sometimes see, that the results are _radically_ 
 different.
Are you using uninitialized memory or multi-threading?
I am using things like : `double [][] myArr = new double [][] (0,0);` and `double [][] tempArr;` and class myclass { int a ; this(){} ~this(){} } followed by : myclass mc = new myclass; I dont think these are "uninitialized"?
Jun 10 2021
next sibling parent Alain De Vos <devosalain ymail.com> writes:
Normally computers are deterministic and same input produces same 
output. There is however theory on neural network stability and 
it can be tuned.
Jun 10 2021
prev sibling parent frame <frame86 live.com> writes:
On Thursday, 10 June 2021 at 20:18:03 UTC, seany wrote:
 On Thursday, 10 June 2021 at 19:51:51 UTC, Dennis wrote:
 On Thursday, 10 June 2021 at 19:37:36 UTC, seany wrote:
 However, i sometimes see, that the results are _radically_ 
 different.
Are you using uninitialized memory or multi-threading?
I am using things like : `double [][] myArr = new double [][] (0,0);`
 I dont think these are "uninitialized"?
Just to clarify, this statement does not initialize double values to 0. It just creates the array with lengths of 0. If you disable range checking as in release mode, you wouldn't see any error here.
Jun 11 2021