[issue11967] Left shift and Right shift for floats

2011-05-02 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Ok, I'm closing this as won't fix. Mark is our authority on these matters, and 
having two spellings for this fairly uncommon operation seems enough.

--
resolution:  - wont fix
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11967] Left shift and Right shift for floats

2011-05-02 Thread Raymond Hettinger

Raymond Hettinger raymond.hettin...@gmail.com added the comment:

A hint that the idea would be useful is that there is an FPU instruction, 
FSCALE, devoted to this.  However, a hint that this isn't needed is that 
Fortran and MATLAB don't have it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11967] Left shift and Right shift for floats

2011-05-02 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11967] Left shift and Right shift for floats

2011-05-01 Thread Daniel Urban

Changes by Daniel Urban urban.dani...@gmail.com:


--
nosy: +durban

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11967] Left shift and Right shift for floats

2011-05-01 Thread Eric V. Smith

Changes by Eric V. Smith e...@trueblade.com:


--
nosy: +eric.smith

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11967] Left shift and Right shift for floats

2011-05-01 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

The only way ... That's not true. y=x*(1n) is also an exact multiplication 
with a power of two, and it's also fairly fast. Likewise for y=x/(1n).

--
nosy: +loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11967] Left shift and Right shift for floats

2011-05-01 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Would you want x  2 to be equivalent to x / 4.0 or x // 4.0?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11967] Left shift and Right shift for floats

2011-05-01 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

 The only way to do that now is t=frexp(x) and y=ldexp(t[0],t[1]+2).

What's wrong with the more direct ldexp(x, 2)?

N.B.  There *are* edge cases where Martin's suggested alternative won't work.  
E.g., to compute 1e-300 * 2**1500:

 ldexp(1e-300, 1500)
3.507466211043404e+151

But:

 1e-300 * (1  1500)
Traceback (most recent call last):
  File stdin, line 1, in module
OverflowError: long int too large to convert to float

I'm -1 on the proposal:  I recognise the need for these operations, but I think 
'ldexp(x, n)' gives an adequate solution.  Fitting the functionality to the  
and  operators is awkward, because that's not what those operators do for 
integers ( produces the *floor* of the quotient, and  doesn't currently 
accept negative arguments on the right, so there's no neat way for integers to 
divide by a power of 2).

See also the rejected issue 1205239.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11967] Left shift and Right shift for floats

2011-04-30 Thread David Albert Torpey

New submission from David Albert Torpey dt...@users.sourceforge.net:

I would like to left and right shift floats as a fast way to multiply or divide 
by a power of 2 without rounding error.  The only way to do that now is 
t=frexp(x) and y=ldexp(t[0],t[1]+2).  But would be better to type y=x2.  
Thank you.

--
messages: 134897
nosy: dtorp
priority: normal
severity: normal
status: open
title: Left shift and Right shift for floats
versions: Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11967] Left shift and Right shift for floats

2011-04-30 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +mark.dickinson

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11967] Left shift and Right shift for floats

2011-04-30 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
components: +Interpreter Core
nosy: +rhettinger
type:  - feature request

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com