Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39480
| From | "Schizoid Man" <schiz_man@21stcentury.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Confusing math problem |
| Date | 2013-02-21 22:44 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <kg67ul$d4v$1@dont-email.me> (permalink) |
| References | <kg5sog$lfb$1@dont-email.me> <mailman.2193.1361479569.2939.python-list@python.org> |
"Chris Angelico" <rosuav@gmail.com> wrote in <snip> > First, are you aware that ** will return int (or sometimes long on > 2.7.3), while math.pow() will return a float? That may tell you why > you're seeing differences. That said, though, I wasn't able to > replicate your result using 2.7.3 and 3.3.0 both on Windows - always > 9183, indicating 618 of the powers are considered equal. But in > theory, at least, what you're seeing is that 37 of them compare > different in floating point on your Mac build. Something to consider: > > print(set(result1)-set(result2)) No, I was aware to be honest. I thought ** was just short hand for math.pow(). Since ** is the integer operation, I suppose ^ doesn't work as an exponent function in Python? I compared the difference and got a large blob of numbers. To make a proper comparison I'll need to compare the base and exponent for which the numbers are different rather than the numbers themselves. I'm following Dave's suggestion of determining the symmetric difference of the sets. Thanks for the help.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Confusing math problem "Schizoid Man" <schiz_man@21stcentury.com> - 2013-02-21 19:33 +0000
Re: Confusing math problem Dave Angel <davea@davea.name> - 2013-02-21 15:25 -0500
Re: Confusing math problem "Schizoid Man" <schiz_man@21stcentury.com> - 2013-02-21 22:39 +0000
Re: Confusing math problem Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-21 22:53 +0000
Re: Confusing math problem "Schizoid Man" <schiz_man@21stcentury.com> - 2013-02-21 23:41 +0000
Re: Confusing math problem Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-22 00:04 +0000
Re: Confusing math problem Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-21 17:19 -0700
Re: Confusing math problem "Schizoid Man" <schiz_man@21stcentury.com> - 2013-02-21 23:39 +0000
Re: Confusing math problem Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-21 13:42 -0700
Re: Confusing math problem Chris Angelico <rosuav@gmail.com> - 2013-02-22 07:46 +1100
Re: Confusing math problem "Schizoid Man" <schiz_man@21stcentury.com> - 2013-02-21 22:44 +0000
Re: Confusing math problem Chris Angelico <rosuav@gmail.com> - 2013-02-22 11:29 +1100
Re: Confusing math problem Dave Angel <davea@davea.name> - 2013-02-21 21:19 -0500
Re: Confusing math problem Dave Angel <davea@davea.name> - 2013-02-21 15:49 -0500
Re: Confusing math problem Chris Angelico <rosuav@gmail.com> - 2013-02-22 08:23 +1100
Re: Confusing math problem Peter Pearson <ppearson@nowhere.invalid> - 2013-02-21 21:59 +0000
Re: Confusing math problem Chris Angelico <rosuav@gmail.com> - 2013-02-22 09:11 +1100
Re: Confusing math problem Dave Angel <davea@davea.name> - 2013-02-21 17:33 -0500
Re: Confusing math problem Chris Angelico <rosuav@gmail.com> - 2013-02-22 10:15 +1100
Re: Confusing math problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-22 09:16 +0000
Re: Confusing math problem Serhiy Storchaka <storchaka@gmail.com> - 2013-02-22 13:48 +0200
Re: Confusing math problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-22 09:27 +0000
csiph-web