The value returned by the factorial program was hard to read. We now present a utility to take a long integer n and return a string representing the long integer with commas inserted into the correct positions. The maximum value we can handle in a 64-bit register is 9 quintillion. Table 9-1 shows the algorithm. We use the temporary register r10 to keep track of whether a nonzero quotient has been found. Nowhere else in the program is r10 used, so there is no difficulty in using it as a temporary variable.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

The commaSeparate Utility

  • John Schwartzman

摘要

The value returned by the factorial program was hard to read. We now present a utility to take a long integer n and return a string representing the long integer with commas inserted into the correct positions. The maximum value we can handle in a 64-bit register is 9 quintillion. Table 9-1 shows the algorithm. We use the temporary register r10 to keep track of whether a nonzero quotient has been found. Nowhere else in the program is r10 used, so there is no difficulty in using it as a temporary variable.