DNZ

From NDWiki
Jump to navigation Jump to search
DNZ
Description Denormalize (floating to integer)
Format DNZ <scaling>
Code 152 0008
Affected T, A, D
Type User
Architecture ND-100, ND-110

DNZ is an assembly instruction. It converts the number in the floating point accumulator to a single precision fixed point number in the A register, using the scaling of the DNZ instruction as a scaling factor.

The scaling is given to the conversion of -128 to 127 (approximately 10-39 to 1039). -1 When converting to integers, a scaling factor of -1610 will give a fixed point number with the same value as the integer part of the floating point number. A larger scaling factor will result in a higher fixed point number on CPUs with 48-bit floating point units. On 32-bit floating point units a scaling factor of -1610 should always be used. Other values will not cause a different result but will affect the overflow test.

The T and D registers (part of the 48-bit floating point accumulator) will be cleared after this instruction.

If the instruction causes underflow the A register will also be cleared.

If the resulting integer has an absolute value larger than 32767 overflow occurs and the error flag (Z) is set to one.

Internally the original floating point value will be truncated, and negative numbers will be converted to positive numbers before conversion, the result converted back to a negative number.

Example

  • DNZ-20 (code 152360) Convert from floating point, scaling factor -1610.

T-A-D value of 3.14 will result in A = 3


DNZ on 32-bit floating point CPUs

Main article: 32-bit floating point

The ND-100/110 can have a 48-bit floating point CPU (standard configuration) or a 32-bit floating point CPU (customer option). For 32-bit floating point operations DNZ works as described above, except that the T register is not used or affected. On 32-bit floating point hardware only scaling factors of -1610 should be used.

References