@@ -1598,6 +1598,14 @@ def luf(lamdaexpr, *args, **kwargs):
15981598 out : bool
15991599 True if cast can occur according to the casting rule.
16001600
1601+ Notes
1602+ -----
1603+ Starting in NumPy 1.9, can_cast function now returns False in 'safe'
1604+ casting mode for integer/float dtype and string dtype if the string dtype
1605+ length is not long enough to store the max integer/float value converted
1606+ to a string. Previously can_cast in 'safe' mode returned True for
1607+ integer/float dtype and a string dtype of any length.
1608+
16011609 See also
16021610 --------
16031611 dtype, result_type
@@ -1618,7 +1626,7 @@ def luf(lamdaexpr, *args, **kwargs):
16181626 >>> np.can_cast('i8', 'f4')
16191627 False
16201628 >>> np.can_cast('i4', 'S4')
1621- True
1629+ False
16221630
16231631 Casting scalars
16241632
@@ -1693,6 +1701,11 @@ def luf(lamdaexpr, *args, **kwargs):
16931701 Notes
16941702 -----
16951703 .. versionadded:: 1.6.0
1704+ Starting in NumPy 1.9, promote_types function now returns a valid string
1705+ length when given an integer or float dtype as one argument and a string
1706+ dtype as another argument. Previously it always returned the input string
1707+ dtype, even if it wasn't long enough to store the max integer/float value
1708+ converted to a string.
16961709
16971710 See Also
16981711 --------
@@ -1709,10 +1722,8 @@ def luf(lamdaexpr, *args, **kwargs):
17091722 >>> np.promote_types('>i8', '<c8')
17101723 dtype('complex128')
17111724
1712- >>> np.promote_types('i1', 'S8')
1713- Traceback (most recent call last):
1714- File "<stdin>", line 1, in <module>
1715- TypeError: invalid type promotion
1725+ >>> np.promote_types('i4', 'S8')
1726+ dtype('S11')
17161727
17171728 """ )
17181729
@@ -3126,6 +3137,13 @@ def luf(lamdaexpr, *args, **kwargs):
31263137 is a new array of the same shape as the input array, with dtype, order
31273138 given by `dtype`, `order`.
31283139
3140+ Notes
3141+ -----
3142+ Starting in NumPy 1.9, astype method now returns an error if the string
3143+ dtype to cast to is not long enough in 'safe' casting mode to hold the max
3144+ value of integer/float array that is being casted. Previously the casting
3145+ was allowed even if the result was truncated.
3146+
31293147 Raises
31303148 ------
31313149 ComplexWarning
0 commit comments