diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2020-12-27 17:38:33 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-27 17:38:33 +0000 |
commit | 7059f0680a97434248d9626a318040adf9531626 (patch) | |
tree | 5081f5d136faf8a2ee28d7b83e6a1dd267069617 | |
parent | 9aa658ae3800a06fe61f304ca48a7d99a1ed3799 (diff) | |
download | numpy-7059f0680a97434248d9626a318040adf9531626.tar.gz |
Update doc/source/reference/arrays.scalars.rst
-rw-r--r-- | doc/source/reference/arrays.scalars.rst | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/source/reference/arrays.scalars.rst b/doc/source/reference/arrays.scalars.rst index be7992d83..0e2f4d7b9 100644 --- a/doc/source/reference/arrays.scalars.rst +++ b/doc/source/reference/arrays.scalars.rst @@ -196,6 +196,17 @@ Inexact types ``f16`` prints as ``0.1`` because it is as close to that value as possible, whereas the other types do not as they have more precision and therefore have closer values. + + Conversely, the same value approximated at different precisions may compare + unequal despite printing identically: + + >>> f16 = np.float16("0.1") + >>> f32 = np.float32("0.1") + >>> f64 = np.float64("0.1") + >>> f16 == f32 == f64 + False + >>> f16, f32, f64 + (0.1, 0.1, 0.1) Floating-point types ++++++++++++++++++++ |