Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
5e65cd39
Kaydet (Commit)
5e65cd39
authored
Ock 21, 2017
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #29282: Backed out changeset b33012ef1417
üst
d1b230e4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1 addition
and
104 deletions
+1
-104
math.rst
Doc/library/math.rst
+0
-15
3.7.rst
Doc/whatsnew/3.7.rst
+0
-9
test_math.py
Lib/test/test_math.py
+0
-0
NEWS
Misc/NEWS
+0
-3
mathmodule.c.h
Modules/clinic/mathmodule.c.h
+1
-35
mathmodule.c
Modules/mathmodule.c
+0
-42
No files found.
Doc/library/math.rst
Dosyayı görüntüle @
5e65cd39
...
@@ -57,21 +57,6 @@ Number-theoretic and representation functions
...
@@ -57,21 +57,6 @@ Number-theoretic and representation functions
If *x* is not a float, delegates to ``x.__floor__()``, which should return an
If *x* is not a float, delegates to ``x.__floor__()``, which should return an
:class:`~numbers.Integral` value.
:class:`~numbers.Integral` value.
.. function:: fma(x, y, z)
Fused multiply-add operation. Return ``(x * y) + z``, computed as though with
infinite precision and range followed by a single round to the ``float``
format. This operation often provides better accuracy than the direct
expression ``(x * y) + z``.
This function follows the specification of the fusedMultiplyAdd operation
described in the IEEE 754-2008 standard. The standard leaves one case
implementation-defined, namely the result of ``fma(0, inf, nan)``
and ``fma(inf, 0, nan)``. In these cases, ``math.fma`` returns a NaN,
and does not raise any exception.
.. versionadded:: 3.7
.. function:: fmod(x, y)
.. function:: fmod(x, y)
...
...
Doc/whatsnew/3.7.rst
Dosyayı görüntüle @
5e65cd39
...
@@ -100,15 +100,6 @@ The :const:`~unittest.mock.sentinel` attributes now preserve their identity
...
@@ -100,15 +100,6 @@ The :const:`~unittest.mock.sentinel` attributes now preserve their identity
when they are :mod:`copied <copy>` or :mod:`pickled <pickle>`.
when they are :mod:`copied <copy>` or :mod:`pickled <pickle>`.
(Contributed by Serhiy Storchaka in :issue:`20804`.)
(Contributed by Serhiy Storchaka in :issue:`20804`.)
math module
-----------
A new function :func:`~math.fma` for fused multiply-add operations has been
added. This function computes ``x * y + z`` with only a single round, and so
avoids any intermediate loss of precision. It wraps the ``fma`` function
provided by C99, and follows the specification of the IEEE 754-2008
"fusedMultiplyAdd" operation for special cases.
Optimizations
Optimizations
=============
=============
...
...
Lib/test/test_math.py
Dosyayı görüntüle @
5e65cd39
This diff is collapsed.
Click to expand it.
Misc/NEWS
Dosyayı görüntüle @
5e65cd39
...
@@ -215,9 +215,6 @@ Core and Builtins
...
@@ -215,9 +215,6 @@ Core and Builtins
Library
Library
-------
-------
-
Issue
#
29282
:
Added
new
math
.
fma
function
,
wrapping
C99
's fma
operation.
-
Issue
#
29197
:
Removed
deprecated
function
ntpath
.
splitunc
().
-
Issue
#
29197
:
Removed
deprecated
function
ntpath
.
splitunc
().
-
Issue
#
29210
:
Removed
support
of
deprecated
argument
"exclude"
in
-
Issue
#
29210
:
Removed
support
of
deprecated
argument
"exclude"
in
...
...
Modules/clinic/mathmodule.c.h
Dosyayı görüntüle @
5e65cd39
...
@@ -80,40 +80,6 @@ PyDoc_STRVAR(math_factorial__doc__,
...
@@ -80,40 +80,6 @@ PyDoc_STRVAR(math_factorial__doc__,
#define MATH_FACTORIAL_METHODDEF \
#define MATH_FACTORIAL_METHODDEF \
{"factorial", (PyCFunction)math_factorial, METH_O, math_factorial__doc__},
{"factorial", (PyCFunction)math_factorial, METH_O, math_factorial__doc__},
PyDoc_STRVAR
(
math_fma__doc__
,
"fma($module, x, y, z, /)
\n
"
"--
\n
"
"
\n
"
"Fused multiply-add operation. Compute (x * y) + z with a single round."
);
#define MATH_FMA_METHODDEF \
{"fma", (PyCFunction)math_fma, METH_FASTCALL, math_fma__doc__},
static
PyObject
*
math_fma_impl
(
PyObject
*
module
,
double
x
,
double
y
,
double
z
);
static
PyObject
*
math_fma
(
PyObject
*
module
,
PyObject
**
args
,
Py_ssize_t
nargs
,
PyObject
*
kwnames
)
{
PyObject
*
return_value
=
NULL
;
double
x
;
double
y
;
double
z
;
if
(
!
_PyArg_ParseStack
(
args
,
nargs
,
"ddd:fma"
,
&
x
,
&
y
,
&
z
))
{
goto
exit
;
}
if
(
!
_PyArg_NoStackKeywords
(
"fma"
,
kwnames
))
{
goto
exit
;
}
return_value
=
math_fma_impl
(
module
,
x
,
y
,
z
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
math_trunc__doc__
,
PyDoc_STRVAR
(
math_trunc__doc__
,
"trunc($module, x, /)
\n
"
"trunc($module, x, /)
\n
"
"--
\n
"
"--
\n
"
...
@@ -570,4 +536,4 @@ math_isclose(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna
...
@@ -570,4 +536,4 @@ math_isclose(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna
exit:
exit:
return
return_value
;
return
return_value
;
}
}
/*[clinic end generated code: output=
f428e1075d00c334
input=a9049054013a1b77]*/
/*[clinic end generated code: output=
71806f73a5c4bf0b
input=a9049054013a1b77]*/
Modules/mathmodule.c
Dosyayı görüntüle @
5e65cd39
...
@@ -1595,47 +1595,6 @@ math_factorial(PyObject *module, PyObject *arg)
...
@@ -1595,47 +1595,6 @@ math_factorial(PyObject *module, PyObject *arg)
}
}
/*[clinic input]
math.fma
x: double
y: double
z: double
/
Fused multiply-add operation. Compute (x * y) + z with a single round.
[clinic start generated code]*/
static
PyObject
*
math_fma_impl
(
PyObject
*
module
,
double
x
,
double
y
,
double
z
)
/*[clinic end generated code: output=4fc8626dbc278d17 input=2ae8bb2a6e0f8b77]*/
{
double
r
;
r
=
fma
(
x
,
y
,
z
);
/* Fast path: if we got a finite result, we're done. */
if
(
Py_IS_FINITE
(
r
))
{
return
PyFloat_FromDouble
(
r
);
}
/* Non-finite result. Raise an exception if appropriate, else return r. */
if
(
Py_IS_NAN
(
r
))
{
if
(
!
Py_IS_NAN
(
x
)
&&
!
Py_IS_NAN
(
y
)
&&
!
Py_IS_NAN
(
z
))
{
/* NaN result from non-NaN inputs. */
PyErr_SetString
(
PyExc_ValueError
,
"invalid operation in fma"
);
return
NULL
;
}
}
else
if
(
Py_IS_FINITE
(
x
)
&&
Py_IS_FINITE
(
y
)
&&
Py_IS_FINITE
(
z
))
{
/* Infinite result from finite inputs. */
PyErr_SetString
(
PyExc_OverflowError
,
"overflow in fma"
);
return
NULL
;
}
return
PyFloat_FromDouble
(
r
);
}
/*[clinic input]
/*[clinic input]
math.trunc
math.trunc
...
@@ -2265,7 +2224,6 @@ static PyMethodDef math_methods[] = {
...
@@ -2265,7 +2224,6 @@ static PyMethodDef math_methods[] = {
{
"fabs"
,
math_fabs
,
METH_O
,
math_fabs_doc
},
{
"fabs"
,
math_fabs
,
METH_O
,
math_fabs_doc
},
MATH_FACTORIAL_METHODDEF
MATH_FACTORIAL_METHODDEF
MATH_FLOOR_METHODDEF
MATH_FLOOR_METHODDEF
MATH_FMA_METHODDEF
MATH_FMOD_METHODDEF
MATH_FMOD_METHODDEF
MATH_FREXP_METHODDEF
MATH_FREXP_METHODDEF
MATH_FSUM_METHODDEF
MATH_FSUM_METHODDEF
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment