So I was wondering why I do not get the sum of the two floats below, when adding them. Depending on the length of the float and whether there is a non zero digit before the point, the result has either an added or substracted additional digit or they just do not get added. The code below for example:
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
with tf.Graph().as_default():
a = tf.Variable(1, name="Var_a")
dx = tf.Variable(1.33333, name='dx')
dt = tf.Variable(5e-10, name='dt')
dz = tf.Variable(1.0, name='dz')
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
a = dt+dx
a = a-dz
print dx.eval()
print dt.eval()
print (dt+dx).eval()
print (dx+dt).eval()
print a.eval()
writer = tf.summary.FileWriter("/tmp/tensorlog")
writer.add_graph(sess.graph)
gives the following result:
>>>1.33333
>>>5e-10
>>>1.33333
>>>1.33333
>>>0.33333004
So the addition did not happen and the subtraction does not give a right result either. Thanks in advance for any ideas on this.