Groups | Blog | Home
all groups > vb.net > january 2008 >

vb.net : doubles



ReneMarxis
1/28/2008 7:24:55 AM
Hello

can someone explain me?

[quoted text, click to view]
False
Herfried K. Wagner [MVP]
1/28/2008 4:36:37 PM
"ReneMarxis" <rene.marxis@yahoo.de> schrieb:
[quoted text, click to view]

(Complete) Tutorial to Understand IEEE Floating-Point Errors
<URL:http://support.microsoft.com/?scid=kb;EN-US;42980>

IEEE Standard 754 Floating Point Numbers
<URL:http://steve.hollasch.net/cgindex/coding/ieeefloat.html>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
Cor Ligthert[MVP]
1/28/2008 6:15:23 PM
Rebe

This is the standard behaviour of floating point values,

If it was not there would probably no decimal values, therefore use that
instead of doubles to solve your problem.

Cor
ReneMarxis
1/29/2008 1:15:04 AM
[quoted text, click to view]

Many thanks for your answers. Helped a lot. I ll use decimals as far
Bill McCarthy
1/29/2008 12:28:42 PM
Hi Rene,

Doubles are a non precision floating point number. For precision work with
decimal values use the Decimal type.
If working with Double (or Single) then consider using Round, Ceiling, Floor
etc to. To compare Double values you typically look for a value less than a
margin of error, e.g:


<Runtime.CompilerServices.Extension()> _
Function Approximates(ByVal left As Double, ByVal right As Double,
Optional ByVal maxDifference As Double = 0.000000001) As Boolean
Return Math.Abs(left - right) < maxDifference
End Function



[quoted text, click to view]
AddThis Social Bookmark Button