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


Groups > comp.lang.python > #70682 > unrolled thread

Significant digits in a float?

Started byRoy Smith <roy@panix.com>
First post2014-04-28 12:00 -0400
Last post2014-04-30 18:18 +0000
Articles 20 on this page of 78 — 23 participants

Back to article view | Back to comp.lang.python


Contents

  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

Page 2 of 4 — ← Prev page 1 [2] 3 4  Next page →


#70833

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2014-05-01 21:47 -0400
Message-ID<mailman.9640.1398995253.18130.python-list@python.org>
In reply to#70804
On Wed, 30 Apr 2014 22:54:21 -0500, Mark H Harris <harrismh777@gmail.com>
declaimed the following:

>
>    My high school '74 was the last class to learn the slide-rule using 
>the Sterling (we paid a deposit to use the school's). I returned my 
>Sterling to the teacher at year-end and got my deposit back. They are 
>all probably in an old card-board box in the basement. I should ask.
>
	Since calculators had started to appear, I never did get formal
training in slide-rules. The LL scales still require me to glance at a
guide book...

>    I received my Pickett Model N4-T Vector-Type Log Log Dual-Base Speed 
>Rule as a graduation | birthday gift... off to college with a leather 
>cased slip stick hanging from my belt (I was invincable).  Mine had the 

	Strangely, out of the three Picketts I now own, only the CIE had the
belt hook included.

>CF/m DF/m scales also -- folded at 2.3, the loge of 10 with ? where it 
>should be (more or less).  Copyright 1959... that baby was the king of 

	Interesting -- I've not encountered those scales.
>
>    I carried my slide rule to my general class exam as well. The VE 
>inspected it to be sure that certain stuff was not written in pencil 
>between the scales! True story. Its not required today, of course, but I 
>can still send/receive at 20 wpm. <sigh>
>
	Whereas I started as a "no-good" Tech. It was the dropping of the code
requirement that encouraged me to try for the higher ratings. After all,
using a TS-570 just for 6m is rather limiting <G> [and even that was
difficult -- for a few months I had a mass PVC piping straddling a fence
supporting a pair of 6m HamSticks as a dipole... Until the apartment
manager complained.

	Many moons ago, I could take Gregg shorthand at 100WPM <G> [but my
typing speed was only a slow 30WPM]


	I regret that I never risked the $35 dollars when my college bookstore
was closing out the slide-rule display. They had the top Post bamboo
laminate rule at half price. At the time I'd bought an HP-25 calculator
[they phased out the HP brand a year or two later -- apparently RPN was too
confusing].

	And, in a side comment, I once corrected a bookstore that had filed
Asimov's "Easy Introduction to the Slide Rule" under Science Fiction.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [next] | [standalone]


#70966

FromMark H Harris <harrismh777@gmail.com>
Date2014-05-06 09:59 -0500
Message-ID<lkatc7$h4v$1@speranza.aioe.org>
In reply to#70833
On 5/1/14 8:47 PM, Dennis Lee Bieber wrote:
> On Wed, 30 Apr 2014 22:54:21 -0500, Mark H Harris <harrismh777@gmail.com>
> declaimed the following:
>
>>
>>     My high school '74 was the last class to learn the slide-rule using
>> the Sterling (we paid a deposit to use the school's).

> 	Since calculators had started to appear, I never did get formal
> training in slide-rules. The LL scales still require me to glance at a
> guide book...
>
> 	I regret that I never risked the $35 dollars when my college bookstore
> was closing out the slide-rule display. They had the top Post bamboo
> laminate rule at half price. At the time I'd bought an HP-25 calculator
> [they phased out the HP brand a year or two later -- apparently RPN was too
> confusing].

     Half way through my senior year the HP-65 "gold key" calculator was 
available for about $800.00 dollars. That sucker was programmable and 
had magnetic strip recorder for off-loading storage... but I digress. We 
all had our priorities... one guy bought one;  the rest of us bought 
cars. ---for about the same price too!

     I used my rule well into college; the first calculator I owned was 
the Rockwell 63R --- "The Big green numbers, and the little rubber feet!"

marcus


[toc] | [prev] | [next] | [standalone]


#70974 — [OT] Silde rules [was Re: Significant digits in a float?]

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2014-05-06 16:10 +0000
Subject[OT] Silde rules [was Re: Significant digits in a float?]
Message-ID<5369095e$0$29965$c3e8da3$5496439d@news.astraweb.com>
In reply to#70966
On Tue, 06 May 2014 09:59:22 -0500, Mark H Harris wrote:

[...]
>      I used my rule well into college; the first calculator I owned was
> the Rockwell 63R --- "The Big green numbers, and the little rubber
> feet!"

Guys, heaven knows I'm guilty of the occasional off-topic post myself, 
and I'm not obsessive about these things, but there comes a time in every 
off-topic thread where the right thing to do is to label it off-topic. 
And this thread has long passed that time!


-- 
Steven D'Aprano
http://import-that.dreamwidth.org/

[toc] | [prev] | [next] | [standalone]


#70994 — Re: [OT] Silde rules

FromBen Finney <ben@benfinney.id.au>
Date2014-05-07 10:01 +1000
SubjectRe: [OT] Silde rules
Message-ID<mailman.9717.1399420916.18130.python-list@python.org>
In reply to#70974
Steven D'Aprano <steve+comp.lang.python@pearwood.info> writes:

> Guys, heaven knows I'm guilty of the occasional off-topic post myself, 
> and I'm not obsessive about these things, but there comes a time in every 
> off-topic thread where the right thing to do is to label it off-topic. 
> And this thread has long passed that time!

Yes. Changing the Subject field, while retaining the References field,
is how we make threads continue uninterrupted across a change of topic.

Sadly, this standard method is both unfamiliar to a lot of forum users,
and (reportedly) disrupts regressively buggy forum interfaces like
Google Groups which have a stupid broken implementation of threads.

The solution IMO is to discard Google Groups as irretrievably broken,
but I don't have much hope for that. Meanwhile I advocate using the full
features of Usenet and encouraging as many as possible to use proper
clients.

-- 
 \        “I was once walking through the forest alone and a tree fell |
  `\       right in front of me, and I didn't hear it.” —Steven Wright |
_o__)                                                                  |
Ben Finney

[toc] | [prev] | [next] | [standalone]


#70824

FromAdam Funk <a24061@ducksburg.com>
Date2014-05-01 21:55 +0100
Message-ID<ouoa3bxuk7.ln2@news.ducksburg.com>
In reply to#70793
On 2014-05-01, Dennis Lee Bieber wrote:

> On Tue, 29 Apr 2014 20:42:33 -0400, Roy Smith <roy@panix.com> declaimed the
> following:
>
>>In article <mailman.9594.1398818045.18130.python-list@python.org>,
>> Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote:

>>> (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>
>>
>>Sterling?  Snort.  K&E was the way to go.
>
> 	Math teacher was selling them in my 10th grade... Actually I already
> owned a Faber-Castell 57/22 "Business" ruler (which did NOT have the CF/DF
> scales set for *PI) and a Pickett N-1010-ES Trig rule.

What does a "business" slide-rule do?  Depreciation?


-- 
"Mrs CJ and I avoid clichés like the plague."

[toc] | [prev] | [next] | [standalone]


#70836

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2014-05-01 22:26 -0400
Message-ID<mailman.9642.1398997620.18130.python-list@python.org>
In reply to#70824
On Thu, 01 May 2014 21:55:20 +0100, Adam Funk <a24061@ducksburg.com>
declaimed the following:

>On 2014-05-01, Dennis Lee Bieber wrote:
>
>> On Tue, 29 Apr 2014 20:42:33 -0400, Roy Smith <roy@panix.com> declaimed the
>> following:
>>
>>>In article <mailman.9594.1398818045.18130.python-list@python.org>,
>>> Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote:
>
>>>> (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>
>>>
>>>Sterling?  Snort.  K&E was the way to go.
>>
>> 	Math teacher was selling them in my 10th grade... Actually I already
>> owned a Faber-Castell 57/22 "Business" ruler (which did NOT have the CF/DF
>> scales set for *PI) and a Pickett N-1010-ES Trig rule.
>
>What does a "business" slide-rule do?  Depreciation?
>

	Special markers for: dozen, gross; a scale for "non-metric measures" to
metric equivalents -- US Bushel, UK ("brit") bushel, US gallon, UK gallon,
short and long tons, a few Russian units, "Pud" and "R.t." which appear to
map to cubic inch and cubic foot; markings for % (discount and mark-up)

	And a scheme for simple interest calculations (which may explain why
the CF/DF scales are longer than the C/D scales): "Move the main cursor
line over the principal on scale DF -- the principal must be taken only on
scale DF -- set the rate per cent on the scale CI, under the short cursor
line, and read the interest on the scale DF or D in line with the number of
days on the scale CF or C." {yes, just to the left of the normal cursor is
a short line only over the inverted C scale}
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [next] | [standalone]


#71126

FromAdam Funk <a24061@ducksburg.com>
Date2014-05-08 20:58 +0100
Message-ID<l84t3bxdqj.ln2@news.ducksburg.com>
In reply to#70836
On 2014-05-02, Dennis Lee Bieber wrote:

> On Thu, 01 May 2014 21:55:20 +0100, Adam Funk <a24061@ducksburg.com>
> declaimed the following:
>
>>On 2014-05-01, Dennis Lee Bieber wrote:

>>> 	Math teacher was selling them in my 10th grade... Actually I already
>>> owned a Faber-Castell 57/22 "Business" ruler (which did NOT have the CF/DF
>>> scales set for *PI) and a Pickett N-1010-ES Trig rule.
>>
>>What does a "business" slide-rule do?  Depreciation?
>>
>
> 	Special markers for: dozen, gross; a scale for "non-metric measures" to
> metric equivalents -- US Bushel, UK ("brit") bushel, US gallon, UK gallon,
> short and long tons, a few Russian units, "Pud" and "R.t." which appear to
> map to cubic inch and cubic foot; markings for % (discount and mark-up)
>
> 	And a scheme for simple interest calculations (which may explain why
> the CF/DF scales are longer than the C/D scales): "Move the main cursor
> line over the principal on scale DF -- the principal must be taken only on
> scale DF -- set the rate per cent on the scale CI, under the short cursor
> line, and read the interest on the scale DF or D in line with the number of
> days on the scale CF or C." {yes, just to the left of the normal cursor is
> a short line only over the inverted C scale}

Interesting, thanks.

-- 
I used to be better at logic problems, before I just dumped
them all into TeX and let Knuth pick out the survivors.
                                               -- plorkwort

[toc] | [prev] | [next] | [standalone]


#70713

FromRoy Smith <roy@panix.com>
Date2014-04-29 09:38 -0400
Message-ID<roy-DA9493.09383329042014@news.panix.com>
In reply to#70702
In article <535f0f9f$0$29965$c3e8da3$5496439d@news.astraweb.com>,
 Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:

> On Mon, 28 Apr 2014 12:00:23 -0400, Roy Smith wrote:
> 
> [...]
> > Fundamentally, these numbers have between 0 and 4 decimal digits of
> > precision, 
> 
> I'm surprised that you have a source of data with variable precision, 
> especially one that varies by a factor of TEN THOUSAND.

OK, you're surprised.

> I don't know what justification you have for combining such a
> mix of data sources.

Because that's the data that was given to me.  Real life data is messy.

> One possible interpretation of your post is that you have a source of 
> floats, where all the numbers are actually measured to the same 
> precision, and you've simply misinterpreted the fact that some of them 
> look like they have less precision.

Another possibility is that they're latitude/longitude coordinates, some 
of which are given to the whole degree, some of which are given to 
greater precision, all the way down to the ten-thousandth of a degree.

> What reason do you have to think that something recorded to 14 
> decimal places was only intended to have been recorded to 4?

Because I understand the physical measurement these numbers represent.  
Sometimes, Steve, you have to assume that when somebody asks a question, 
they actually have asked the question then intended to ask.

> Perhaps you need to explain why you're doing this, as it seems 
> numerically broken.

These are latitude and longitude coordinates of locations.  Some 
locations are known to a specific street address.  Some are known to a 
city.  Some are only known to the country.  So, for example, the 38.0 
value represents the latitude, to the nearest whole degree, of the 
geographic center of the contiguous United States.

> I really think you need to go back to the source. Trying to infer the 
> precision of the measurements from the accident of the string formatting 
> seems pretty dubious to me.

Sure it is.  But, like I said, real-life data is messy.  You can wring 
your hands and say, "this data sucks, I can't use it", or you can figure 
out some way to deal with it.  Which is the whole point of my post.  The 
best I've come up with is inferring something from the string formatting 
and I'm hoping there might be something better I might do.

> But I suppose if you wanted to infer the number of digits after the 
> decimal place, excluding trailing zeroes (why, I do not understand), up 
> to a maximum of four digits, then you could do:
> 
> s = "%.4f" % number  # rounds to four decimal places
> s = s.rstrip("0")  # ignore trailing zeroes, whether significant or not
> count = len(s.split(".")[1])

This at least seems a little more robust than just calling str().  Thank 
you :-)

> Assuming all the numbers fit in the range where they are shown in non-
> exponential format.

They're latitude/longitude, so they all fall into [-180, 180].

> Perhaps you ought to be using Decimal rather than float.

Like I said, "The numbers are given to me as Python floats; I have no 
control over that".

> > I'm willing to accept that fact that I won't be able to differentiate
> > between float("38.0") and float("38.0000").  Both of those map to 1,
> > which is OK for my purposes.
> 
> That seems... well, "bizarre and wrong" are the only words that come to 
> mind.

I'm trying to intuit, from the values I've been given, which coordinates 
are likely to be accurate to within a few miles.  I'm willing to accept 
a few false negatives.  If the number is float("38"), I'm willing to 
accept that it might actually be float("38.0000"), and I might be 
throwing out a good data point that I don't need to.

For the purpose I'm using the data for, excluding the occasional good 
data point won't hurt me.  Including the occasional bad one, will.

> By the way, you contradict yourself here. Earlier, you described 38.0 as 
> having zero decimal places (which is wrong). Here you describe it as 
> having one, which is correct, and then in a later post you describe it as 
> having zero decimal places again.

I was sloppy there.  I was copy-pasting data from my program output.  
Observe:

>>> print float("38")
38.0

In standard engineering parlance, the string "38" represents a number 
with a precision of +/- 1 unit.  Unfortunately, Python's default str() 
representation turns this into "38.0", which implies +/- 0.1 unit.

Floats represented as strings (at least in some disciplines, such as 
engineering) include more information than just the value.  By the 
number of trailing zeros, they also include information about the 
precision of the measurement.  That information is lost when the string 
is converted to a IEEE float.  I'm trying to intuit that information 
back, and as I mentioned earlier, am willing to accept that the 
intuiting process will be imperfect.  There is real-life value in 
imperfect processes.

[toc] | [prev] | [next] | [standalone]


#70718

FromChris Angelico <rosuav@gmail.com>
Date2014-04-30 02:30 +1000
Message-ID<mailman.9575.1398789020.18130.python-list@python.org>
In reply to#70713
On Tue, Apr 29, 2014 at 11:38 PM, Roy Smith <roy@panix.com> wrote:
> I'm trying to intuit, from the values I've been given, which coordinates
> are likely to be accurate to within a few miles.  I'm willing to accept
> a few false negatives.  If the number is float("38"), I'm willing to
> accept that it might actually be float("38.0000"), and I might be
> throwing out a good data point that I don't need to.

You have one chance in ten, repeatably, of losing a digit. That is,
roughly 10% of your four-decimal figures will appear to be
three-decimal, and 1% of them will appear to be two-decimal, and so
on. Is that "a few" false negatives? It feels like a lot IMO. But
then, there's no alternative - the information's already gone.

ChrisA

[toc] | [prev] | [next] | [standalone]


#70739

FromRoy Smith <roy@panix.com>
Date2014-04-29 19:53 -0400
Message-ID<roy-049B32.19535729042014@news.panix.com>
In reply to#70718
In article <mailman.9575.1398789020.18130.python-list@python.org>,
 Chris Angelico <rosuav@gmail.com> wrote:

> On Tue, Apr 29, 2014 at 11:38 PM, Roy Smith <roy@panix.com> wrote:
> > I'm trying to intuit, from the values I've been given, which coordinates
> > are likely to be accurate to within a few miles.  I'm willing to accept
> > a few false negatives.  If the number is float("38"), I'm willing to
> > accept that it might actually be float("38.0000"), and I might be
> > throwing out a good data point that I don't need to.
> 
> You have one chance in ten, repeatably, of losing a digit. That is,
> roughly 10% of your four-decimal figures will appear to be
> three-decimal, and 1% of them will appear to be two-decimal, and so
> on. Is that "a few" false negatives?

You're looking at it the wrong way.  It's not that the glass is 10% 
empty, it's that it's 90% full, and 90% is a lot of good data :-)

[toc] | [prev] | [next] | [standalone]


#70740

FromChris Angelico <rosuav@gmail.com>
Date2014-04-30 10:13 +1000
Message-ID<mailman.9590.1398816797.18130.python-list@python.org>
In reply to#70739
On Wed, Apr 30, 2014 at 9:53 AM, Roy Smith <roy@panix.com> wrote:
> In article <mailman.9575.1398789020.18130.python-list@python.org>,
>  Chris Angelico <rosuav@gmail.com> wrote:
>
>> On Tue, Apr 29, 2014 at 11:38 PM, Roy Smith <roy@panix.com> wrote:
>> > I'm trying to intuit, from the values I've been given, which coordinates
>> > are likely to be accurate to within a few miles.  I'm willing to accept
>> > a few false negatives.  If the number is float("38"), I'm willing to
>> > accept that it might actually be float("38.0000"), and I might be
>> > throwing out a good data point that I don't need to.
>>
>> You have one chance in ten, repeatably, of losing a digit. That is,
>> roughly 10% of your four-decimal figures will appear to be
>> three-decimal, and 1% of them will appear to be two-decimal, and so
>> on. Is that "a few" false negatives?
>
> You're looking at it the wrong way.  It's not that the glass is 10%
> empty, it's that it's 90% full, and 90% is a lot of good data :-)

Hah! That's one way of looking at it.

At least you don't have to worry about junk digits getting in. The
greatest precision you're working with is three digits before the
decimal and four after, and a Python float can handle that easily.
(Which is what I was concerned about when I first queried your
terminology - four digits to the right of the decimal and, say, 10-12
to the left, and you're starting to see problems.)

ChrisA

[toc] | [prev] | [next] | [standalone]


#70741

FromBen Finney <ben@benfinney.id.au>
Date2014-04-30 10:13 +1000
Message-ID<mailman.9591.1398816832.18130.python-list@python.org>
In reply to#70739
Roy Smith <roy@panix.com> writes:

> In article <mailman.9575.1398789020.18130.python-list@python.org>,
>  Chris Angelico <rosuav@gmail.com> wrote:
>
> > You have one chance in ten, repeatably, of losing a digit. That is,
> > roughly 10% of your four-decimal figures will appear to be
> > three-decimal, and 1% of them will appear to be two-decimal, and so
> > on. Is that "a few" false negatives?
>
> You're looking at it the wrong way.  It's not that the glass is 10% 
> empty, it's that it's 90% full, and 90% is a lot of good data :-)

The problem is you won't know *which* 90% is accurate, and which 10% is
inaccurate. This is very different from the glass, where it's evident
which part is good.

So, I can't see that you have any choice but to say that *any* of the
precision predictions should expect, on average, to be (10 + 1 + …)
percent inaccurate. And you can't know which ones. Is that an acceptable
error rate?

-- 
 \      “If you don't fail at least 90 percent of the time, you're not |
  `\                                    aiming high enough.” —Alan Kay |
_o__)                                                                  |
Ben Finney

[toc] | [prev] | [next] | [standalone]


#70742

FromChris Angelico <rosuav@gmail.com>
Date2014-04-30 10:17 +1000
Message-ID<mailman.9592.1398817083.18130.python-list@python.org>
In reply to#70739
On Wed, Apr 30, 2014 at 10:13 AM, Ben Finney <ben@benfinney.id.au> wrote:
> The problem is you won't know *which* 90% is accurate, and which 10% is
> inaccurate. This is very different from the glass, where it's evident
> which part is good.
>
> So, I can't see that you have any choice but to say that *any* of the
> precision predictions should expect, on average, to be (10 + 1 + …)
> percent inaccurate. And you can't know which ones. Is that an acceptable
> error rate?

But they're all going to be *at least* as accurate as the algorithm
says. A figure of 31.4 will be treated as 1 decimal, even though it
might really have been accurate to 4; but a figure of 27.1828 won't be
incorrectly reported as having only 2 decimals.

ChrisA

[toc] | [prev] | [next] | [standalone]


#70743

FromBen Finney <ben@benfinney.id.au>
Date2014-04-30 10:20 +1000
Message-ID<mailman.9593.1398817242.18130.python-list@python.org>
In reply to#70739
Ben Finney <ben@benfinney.id.au> writes:

> The problem is you won't know *which* 90% is accurate, and which 10% is
> inaccurate. This is very different from the glass, where it's evident
> which part is good.

Hmm. Re-reading the suggestion, I see that it is fairly predictable
which estimates of precision will be inaccurate: the ones which end in
explicit zeroes are more uncertain in their intended precision.

-- 
 \     “[F]reedom of speech does not entail freedom to have your ideas |
  `\    accepted by governments and incorporated into law and policy.” |
_o__)                                   —Russell Blackford, 2010-03-06 |
Ben Finney

[toc] | [prev] | [next] | [standalone]


#70786

FromGrant Edwards <invalid@invalid.invalid>
Date2014-04-30 18:19 +0000
Message-ID<ljreqm$hte$2@reader1.panix.com>
In reply to#70739
On 2014-04-29, Roy Smith <roy@panix.com> wrote:
> In article <mailman.9575.1398789020.18130.python-list@python.org>,
>  Chris Angelico <rosuav@gmail.com> wrote:
>
>> On Tue, Apr 29, 2014 at 11:38 PM, Roy Smith <roy@panix.com> wrote:
>> > I'm trying to intuit, from the values I've been given, which coordinates
>> > are likely to be accurate to within a few miles.  I'm willing to accept
>> > a few false negatives.  If the number is float("38"), I'm willing to
>> > accept that it might actually be float("38.0000"), and I might be
>> > throwing out a good data point that I don't need to.
>> 
>> You have one chance in ten, repeatably, of losing a digit. That is,
>> roughly 10% of your four-decimal figures will appear to be
>> three-decimal, and 1% of them will appear to be two-decimal, and so
>> on. Is that "a few" false negatives?
>
> You're looking at it the wrong way.  It's not that the glass is 10% 
> empty, it's that it's 90% full, and 90% is a lot of good data :-)

If you know _which_ is the good data and which is the bad...

-- 
Grant Edwards               grant.b.edwards        Yow! I'm sitting on my
                                  at               SPEED QUEEN ... To me,
                              gmail.com            it's ENJOYABLE ... I'm WARM
                                                   ... I'm VIBRATORY ...

[toc] | [prev] | [next] | [standalone]


#70720

FromNed Batchelder <ned@nedbatchelder.com>
Date2014-04-29 12:47 -0400
Message-ID<mailman.9577.1398790058.18130.python-list@python.org>
In reply to#70713
On 4/29/14 12:30 PM, Chris Angelico wrote:
> On Tue, Apr 29, 2014 at 11:38 PM, Roy Smith <roy@panix.com> wrote:
>> I'm trying to intuit, from the values I've been given, which coordinates
>> are likely to be accurate to within a few miles.  I'm willing to accept
>> a few false negatives.  If the number is float("38"), I'm willing to
>> accept that it might actually be float("38.0000"), and I might be
>> throwing out a good data point that I don't need to.
>
> You have one chance in ten, repeatably, of losing a digit. That is,
> roughly 10% of your four-decimal figures will appear to be
> three-decimal, and 1% of them will appear to be two-decimal, and so
> on. Is that "a few" false negatives? It feels like a lot IMO. But
> then, there's no alternative - the information's already gone.
>

Reminds me of the story that the first survey of Mt. Everest resulted in 
a height of exactly 29,000 feet, but to avoid the appearance of an 
estimate, they reported it as 29,002: http://www.jstor.org/stable/2684102

-- 
Ned Batchelder, http://nedbatchelder.com

[toc] | [prev] | [next] | [standalone]


#70734

FromGregory Ewing <greg.ewing@canterbury.ac.nz>
Date2014-04-30 09:45 +1200
Message-ID<bsaks3F71ugU1@mid.individual.net>
In reply to#70720
Ned Batchelder wrote:
> Reminds me of the story that the first survey of Mt. Everest resulted in 
> a height of exactly 29,000 feet, but to avoid the appearance of an 
> estimate, they reported it as 29,002: http://www.jstor.org/stable/2684102

They could have said it was 29.000 kilofeet.

-- 
Greg

[toc] | [prev] | [next] | [standalone]


#70721

FromChris Angelico <rosuav@gmail.com>
Date2014-04-30 02:59 +1000
Message-ID<mailman.9578.1398790794.18130.python-list@python.org>
In reply to#70713
On Wed, Apr 30, 2014 at 2:47 AM, Ned Batchelder <ned@nedbatchelder.com> wrote:
> Reminds me of the story that the first survey of Mt. Everest resulted in a
> height of exactly 29,000 feet, but to avoid the appearance of an estimate,
> they reported it as 29,002: http://www.jstor.org/stable/2684102

Yeah. Exactly the same phenomenon as I was referring to earlier when I
said that you never tell someone you need to leave in five minutes -
if you say six minutes, you'll be away sooner.

ChrisA

[toc] | [prev] | [next] | [standalone]


#70729

FromAdam Funk <a24061@ducksburg.com>
Date2014-04-29 21:16 +0100
Message-ID<8td53bxud5.ln2@news.ducksburg.com>
In reply to#70713
On 2014-04-29, Roy Smith wrote:

> Another possibility is that they're latitude/longitude coordinates, some 
> of which are given to the whole degree, some of which are given to 
> greater precision, all the way down to the ten-thousandth of a degree.

That makes sense.  1° of longitude is about 111 km at the equator,
78 km at 45°N or S, & 0 km at the poles.


"A man pitches his tent, walks 1 km south, walks 1 km east, kills a
bear, & walks 1 km north, where he's back at his tent.  What color is
the bear?"  ;-)


-- 
War is God's way of teaching Americans geography.
                                 [Ambrose Bierce]

[toc] | [prev] | [next] | [standalone]


#70730

FromMark H Harris <harrismh777@gmail.com>
Date2014-04-29 15:39 -0500
Message-ID<ljp2l8$ujp$1@speranza.aioe.org>
In reply to#70729
On 4/29/14 3:16 PM, Adam Funk wrote:
> "A man pitches his tent, walks 1 km south, walks 1 km east, kills a
> bear, & walks 1 km north, where he's back at his tent.  What color is
> the bear?"  ;-)
>

Who manufactured the tent?


marcus

[toc] | [prev] | [next] | [standalone]


Page 2 of 4 — ← Prev page 1 [2] 3 4  Next page →

Back to top | Article view | comp.lang.python


csiph-web