Article View: borland.public.interbase.sql
Article #776Re: Float with too many decimals
From: Bill Todd
Date: Sun, 01 Jul 2007 14:46
Date: Sun, 01 Jul 2007 14:46
16 lines
1527 bytes
1527 bytes
Moore wrote: > in a float field when i write 3,2 it shows 3,20000004768372 > why and what is the best solution for this??? Floating point notation cannot represent most decimal fractions exactly. Use a DisplayMask in your Delphi app to limit the number of digits to the right of the decimal that are displayed. A better solution is to use the NUMERIC data type instead of FLOAT. NUMERIC stored real numbers as scaled 64 bit integers and, therefore, does not suffer from floating point imprecision. If you use the NUMERIC data type make sure your database is dialect 3. -- Bill Todd (TeamB)
Technical Details
Message-ID:
<4687be4d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<46878841$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,823fa3f99bdcc523
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Bill Todd" <no@no.com>
Subject: Re: Float with too many decimals
Newsgroups: borland.public.interbase.sql
References: <46878841$1@newsgroups.borland.com>
Organization: The Database Group, Inc.
User-Agent: XanaNews/1.18.1.6
X-Face: ":yn4zt^A_dn>6~{YJmu^B\'4w)e:apPM\VC=Dvf&*tASxX9|BYczkFd$xr.$vNSZ[3Uobr p]c4\+\l){!WQI.$]veP({HLd;CDYH?iN
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 216.207.211.19
Message-ID: <4687be4d$1@newsgroups.borland.com>
Date: 1 Jul 2007 07:46:37 -0700
X-Trace: newsgroups.borland.com 1183301197 216.207.211.19 (1 Jul 2007 07:46:37 -0700)
Lines: 16
X-Authenticated-User: btodd
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail