RF+TST: refactor _write_data utility routine

Add tests to check behavior with different shapes.  Add tests for
modifying data in-place.
RF: refactor check for nan_fill value

Take estimated error into account when checking whether nan2zero nan_fill
value is compatible with correct scaling to shared range of integer and
float.
Merge pull request #240 from matthew-brett/refactor-test-write_data

MRG: add tests; error bounds for rescaling to 0

The buildbots on SPARC were giving errors for the nan2zero fill tests.

http://nipy.bic.berkeley.edu/builders/nibabel-py2.7-wheezy-sparc/builds/5/steps/shell_6/logs/stdio

This was because there was some floating point error in calculating the integer
value in the output corresponding to zero in the input.

The second commit here puts some bounds on the error and checks that the
nan2zero value in the output is within these bounds.

I also refactored the _write_data private routine to deal with some silliness
in reshaping, and to prevent a possible route to overwriting the input data.

I believe the code using _write_data never takes that route because the route
required post_clips to be None when nan_fill is not None, and this can't
happen with current logic in the array_to_file, but, just in case.