Click here to Skip to main content
15,910,877 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionmultiple monitor support. Pin
oyinbogo16-Sep-05 6:49
oyinbogo16-Sep-05 6:49 
AnswerRe: multiple monitor support. Pin
Joshua Quick16-Sep-05 7:47
Joshua Quick16-Sep-05 7:47 
QuestionReplace Item Listbox ? Pin
gerrolette16-Sep-05 6:04
gerrolette16-Sep-05 6:04 
AnswerRe: Replace Item Listbox ? Pin
Briga19-Sep-05 22:23
Briga19-Sep-05 22:23 
GeneralRe: Replace Item Listbox ? Pin
gerrolette20-Sep-05 2:01
gerrolette20-Sep-05 2:01 
GeneralRe: Replace Item Listbox ? Pin
Briga20-Sep-05 6:48
Briga20-Sep-05 6:48 
Questioncombining unicode characters in vb or vbscript Pin
Lanre Ogunkola16-Sep-05 5:20
Lanre Ogunkola16-Sep-05 5:20 
QuestionSingle datatype calculation error Pin
Anonymous16-Sep-05 4:24
Anonymous16-Sep-05 4:24 
Hi all,

I have discovered a very strange, if not disturbing, behavior performing a simple calculation using Single datatypes in VB.NET.

Here's the code:

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click

Dim x As Single = 0.3
Dim y As Single = 0.05
x += y
x -= 0.35 ' Test if this value is present in calculations

End Sub

If you step through this code while watching the values of x and y in the Locals or Watch windows, you will see that x = -0.3, y = -0.05, and x += y produces x = 0.350000024. This doesn't occur using doubles or decimals. The MSDN help says, '...Single-precision numbers store an approximation of a real number.' I'm not sure of exactly what they mean by 'an approximation'?

I work for a financial company, and we are all quite baffled by this. Any comments or ideas will be greatly appreciated!

ThanksBig Grin | :-D

AnswerRe: Single datatype calculation error Pin
Dave Kreskowiak16-Sep-05 6:12
mveDave Kreskowiak16-Sep-05 6:12 
QuestionRe: Single datatype calculation error Pin
Anonymous16-Sep-05 10:32
Anonymous16-Sep-05 10:32 
AnswerRe: Single datatype calculation error Pin
Dave Kreskowiak16-Sep-05 12:01
mveDave Kreskowiak16-Sep-05 12:01 
QuestionHow do I embed a database in a VB.NET application Pin
lutherium16-Sep-05 3:34
lutherium16-Sep-05 3:34 
AnswerRe: How do I embed a database in a VB.NET application Pin
No-e16-Sep-05 6:57
No-e16-Sep-05 6:57 
GeneralRe: How do I embed a database in a VB.NET application Pin
seee sharp18-Sep-05 18:08
seee sharp18-Sep-05 18:08 
QuestionWebbrowser in VB.NET Pin
jclaude1316-Sep-05 3:11
jclaude1316-Sep-05 3:11 
AnswerRe: Webbrowser in VB.NET Pin
seee sharp18-Sep-05 18:15
seee sharp18-Sep-05 18:15 
QuestionChannelSecure SiteMinder Pin
Daredeviljpr16-Sep-05 3:09
Daredeviljpr16-Sep-05 3:09 
QuestionSave data when load Pin
16-Sep-05 2:43
suss16-Sep-05 2:43 
AnswerRe: Save in when load Pin
enjoycrack16-Sep-05 2:50
enjoycrack16-Sep-05 2:50 
General[Message Deleted] Pin
Amr M. K.16-Sep-05 2:53
Amr M. K.16-Sep-05 2:53 
GeneralRe: Save in when load Pin
enjoycrack16-Sep-05 3:03
enjoycrack16-Sep-05 3:03 
GeneralRe: Save in when load Pin
Amr M. K.16-Sep-05 3:36
Amr M. K.16-Sep-05 3:36 
GeneralRe: Save in when load Pin
Amr M. K.16-Sep-05 3:37
Amr M. K.16-Sep-05 3:37 
GeneralRe: Save in when load Pin
Dave Kreskowiak16-Sep-05 14:08
mveDave Kreskowiak16-Sep-05 14:08 
GeneralRe: Save in when load Pin
Gopi.V16-Sep-05 23:04
Gopi.V16-Sep-05 23:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.