Re: [Python-ideas] Fused multiply-add (FMA)

2017-01-16 Thread Sven R. Kunze
On 16.01.2017 20:28, Gregory P. Smith wrote: Is there a good reason not to detect single expression multiply adds and just emit a new FMA bytecode? Same question here. ___ Python-ideas mailing list [email protected] https://mail.python.org/m

Re: [Python-ideas] Python dependancies

2017-01-16 Thread Rhodri James
On 16/01/17 18:29, Mathieu TORTUYAUX wrote: Thank you everyone for those feedbacks ! So I made a Django version to check if dependencies are up-to-date, using pip lib and get_outdated method. :) Mathieu, please do not attach images to posts to this list/newsgroup. It is text-only, and some of

Re: [Python-ideas] Fused multiply-add (FMA)

2017-01-16 Thread Gregory P. Smith
Is there a good reason not to detect single expression multiply adds and just emit a new FMA bytecode? Is our goal for floats to strictly match the result of the same operations coded in unoptimized C using doubles? Or can we be more precise on occasion? I guess a similar question may be asked o

Re: [Python-ideas] Fused multiply-add (FMA)

2017-01-16 Thread David Mertz
My understanding is that NumPy does NOT currently support a direct FMA operation "natively." However, higher-level routines like `numpy.linalg.solve` that are linked to MKL or BLAS DO take advantage of FMA within the underlying libraries. On Mon, Jan 16, 2017 at 10:06 AM, Guido van Rossum wrote:

Re: [Python-ideas] Python dependancies

2017-01-16 Thread Mathieu TORTUYAUX
Thank you everyone for those feedbacks ! So I made a Django version to check if dependencies are up-to-date, using pip lib and get_outdated method. :) Le dimanche 15 janvier 2017 00:25:26 UTC-5, Mathieu TORTUYAUX a écrit : > > Hello everyone, > > I'm used to work with python and contribute to

Re: [Python-ideas] Fused multiply-add (FMA)

2017-01-16 Thread Guido van Rossum
Does numpy support this? --Guido (mobile) On Jan 16, 2017 7:27 AM, "Stephan Houben" wrote: > Hi Steve, > > Very good! > Here is a version which also handles the nan's, infinities, > negative zeros properly. > > === > import math > from fractions import Fraction > > def fma2(x, y, z)

Re: [Python-ideas] Fused multiply-add (FMA)

2017-01-16 Thread Stephan Houben
Hi Steve, Very good! Here is a version which also handles the nan's, infinities, negative zeros properly. === import math from fractions import Fraction def fma2(x, y, z): if math.isfinite(x) and math.isfinite(y) and math.isfinite(z): result = float(Fraction(x)*Fraction(y

Re: [Python-ideas] Fused multiply-add (FMA)

2017-01-16 Thread Steven D'Aprano
On Mon, Jan 16, 2017 at 11:01:23AM +0100, Stephan Houben wrote: [...] > So the following would not be a valid FMA fallback > > double bad_fma(double x, double y, double z) { > return x*y + z; > } [...] > Upshot: if we want to provide a software fallback in the Python code, we > need to do somet

Re: [Python-ideas] Fused multiply-add (FMA)

2017-01-16 Thread Stephan Houben
Hi Victor, The fallback implementations in the various libc take care to preserve the correct rounding behaviour. Let me stress that *fused* multiply-add means the specific rounding behaviour as defined in the standard IEEE-754 2008 (i.e. with guaranteed *no* intermediate rounding). So the follo

Re: [Python-ideas] Fused multiply-add (FMA)

2017-01-16 Thread Victor Stinner
2017-01-15 18:25 GMT+01:00 Juraj Sukop : > C99 includes `fma` function to `math.h` [6] and emulates the calculation if > the FMA instruction is not present on the host CPU [7]. If even the libc function has a fallback on x*y followed by +z, it's fine to add such function to the Python stdlib. It m