Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #70744

Re: Significant digits in a float?

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Significant digits in a float?
Date 2014-04-29 20:33 -0400
Organization IISS Elusive Unicorn
References <mailman.9549.1398700831.18130.python-list@python.org> <535f0f9f$0$29965$c3e8da3$5496439d@news.astraweb.com> <mailman.9565.1398741802.18130.python-list@python.org> <535f3bf7$0$11109$c3e8da3@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.9594.1398818045.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 29 Apr 2014 05:43:19 GMT, Steven D'Aprano <steve@pearwood.info>
declaimed the following:

>does differ from value to value, I don't think he'll have much luck: 
>given a float like 23.0, all we can say is that it has *at least* zero 
>significant decimal places. 23.1 has at least one, 23.1111 has at least 
>four.
>
	I wouldn't even give it that... Since internally they (ignore binary
conversion) translate into

	2.30E1, 2.31E1, and 2.31111E1

I'd claim 3-significant digits, 3-significant digits, and 6-significant
digits. (Heck, as I recall classical FORTRAN, they would be 0.230E2...)

>If you can put an upper bound on the precision, as Roy  indicates he can, 
>then perhaps a reasonable approach is to convert to a string rounded to 
>four decimal places, then strip trailing zeroes:
>
	That I'd agree with... once the data has been converted to binary
float, all knowledge of the source significant digits has been lost.

	Then confuse matters with the facet that in a math class

	1.1 * 2.2 => 2.42

but in a physics or chemistry class the recommended result is

	1.1 * 2.2 => 2.4

(one reason slide-rules were acceptable for so long -- and even my high
school trig course only required slide-rule significance even though half
the class had scientific calculators [costing >$100, when a Sterling
slide-rule could still be had for <$10]) <G>
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Significant digits in a float? Roy Smith <roy@panix.com> - 2014-04-28 12:00 -0400
  Re: Significant digits in a float? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-04-29 02:34 +0000
    Re: Significant digits in a float? Ben Finney <ben@benfinney.id.au> - 2014-04-29 13:23 +1000
      Re: Significant digits in a float? Steven D'Aprano <steve@pearwood.info> - 2014-04-29 05:43 +0000
        Re: Significant digits in a float? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-04-29 20:33 -0400
          Re: Significant digits in a float? Roy Smith <roy@panix.com> - 2014-04-29 20:42 -0400
            Re: Significant digits in a float? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-04-30 20:02 -0400
              Re: Significant digits in a float? Mark H Harris <harrismh777@gmail.com> - 2014-04-30 22:54 -0500
                Re: Significant digits in a float? Paul Rubin <no.email@nospam.invalid> - 2014-04-30 20:56 -0700
                Re: Significant digits in a float? Mark H Harris <harrismh777@gmail.com> - 2014-04-30 23:16 -0500
                Re: Significant digits in a float? William Ray Wing <wrw@mac.com> - 2014-05-01 11:53 -0400
                Re: Significant digits in a float? Mark H Harris <harrismh777@gmail.com> - 2014-05-06 11:29 -0500
                Re: Significant digits in a float? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-05-01 22:06 -0400
                Re: Significant digits in a float? Mark H Harris <harrismh777@gmail.com> - 2014-05-06 09:51 -0500
                Re: Significant digits in a float? alister <alister.nospam.ware@ntlworld.com> - 2014-05-06 15:18 +0000
                Re: Significant digits in a float? Joel Goldstick <joel.goldstick@gmail.com> - 2014-05-06 12:14 -0400
                Re: Significant digits in a float? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-05-06 19:48 -0400
                Re: Significant digits in a float? Roy Smith <roy@panix.com> - 2014-05-01 08:56 -0400
                Re: Significant digits in a float? Larry Hudson <orgnut@yahoo.com> - 2014-05-01 12:51 -0700
                Re: Significant digits in a float? Adam Funk <a24061@ducksburg.com> - 2014-05-01 22:05 +0100
                Re: Significant digits in a float? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-05-01 21:47 -0400
                Re: Significant digits in a float? Mark H Harris <harrismh777@gmail.com> - 2014-05-06 09:59 -0500
                [OT] Silde rules [was Re: Significant digits in a float?] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-06 16:10 +0000
                Re: [OT] Silde rules Ben Finney <ben@benfinney.id.au> - 2014-05-07 10:01 +1000
              Re: Significant digits in a float? Adam Funk <a24061@ducksburg.com> - 2014-05-01 21:55 +0100
                Re: Significant digits in a float? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-05-01 22:26 -0400
                Re: Significant digits in a float? Adam Funk <a24061@ducksburg.com> - 2014-05-08 20:58 +0100
    Re: Significant digits in a float? Roy Smith <roy@panix.com> - 2014-04-29 09:38 -0400
      Re: Significant digits in a float? Chris Angelico <rosuav@gmail.com> - 2014-04-30 02:30 +1000
        Re: Significant digits in a float? Roy Smith <roy@panix.com> - 2014-04-29 19:53 -0400
          Re: Significant digits in a float? Chris Angelico <rosuav@gmail.com> - 2014-04-30 10:13 +1000
          Re: Significant digits in a float? Ben Finney <ben@benfinney.id.au> - 2014-04-30 10:13 +1000
          Re: Significant digits in a float? Chris Angelico <rosuav@gmail.com> - 2014-04-30 10:17 +1000
          Re: Significant digits in a float? Ben Finney <ben@benfinney.id.au> - 2014-04-30 10:20 +1000
          Re: Significant digits in a float? Grant Edwards <invalid@invalid.invalid> - 2014-04-30 18:19 +0000
      Re: Significant digits in a float? Ned Batchelder <ned@nedbatchelder.com> - 2014-04-29 12:47 -0400
        Re: Significant digits in a float? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-04-30 09:45 +1200
      Re: Significant digits in a float? Chris Angelico <rosuav@gmail.com> - 2014-04-30 02:59 +1000
      Re: Significant digits in a float? Adam Funk <a24061@ducksburg.com> - 2014-04-29 21:16 +0100
        Re: Significant digits in a float? Mark H Harris <harrismh777@gmail.com> - 2014-04-29 15:39 -0500
          Re: Significant digits in a float? Chris Angelico <rosuav@gmail.com> - 2014-04-30 07:15 +1000
        Re: Significant digits in a float? Ryan Hiebert <ryan@ryanhiebert.com> - 2014-04-29 15:42 -0500
        Re: Significant digits in a float? emile <emile@fenx.com> - 2014-04-29 15:42 -0700
          Re: Significant digits in a float? alister <alister.nospam.ware@ntlworld.com> - 2014-04-30 09:03 +0000
          Re: Significant digits in a float? Grant Edwards <invalid@invalid.invalid> - 2014-04-30 18:21 +0000
            Re: Significant digits in a float? emile <emile@fenx.com> - 2014-05-01 09:34 -0700
              Re: Significant digits in a float? alister <alister.nospam.ware@ntlworld.com> - 2014-05-01 17:13 +0000
        Re: Significant digits in a float? Chris Angelico <rosuav@gmail.com> - 2014-04-30 08:51 +1000
          Re: Significant digits in a float? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-04-30 20:14 +1200
            Re: Significant digits in a float? Chris Angelico <rosuav@gmail.com> - 2014-04-30 18:27 +1000
            Re: Significant digits in a float? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-04-30 14:05 +0100
        Re: Significant digits in a float? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-04-30 00:34 +0100
        Re: Significant digits in a float? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-04-29 20:37 -0400
        Re: Significant digits in a float? Roy Smith <roy@panix.com> - 2014-04-29 20:45 -0400
        Re: Significant digits in a float? Chris Angelico <rosuav@gmail.com> - 2014-04-30 10:45 +1000
          Re: Significant digits in a float? Roy Smith <roy@panix.com> - 2014-04-29 20:48 -0400
        Re: Significant digits in a float? Ethan Furman <ethan@stoneleaf.us> - 2014-04-29 19:31 -0700
          Re: Significant digits in a float? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-04-30 02:59 +0000
            Re: Significant digits in a float? Roy Smith <roy@panix.com> - 2014-04-29 23:30 -0400
              Re: Significant digits in a float? Chris Angelico <rosuav@gmail.com> - 2014-04-30 13:40 +1000
        Re: Significant digits in a float? Chris Angelico <rosuav@gmail.com> - 2014-04-30 13:03 +1000
          Re: Significant digits in a float? Roy Smith <roy@panix.com> - 2014-04-30 08:01 -0400
        Off-topic  circumnavigating the earth in a mile or less  [was Re: Significant digits in a float?] Ethan Furman <ethan@stoneleaf.us> - 2014-04-30 06:14 -0700
        Re: Off-topic  circumnavigating the earth in a mile or less  [was Re: Significant digits in a float?] Ethan Furman <ethan@stoneleaf.us> - 2014-04-30 07:02 -0700
          Re: Off-topic  circumnavigating the earth in a mile or less Adam Funk <a24061@ducksburg.com> - 2014-05-01 21:52 +0100
        Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?] Chris Angelico <rosuav@gmail.com> - 2014-05-01 00:27 +1000
        Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?] Chris Angelico <rosuav@gmail.com> - 2014-05-01 05:10 +1000
        Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?] Ryan Hiebert <ryan@ryanhiebert.com> - 2014-04-30 10:24 -0500
        Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?] Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-30 17:46 -0600
        Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?] Terry Reedy <tjreedy@udel.edu> - 2014-04-30 22:20 -0400
          Re: Off-topic circumnavigating the earth in a mile or less [was Re:   Significant digits in a float?] Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-05-01 18:16 +1200
          Re: Off-topic circumnavigating the earth in a mile or less Adam Funk <a24061@ducksburg.com> - 2014-05-01 21:57 +0100
            Re: Off-topic circumnavigating the earth in a mile or less Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-05-01 22:49 +0100
            Re: Off-topic circumnavigating the earth in a mile or less alister <alister.nospam.ware@ntlworld.com> - 2014-05-02 08:49 +0000
        Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?] Chris Angelico <rosuav@gmail.com> - 2014-05-01 11:57 +1000
        Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?] Vlastimil Brom <vlastimil.brom@gmail.com> - 2014-05-01 09:49 +0200
      Re: Significant digits in a float? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-04-30 02:50 +0000
      Re: Significant digits in a float? Grant Edwards <invalid@invalid.invalid> - 2014-04-30 18:18 +0000

csiph-web