The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 04-02-2008
craigp84 craigp84 is offline
Registered User
 

Join Date: May 2007
Location: Glasgow, Scotland
Posts: 59
Ok so it was my rounding all along! :-)

Specifically it's this line which was iffy -

Code:
partition_size = (int)((global_bounds->upper - global_bounds->lower)/total_thr)+1;
By choosing to do the arithmetic in float's, then truncate to an int at the very last minute is the way to go -

Code:
partition_size = ((float)(global_bounds->upper - global_bounds->lower)/(float)total_cpus)+0.5;
The subtle ones are always the best! :-)

-c
Reply With Quote