INTNEG() Converts an unsigned integer into a signed integer ------------------------------------------------------------------------------ Syntax INTNEG(<nUnsigned|cHexUnsigned>,[<l32Bit>) --> nSigned Arguments <nUnsigned|cHexUnsigned> Designates either a numeric value or hexadecimal digit string to convert into a 16-bit or 32-bit signed integer. <32Bit> If this optional parameter is designated as .T., the function processes the designated value as a 32-bit unsigned integer. The default value is a 16-bit unsigned integer (.F.). Returns INTNEG() returns a signed 16-bit or 32-bit integer. Description This function converts unsigned integers into signed integers. All 16-bit or 32-bit integers are accepted, depending on whether there is a second parameter and the logical value is assigned. For the 16-bit variant, all values for <nUnsigned|cHexUnsigned> that are less than or equal to +32767 (hex=7FFF), are positive. Values in the range of +32768 (hex=8000) to +65535 (hex=FFFF), have a negative result. When you work with 32-bit values, the positive range goes to 2147483647 (inclusive). All values beyond that are negative. Note . The function returns a value of 0 for invalid, too large, or negative parameters. Examples . Show valid parameters: ? INTNEG(0) // Result: 0 ? INTNEG(-1) // Result: 0 ? INTNEG(30000) // Result: 30000 ? INTNEG(32767) // Result: 32767 ? INTNEG(32768) // Result: -32768 ? INTNEG(32769) // Result: -32767 ? INTNEG(60000) // Result: -5536 ? INTNEG(65535) // Result: -1 ? INTNEG("FFFF") // Result: -1 ? INTNEG("D0000000", .T.) // Result: -805306368 ? INTNEG("FFFFFFFF", .T.) // Result: -1 . Show incorrect instructions or instructions that are too large: ? INTNEG("GGGG") // Result: 0 ? INTNEG(90000) // Result: 0 ? INTNEG("FFFFFFFFF") // Result: 0
See Also: INTPOS() NUMAND() NUMOR() NUMXOR()