Sign Function


Sign Function

Class

System.Math

Syntax

     Dim result As Integer = Sign(value) 


value (required; any signed numeric type)

A numeric expression of one of the following data types: Decimal, Double, Integer, Long, SByte, Single, or Short

Description

The Sign function determines the sign of a number. It returns 1 for negative numbers, 1 for positive numbers, or 0 for zero.

Usage at a Glance

  • This is a shared member of the System.Math class, so it can be used without an instance.

  • Use the CBool function instead of the Sign function to evaluate a logic truth value.

Version Differences

The name of this function has changed since VB 6. In VB 6, its name was Sgn, and it was an intrinsic VB function. In .NET, it is named Sign, and it is a member of the System.Math class.

See Also

Abs Function




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net