I'm just wanting to make a simple map algebra operation in the osgeo4w shell using gdal_calc but I get wrong results when I divide one raster with the other. When I use the same rasters in QGIS and perform the same map algebra operation with raster calculator, I get no problem.
I think my best guess would be that you should clip one raster using the other, and save the results as a .vrt to save time.
use this vrt in your previous gdal_calc calculation. that should work.
side-note: The answer is actually in the Error message. I dug a bit deeper and looked at the code here ( http://svn.osgeo.org/gdal/trunk/gdal/swig/python/scripts/gdal_calc.py ). A comment at the tops specifies that rasters should be of the same extent.
LATER EDIT: If your problem appears to be that the values are too big for your data type this is because gdalcalc determines the data type based on the input rasters not the appropriate output data size (i believe from the link I provide you can search data type and you'll see the comment).
I am not sure of the options to change data type in the gdalcalc syntax but you could precede your calculation by translating your input raster with gdaltranslate into a larger data type;32bit-float should be fine. saving as a vrt will also save time
gdal_translate -ot Float32 -of VRT old.tif new.vrt
Still Later Edit: I actually checked gdal_calc.py on my comp and found it has a
--type parameter you can enter from the command line. I think this will work for your problem
Hope that helps :)