<html><body><font color="#000000" face="Arial, sans-serif">Hi 
all,</font><br><div style="color: rgb(0, 0, 0); font-family: Arial, 
sans-serif;"><br></div><div style="color: rgb(0, 0, 0); font-family: Arial, 
sans-serif;">Probably I found bug in nodes cost in vector network analysis 
(tested in G7, probably it affects all branches). Problem is in <span 
style="line-height: 1.3;">lib/vector/Vlib/net.c</span><span 
style="line-height: 1.3;">:</span></div><div style="color: rgb(0, 0, 0); 
font-family: Arial, sans-serif;"><br></div><div style="color: rgb(0, 0, 0); 
font-family: Arial, sans-serif;">int cost;</div><div style="color: rgb(0, 0, 
0); font-family: Arial, sans-serif;">...</div><div style="color: rgb(0, 0, 0);
 font-family: Arial, sans-serif;">(* dglInt32_t)(dglInt32_t) & 
cost<br></div><div style="color: rgb(0, 0, 0); font-family: Arial, 
sans-serif;"><br></div><div><font color="#000000" face="Arial, sans-serif">int
 cost is cast into </font><span style="color: rgb(0, 0, 0); font-family: 
Arial, sans-serif; line-height: 1.3;">dglInt32_t pointer. 
DGLib </span><span style="color: rgb(0, 0, 0); font-family: Arial, 
sans-serif; line-height: 1.3;">dglInt32_t is long. </span><font 
color="#000000" face="Arial, sans-serif"><span style="line-height: 
1.3;"> I am relatively new to C so I do not understand the way it is 
casted and I can miss something. I am reading it as 
cast </span>address<span style="line-height: 1.3;"> of  cost 
int to  </span></font><span style="color: rgb(0, 0, 0); font-family: 
Arial, sans-serif; line-height: 1.3;">dglInt32_t and then to pointer 
to </span><span style="color: rgb(0, 0, 0); font-family: Arial, 
sans-serif; line-height: 1.3;">dglInt32_t. It does not make sense to me but it
 compiles :-) </span></div><div style="color: rgb(0, 0, 0); font-family: 
Arial, sans-serif;"><span style="line-height: 1.3;"><br></span></div><div 
style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;"><span 
style="line-height: 1.3;">The problem is when you have on your system 
different size of long and int, it is probably also the reason why it was not 
noticed so far (on 32 bit usually sizeof(int) == sizeof(long)). Because it 
seems that during this cast there are added bytes to be same size as long. 
However these bytes have random values and therefore results costs do not make
 sense. </span></div><div style="color: rgb(0, 0, 0); font-family: Arial,
 sans-serif;"><br></div><div style="color: rgb(0, 0, 0); font-family: Arial, 
sans-serif;">If this change is made everything seems ok:</div><div 
style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;"><br></div><div 
style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;">dglInt32_t 
dgl_cost;</div><div style="color: rgb(0, 0, 0); font-family: Arial, 
sans-serif;">...</div><div style="color: rgb(0, 0, 0); font-family: Arial, 
sans-serif;">dgl_cost = cost;<br></div><div style="color: rgb(0, 0, 0); 
font-family: Arial, sans-serif;"><span style="line-height: 
1.3;">dglNodeSet_Attr(gr, dglGetNode(gr, (dglInt32_t) 
cat),</span><br></div><div style="color: rgb(0, 0, 0); font-family: Arial, 
sans-serif;"><span style="white-space: pre;">   
</span>& dgl_cost);</div><div style="color: rgb(0, 0, 0); 
font-family: Arial, sans-serif;"><br></div><div style="color: rgb(0, 0, 0); 
font-family: Arial, sans-serif;"><br></div><div style="color: rgb(0, 0, 0); 
font-family: Arial, sans-serif;">Now there is:</div><div style="color: rgb(0, 
0, 0); font-family: Arial, sans-serif;"><br></div><div style="color: rgb(0, 0,
 0); font-family: Arial, sans-serif;"><div><span style="line-height: 
1.3;">dglNodeSet_Attr(gr, dglGetNode(gr, (dglInt32_t) 
cat),</span><br></div><div><span style="white-space: pre;">     </span><span 
style="line-height: 1.3;">(* dglInt32_t)(dglInt32_t) & cost</span><span 
style="line-height: 1.3;">);</span></div></div><div style="color: rgb(0, 0, 
0); font-family: Arial, sans-serif;"><br></div><div style="color: rgb(0, 0, 
0); font-family: Arial, sans-serif;">I have attached also patch.</div><div 
style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;"><br></div><div 
style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;">Best</div><div 
style="color: rgb(0, 0, 0); font-family: Arial, 
sans-serif;">Stepan</div></body></html>