I have an array namely “real”. it has a vector of double numbers. I am trying to create an INDArray based on my vector. my code is below :
double real_d = (double) ArrBD.get(0);
INDArray real = Nd4j.create(real_d);
It works but unfortunately, it converts big numbers to infinity and small numbers to zero.
Here you can see the double array:
[0.0, 5.911259568298103E-306, -1.8401529637727614E-221, 1.7562463582928743E-268, 2.7206514809021945E-133, 4.583815262762733E90, 2.5637698710586 ....
and here the data of INDArray:
[0.0,0.0,-0.0,0.0,0.0,Infinity,Infinity,-0.0,-0.0 ....
I appreciate your help in advance
If you want more precision, you have to set the data type. Just like numpy or any other math library that works with ndarrays, if you have floats you will get reduced precision. This is a normal property of any of these libraries just due to how floating point numbers work. When creating an ndarray, you can specify the data type first or create a data buffer manually.