---
name: "VarNeg"
section: "3w"
platform: "linux"
package: "libwine-dev"
version: "1.4.1-4"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/VarNeg"
---

# VarNeg(3w)

## NAME

**VarNeg** (OLEAUT32.173)

## SYNOPSIS

HRESULT VarNeg\
  (\
   LPVARIANT *pVarIn*,\
   LPVARIANT *pVarOut*\
  )

## DESCRIPTION

Negate the value of a variant.

## PARAMS

*pVarIn* **\[In\]**  Source variant.

*pVarOut* **\[Out\]**  Destination for converted value.

## RETURNS

**Success:** **S\_OK**. *pVarOut* contains the converted value.

**Failure:** An **HRESULT** error code indicating the error.

## NOTES

**-** The type of the value stored in *pVarOut* depends on the type of *pVarIn*, according to the following table: \
\
  Input Type       Output Type\
\
  \----------       -----------\
\
   VT\_EMPTY         VT\_I2\
\
   VT\_UI1           VT\_I2\
\
   VT\_BOOL          VT\_I2\
\
   VT\_BSTR          VT\_R8\
\
   All Others       Unchanged (unless promoted)

**-** Where the negated value of a variant does not fit in its base type, the type is promoted according to the following table: \
\
  Input Type       Promoted To\
\
  \----------       -----------\
\
    VT\_I2            VT\_I4\
\
    VT\_I4            VT\_R8\
\
    VT\_I8            VT\_R8

**-** The native version of this function returns **DISP\_E\_BADVARTYPE** for valid variant types that cannot be negated, and returns **DISP\_E\_TYPEMISMATCH** for types which are not valid. Since this is in contravention of the meaning of those error codes and unlikely to be relied on by applications, this implementation returns errors consistent with the other high level variant math functions.

## IMPLEMENTATION

Declared in **"oleauto.h"**.

Implemented in **"dlls/oleaut32/variant.c"**.

Debug channel **"variant"**.
