'Write a number to a worksheet cell.
Args:
row:         The cell row (zero indexed).
col:         The cell column (zero indexed).
number:      Cell data. Int or float.
cell_format: An optional cell Format object.
Returns:
0:  Success.
-1: Row or column is out of worksheet bounds.'

@convert_cell_args
def write_number(self, row, col, number, cell_format=None):

    if (self._isnan(number) or self._isinf(number)):
        if self.nan_inf_to_errors:
            if self._isnan(number):
                return self.write_formula(row, col, '#NUM!', cell_format, '#NUM!')
            elif self._isinf(number):
                return self.write_formula(row, col, '1/0', cell_format, '#DIV/0!')
        else:
            raise TypeError("NAN/INF    not    supported    in    write_number()    without    'nan_inf_to_errors'    Workbook()    option")
    if self._check_dimensions(row, col):
        return (-1)
    if (self.constant_memory and (row > self.previous_row)):
        self._write_single_row(row)
    self.table[row][col] = cell_number_tuple(number, cell_format)
    return 0
