Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Frank Millman" Newsgroups: comp.lang.python Subject: Re: Problem with sqlite3 and Decimal (fwd) Date: Sat, 12 Dec 2015 07:22:42 +0200 Lines: 24 Message-ID: References: <201512111345.tBBDjgae025001@fido.openend.se> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de p7P0I0yK0At+1l5iMsPt9w9z11V/WjXziGrLiQVpUIQQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'string.': 0.04; 'subject:sqlite3': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'supported.': 0.09; 'stored': 0.10; 'result.': 0.15; '2),': 0.16; 'affinity': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'skip:n 70': 0.16; 'sqlite3': 0.16; 'subject:Problem': 0.16; 'int,': 0.22; 'wrote': 0.23; 'tried': 0.24; 'header:In-Reply-To:1': 0.24; 'header:X-Complaints-To:1': 0.26; 'supported': 0.27; 'decimal': 0.29; 'asked': 0.29; 'post': 0.31; 'table': 0.32; 'point': 0.33; 'that,': 0.34; 'but': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'several': 0.38; 'mean': 0.38; 'means': 0.39; 'data': 0.39; 'does': 0.39; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'questions': 0.40; 'save': 0.60; 'your': 0.60; 'default': 0.61; 'real': 0.62; 'balance': 0.64; 'therefore': 0.67; 'frank': 0.72; 'saw': 0.77; '(ref': 0.84; 'answer,': 0.84; 'internally.': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: 197.82.211.31 In-Reply-To: X-MSMail-Priority: Normal Importance: Normal X-Newsreader: Microsoft Windows Live Mail 15.4.3502.922 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3502.922 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:100318 "Igor Korot" wrote in message news:CA+FnnTyZY_1=62Rbk_kKZ39tkeoA6JVmFn9qs17aS-2YD4dVnA@mail.gmail.com... > > Yes, I saw your post to sqlite3 ML. > And I do know that by default sqlite3 does not have many types supported. > > However, all you need to do is save it as DECIMAL(10,2). > It is supported is sqlite3 and it will have NUMERIC affinity (ref 1) > or REAL (ref 2), which means the data will > be stored as decimals and not a string. > Do you mean CREATE TABLE fmtemp (acno INT, balance DECIMAL(10,2)); ? I tried that, but I got exactly the same result. The answer, as explained by several people on the sqlite3 ML, is that sqlite3 does not have a true decimal type and therefore uses floating point internally. As we all know from many questions asked on this forum, floating point and exact decimal representation are incompatible. Frank