Partilhar via


Tipo de dados único (Visual Basic)

Holds signed IEEE 32-bit (4-byte) single-precision floating-point numbers ranging in value from -3.4028235E+38 through -1.401298E-45 for negative values and from 1.401298E-45 through 3.4028235E+38 for positive values. Single-precision numbers store an approximation of a real number.

Comentários

Use the Single data type to contain floating-point values that do not require the full data width of Double. In some cases the common language runtime might be able to pack your Single variables closely together and save memory consumption.

The default value of Single is 0.

Programming Tips

  • Precisão. When you work with floating-point numbers, keep in mind that they do not always have a precise representation in memory. This could lead to unexpected results from certain operations, such as value comparison and the Mod operator. For more information, see Solucionando problemas de tipos de dados (Visual Basic).

  • Alargamento. O Single tipo de dados amplia a Double. This means you can convert Single to Double without encountering a System.OverflowException error.

  • Trailing Zeros. Os tipos de dados de ponto flutuantes do-não tem qualquer representação interna à direita 0 caracteres. For example, they do not distinguish between 4.2000 and 4.2. Consequently, trailing 0 characters do not appear when you display or print floating-point values.

  • Tipo Caracteres. Acrescentando o caractere de tipo literal F para um literal de força para o Single tipo de dados. Appending the identifier type character ! to any identifier forces it to Single.

  • Framework Type. O tipo correspondente na.NET Framework é o System.Single estrutura.

Consulte também

Tarefas

Solucionando problemas de tipos de dados (Visual Basic)

Referência

Resumo de tipo de dados (Visual Basic)

System.Single

Tipo de dados decimais (Visual Basic)

Tipo de dados duplo (Visual Basic)

Funções de conversão de tipo (Visual Basic)

Resumo de conversão (Visual Basic)

Conceitos

Uso eficiente de tipos de dados (Visual Basic)