datatype [modified]
-
Hi All, I am selecting weight Select instanceid2400,CAST(weight as real) as GrossWeight from tblcargo where instanceid2400='#AGE019000016' and result is 3289.154 but when I am reading it in vb.net as Dim GrossWeight as Single GrossWeight = .GetFloat("GrossWeight") it is changing value to 3289.1 and when i am using Dim GrossWeight as Double GrossWeight = .GetFloat("GrossWeight") it is putting unwanted values at end 3289.15405273438 how can we show same value (3289.154) whatever is selected
Ankit Aneja "Nothing is impossible. The word itself says - I M possible"
modified on Friday, May 15, 2009 9:36 AM
-
Hi All, I am selecting weight Select instanceid2400,CAST(weight as real) as GrossWeight from tblcargo where instanceid2400='#AGE019000016' and result is 3289.154 but when I am reading it in vb.net as Dim GrossWeight as Single GrossWeight = .GetFloat("GrossWeight") it is changing value to 3289.1 and when i am using Dim GrossWeight as Double GrossWeight = .GetFloat("GrossWeight") it is putting unwanted values at end 3289.15405273438 how can we show same value (3289.154) whatever is selected
Ankit Aneja "Nothing is impossible. The word itself says - I M possible"
modified on Friday, May 15, 2009 9:36 AM
Change the Single to Decimal...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Change the Single to Decimal...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
And if still facing trouble use .ToString("0.000") ..
Motivation is the key to software development.
Wrong. The value he's getting is because of the conversion from one floating point format to another. Formatting it to hide the inaccuracies does nothing when the value is used in calculations.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Wrong. The value he's getting is because of the conversion from one floating point format to another. Formatting it to hide the inaccuracies does nothing when the value is used in calculations.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008