Path: csiph.com!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Karl Ratzsch Newsgroups: comp.graphics.apps.gnuplot Subject: Re: incorrect arithmetik? Date: Tue, 12 Jan 2016 14:19:20 +0100 Organization: solani.org Lines: 24 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: solani.org 1452604759 5820 eJwNyMEBwCAIA8CVRJKA4yiW/Uew9zy6TBUQBTZ7uO/hE0UtixUXStPfxJ59GronC5/RMJT5APirD+M= (12 Jan 2016 13:19:19 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Tue, 12 Jan 2016 13:19:19 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 X-User-ID: eJwFwQkBwDAIA0BLLU8AOSsQ/xJ254qLDoPDnM5MKHTAnsrQucOVmiMZsOrptv14ZNHvLeUHHhUR2A== In-Reply-To: Cancel-Lock: sha1:nmoybYUnPgdjVlQq6hOKPJTb0ZE= X-NNTP-Posting-Host: eJwFwYEBwDAEBMCVEKQ/Dur3HyF3cVJzrmekB4OCnpWAFlp68dGJTdaogX7G57eCNbnqfR8t7xH5 X-Enigmail-Draft-Status: N1110 Xref: csiph.com comp.graphics.apps.gnuplot:3157 Am 12.01.2016 um 11:40 schrieb Jörg Buchholz: > I can not found the solution to the following problem: > > b=7.2-6.9 > c=8.2-7.9 > > show variables > b = 0.3 > c = 0.299999999999999 > > Why is c not 0.3? Floating point arithmetics. Most decimal fractions cannot be represented exactly by a binary float variable. 8.2 is 1000.00110011.... 7.2 is 111.11100110011.... If the two errors add up in one direction, the result of your subtraction will be closer to a value that is in fact off by 1 in the least significant digit. Karl