📄 arcmak.cpp
字号:
/* From NR book: The routine arcmak constructs the cumulative frequency distribution table used
to partition the interval at each stage. In the principal routine arcode, when an
interval of size jdif is to be partitioned in the proportions of some n to some ntot,
say, then we must compute (n*jdif)/ntot. With integer arithmetic, the numerator
is likely to overflow; and, unfortunately, an expression like jdif/(ntot/n) is not
equivalent. In the implementation below, we resort to double precision floating
arithmetic for this calculation. Not only is this inefficient, but different roundoff
errors can (albeit very rarely) make different machines encode differently, though any
one type of machine will decode exactly what it encoded, since identical roundoff
errors occur in the two processes. For serious use, one needs to replace this floating
calculation with an integer computation in a double register (not available to the
C programmer). The internally set variable minint, which is the minimum allowed number
of discrete steps between the upper and lower bounds, determines when new lowsignificance
digits are added. minint must be large enough to provide resolution of
all the input characters. That is, we must have pi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -