msvc9 compatibility

note: the explicit cast from int to double is required for msvc10 too

see https://groups.google.com/forum/#!topic/pylearn-dev/UeT9IbRmIeY for details