The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-02-2009
qa.bingo qa.bingo is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 1
problem in awk int() function

awk -vwgt=$vWeight -vfac=$vFactor '
BEGIN {
printf("wgt:" wgt "\n");
printf("factor:" fac "\n");
total = sprintf("%.0f", wgt * fac);
total2 = sprintf("%.0f", int(wgt * fac));
printf("total:" total "\n");
printf("total2:" total2 "\n");
}
'
if
vWeight=326.4
vFactor=100

the result would be:
total:32640
total2:32639

Could anyone know how is 32639 calucated?

thanks!