N NirVid New member Joined Sep 21, 2016 Messages 1 Programming Experience Beginner Mar 27, 2018 #1 Hello, I am stumped by this. csng("1422.843197465627") returns 1422.84314 and NOT 1422.8432 or even 1422.84319 even CType( "1422.843197465627", Single) also return the same value. Can somebody explain this to me?
Hello, I am stumped by this. csng("1422.843197465627") returns 1422.84314 and NOT 1422.8432 or even 1422.84319 even CType( "1422.843197465627", Single) also return the same value. Can somebody explain this to me?
JohnH VB.NET Forum Moderator Staff member Joined Dec 17, 2005 Messages 15,856 Location Norway Programming Experience 10+ Mar 27, 2018 #2 Floating point numbers are imprecise, a lot is explained here: Single Struct (System) | Microsoft Docs Try Decimal data type instead (CDec). Upvote 0 Downvote
Floating point numbers are imprecise, a lot is explained here: Single Struct (System) | Microsoft Docs Try Decimal data type instead (CDec).