Repository: pandas-dev/pandas (python)

Issue:
BUG: .corr() values significantly higher than 1
### Pandas version checks

- [x] I have checked that this issue has not already been reported.

- [x] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas.

- [ ] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas.


### Reproducible Example

```python
data = pd.DataFrame(dict(
    x=[0, 1],
    y=[1.35951, 1.3595100000000007]
))
data.corr().max().max()
```

### Issue Description

The example above results in `1.1547005383792517`.

This is similar to https://github.com/pandas-dev/pandas/issues/35135 which was closed as "_not an issue with pandas, but just numerical computations_" but differently to that issue which showed minuscule differences (practically negligible), I am presenting an example where the Pearson correlation is over 15% above the maximum of 1.

I was able to reproduce this on multiple machines.

I think this might warrant a mention in the documentation.

### Expected Behavior

These two are perfectly correlated, so we would expect `1`. `1` is the result for both:
- `(data + 0.0000000000000002).corr().max().max()`
- `(data - 0.0000000000000002).corr().max().max()`

Interestingly, using `corrwith` or R leads to a different result which under-estimates the correlation (but at least is not out of range, and the relative error is smaller!):
- `data[['x']].corrwith(data['y'])` returns `0.948683`
- `cor` in R also returns 0.9486833
```
cor(c(0, 1), c(1.35951, 1.3595100000000007))
[1] 0.9486833
```


### Installed Versions

<details>

```
INSTALLED VERSIONS
------------------
commit                : 0691c5cf90477d3503834d983f69350f250a6ff7
python                : 3.11.4
python-bits           : 64
OS                    : Linux
OS-release            : 6.8.0-55-generic
Version               : #57-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 12 23:42:21 UTC 2025
machine               : x86_64
processor             : x86_64
byteorder             : little
LC_ALL                : None
LANG                  : en_GB.UTF-8
LOCALE                : en_GB.UTF-8

pandas                : 2.2.3
numpy                 : 1.26.3
pytz                  : 2023.3.post1
dateutil              : 2.8.2
pip                   : 23.1.2
Cython                : None
sphinx                : None
IPython               : 9.0.0.dev
adbc-driver-postgresql: None
adbc-driver-sqlite    : None
bs4                   : 4.12.3
blosc                 : None
bottleneck            : None
dataframe-api-compat  : None
fastparquet           : None
fsspec                : None
html5lib              : None
hypothesis            : None
gcsfs                 : None
jinja2                : 3.1.3
lxml.etree            : None
matplotlib            : 3.10.0
numba                 : None
numexpr               : None
odfpy                 : None
openpyxl              : None
pandas_gbq            : None
psycopg2              : None
pymysql               : None
pyarrow               : 15.0.0
pyreadstat            : None
pytest                : 7.4.4
python-calamine       : None
pyxlsb                : None
s3fs                  : None
scipy                 : None
sqlalchemy            : None
tables                : None
tabulate              : None
xarray                : None
xlrd                  : None
xlsxwriter            : None
zstandard             : None
tzdata                : 2023.4
qtpy                  : None
pyqt5                 : None
```

</details>


Pull request:
BUG: Clip corr edge cases between -1.0 and 1.0
Closes #61120 

Clips correlation coefficient in `DataFrame.corr()` between `-1.0` and `1.0`

Adds `test_corr_within_bounds` to ensure coefficient within bounds

- [x] closes #61120 (Replace xxxx with the GitHub issue number)
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Patch:
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 39f52bb3ed..e430681225 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -10,10 +10,8 @@ doc/source/development            @noatamir
 
 # pandas
 pandas/_libs/                     @WillAyd
-pandas/_libs/tslibs/*             @MarcoGorelli
 pandas/_typing.py                 @Dr-Irv
 pandas/core/groupby/*             @rhshadrach
-pandas/core/tools/datetimes.py    @MarcoGorelli
 pandas/io/excel/*                 @rhshadrach
 pandas/io/formats/style.py        @attack68
 pandas/io/formats/style_render.py @attack68
diff --git a/ci/meta.yaml b/ci/meta.yaml
index 9d434991b1..a4c9e8189f 100644
--- a/ci/meta.yaml
+++ b/ci/meta.yaml
@@ -89,4 +89,3 @@ extra:
     - datapythonista
     - phofl
     - lithomas1
-    - marcogorelli
diff --git a/doc/source/whatsnew/v3.0.0.rst b/doc/source/whatsnew/v3.0.0.rst
index da2a9bdada..2b437734a4 100644
--- a/doc/source/whatsnew/v3.0.0.rst
+++ b/doc/source/whatsnew/v3.0.0.rst
@@ -673,6 +673,7 @@ Timezones
 
 Numeric
 ^^^^^^^
+- Bug in :meth:`DataFrame.corr` where numerical precision errors resulted in correlations above ``1.0`` (:issue:`61120`)
 - Bug in :meth:`DataFrame.quantile` where the column type was not preserved when ``numeric_only=True`` with a list-like ``q`` produced an empty result (:issue:`59035`)
 - Bug in ``np.matmul`` with :class:`Index` inputs raising a ``TypeError`` (:issue:`57079`)
 
diff --git a/pandas/_libs/algos.pyx b/pandas/_libs/algos.pyx
index 60ee73ef6b..9dfa4a9486 100644
--- a/pandas/_libs/algos.pyx
+++ b/pandas/_libs/algos.pyx
@@ -353,10 +353,9 @@ def nancorr(const float64_t[:, :] mat, bint cov=False, minp=None):
         float64_t[:, ::1] result
         uint8_t[:, :] mask
         int64_t nobs = 0
-        float64_t vx, vy, dx, dy, meanx, meany, divisor, ssqdmx, ssqdmy, covxy
+        float64_t vx, vy, dx, dy, meanx, meany, divisor, ssqdmx, ssqdmy, covxy, val
 
     N, K = (<object>mat).shape
-
     if minp is None:
         minpv = 1
     else:
@@ -389,8 +388,14 @@ def nancorr(const float64_t[:, :] mat, bint cov=False, minp=None):
                 else:
                     divisor = (nobs - 1.0) if cov else sqrt(ssqdmx * ssqdmy)
 
+                    # clip `covxy / divisor` to ensure coeff is within bounds
                     if divisor != 0:
-                        result[xi, yi] = result[yi, xi] = covxy / divisor
+                        val = covxy / divisor
+                        if val > 1.0:
+                            val = 1.0
+                        elif val < -1.0:
+                            val = -1.0
+                        result[xi, yi] = result[yi, xi] = val
                     else:
                         result[xi, yi] = result[yi, xi] = NaN
 
diff --git a/web/pandas/config.yml b/web/pandas/config.yml
index 890faebc64..679778330b 100644
--- a/web/pandas/config.yml
+++ b/web/pandas/config.yml
@@ -84,7 +84,6 @@ maintainers:
   - alimcmaster1
   - bashtage
   - Dr-Irv
-  - MarcoGorelli
   - rhshadrach
   - phofl
   - attack68
@@ -108,6 +107,7 @@ maintainers:
   - gfyoung
   - mzeitlin11
   - twoertwein
+  - MarcoGorelli
 workgroups:
   coc:
     name: Code of Conduct
@@ -139,7 +139,7 @@ workgroups:
     contact: communications@pandas.pydata.org
     responsibilities: "Share relevant information with the broader community, mainly via our social networks, as well as being the main point of contact between NumFOCUS and the core team."
     members:
-    - Marco Gorelli
+    - datapythonista
 sponsors:
   active:
   - name: "NumFOCUS"
@@ -151,11 +151,6 @@ sponsors:
     logo: static/img/partners/coiled.svg
     kind: partner
     description: "Patrick Hoefler"
-  - name: "Quansight"
-    url: https://quansight.com/
-    logo: static/img/partners/quansight_labs.svg
-    kind: partner
-    description: "Marco Gorelli"
   - name: "Nvidia"
     url: https://www.nvidia.com
     logo: static/img/partners/nvidia.svg
diff --git a/web/pandas/static/img/partners/quansight_labs.svg b/web/pandas/static/img/partners/quansight_labs.svg
deleted file mode 100644
index d49ab1b7d3..0000000000
--- a/web/pandas/static/img/partners/quansight_labs.svg
+++ /dev/null
@@ -1,1 +0,0 @@
-<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 511.28 230.68"><defs><style>.cls-1{fill:#452391;}.cls-2{fill:#99c941;}.cls-3{fill:#973896;}</style></defs><path class="cls-1" d="M41.94,188.52c-2.37.51-7.48,2.71-12.51,5.54h3.46c5-2.71,10-5,14.08-6a15,15,0,0,0,1.62-.46Z"/><path class="cls-1" d="M21.51,200.85s9.82-6.64,19.13-6.73C52.76,194,64,212.43,78.34,212.43c13.42,0,19.3-9.22,22.1-16.83l-.58-.26c-5.22,7.72-10.57,10.32-19.14,10.32-15,0-20-15-40.06-14.73C30.05,191.06,21.41,199.35,21.51,200.85Z"/><path class="cls-1" d="M62.94,178.35c.13-.15.25-.31.37-.46a30.46,30.46,0,0,0,6.35-18.57,27.52,27.52,0,0,0-.42-4.5,30.27,30.27,0,0,0-3.75-10.91l.21.25C61,135.79,52.5,130.1,42.82,129.88h-1.3c-9.69.22-18.18,5.91-22.89,14.28l.21-.25A30.48,30.48,0,0,0,15,155.57a29.28,29.28,0,0,0-.31,3.85c.08,16.05,12.4,29.22,27.41,29.22A26.8,26.8,0,0,0,62.9,178.41ZM39.15,133.72l.38-.05.41,0,.69-.07.35,0,.44,0h1.5l.44,0,.34,0,.69.07.41,0,.38.05.43.08c11.63,2.15,16.16,15,16.16,25.45,0,6.22-1.59,13.22-5.3,18.35h0l-.33.45a16.86,16.86,0,0,1-13.87,6.76,18.31,18.31,0,0,1-2.76-.2c-.63-.05-1.26-.13-1.88-.22A16.13,16.13,0,0,1,32.19,182l.14,0c-6.93-4.77-9.77-14.46-9.77-22.76,0-10.48,4.53-23.3,16.16-25.45Z"/><path class="cls-1" d="M113.62,185.14c0,.43-.44.65-1.32.65H104a1.38,1.38,0,0,1-1.32-.9L101.38,182c-.28-.54-.55-.57-.82-.08q-3.54,4.68-10.27,4.68a10.93,10.93,0,0,1-8.42-3.4c-2.11-2.28-3.16-5.49-3.16-9.66v-16.5a3.43,3.43,0,0,0-2.71-3.7l-1.73-.49c-.87-.28-1.31-.58-1.31-.91s.44-.65,1.31-.65H85.61c.71,0,1.07.19,1.07.57a7.93,7.93,0,0,1-1,1.11c-.69.69-1,2.31-1,4.89v17q0,7.4,7.64,7.39A11.09,11.09,0,0,0,98,180.54c2.14-1.32,3.2-2.88,3.2-4.69v-18.8a3.43,3.43,0,0,0-2.71-3.7l-1.72-.49c-.88-.28-1.32-.58-1.32-.91s.44-.65,1.32-.65h9.61c.76,0,1.12.32,1.07,1l-.33,5.42v22.43a3.27,3.27,0,0,0,2.79,3.61l2.3.49C113.15,184.45,113.62,184.75,113.62,185.14Z"/><path class="cls-1" d="M149.59,185.14c0,.43-.44.65-1.31.65h-8.14a1.52,1.52,0,0,1-1.39-.9l-.66-1.15a1,1,0,0,0-.82-.58,1.9,1.9,0,0,0-1.07.41,17.43,17.43,0,0,1-10.26,3,11,11,0,0,1-7.15-2.21,8.23,8.23,0,0,1-3-6.66q0-5.91,5.67-8.37a31.87,31.87,0,0,1,5.42-1.56c3.07-.72,5.06-1.21,6-1.48,2.9-.88,4.35-2.27,4.35-4.19v-3.21a4.59,4.59,0,0,0-2.63-4.18,10,10,0,0,0-4.84-1.15c-3,0-5.25.65-6.7,2s-2.5,3.53-3.16,6.65a.59.59,0,0,1-.58.41.43.43,0,0,1-.49-.49l-.08-9.86c0-.49.27-.76.82-.82.88-.05,2.6-.25,5.18-.57a41.59,41.59,0,0,1,5.17-.42q6.57,0,9.69,2.55,3.54,3,3.53,9.69V180q0,3.21,2.63,3.7l2.47.49C149.15,184.4,149.59,184.7,149.59,185.14Zm-12.32-7.89v-8.13q0-1.06-.9-.66l-10.76,3.12q-4,1.15-4,4.77,0,7.14,6.41,7.14a11.85,11.85,0,0,0,6.57-1.76A5.21,5.21,0,0,0,137.27,177.25Z"/><path class="cls-1" d="M189.92,185.14c0,.43-.44.65-1.32.65H177.27c-.71,0-1.07-.19-1.07-.57a7.21,7.21,0,0,1,1-1.11c.68-.69,1-2.31,1-4.89v-17q0-7.4-7.63-7.39a11.26,11.26,0,0,0-5.67,1.72q-3.28,2.05-3.29,4.68V180a3.45,3.45,0,0,0,2.71,3.7l1.73.49c.87.28,1.31.58,1.31.91s-.44.65-1.31.65H151.4q-1.32,0-1.32-.57t1.32-1l1.72-.49a3.43,3.43,0,0,0,2.63-3.7V157c0-2.13-.93-3.34-2.79-3.61l-3.37-.49c-.88-.11-1.32-.41-1.32-.91s.44-.65,1.32-.65h9.28a1.36,1.36,0,0,1,1.31.9l1.32,2.87c.27.55.55.58.82.09q3.52-4.68,10.27-4.69a11,11,0,0,1,8.42,3.41q3.15,3.42,3.16,9.65V180a3.44,3.44,0,0,0,2.71,3.7l1.72.49C189.48,184.51,189.92,184.81,189.92,185.14Z"/><path class="cls-1" d="M218.58,176.18q0,10.44-12.73,10.43A43.59,43.59,0,0,1,194.27,185c-.71-.22-1.15-1-1.31-2.38,0-1,0-2-.09-3.08s-.19-2.51-.41-4.31c-.11-.66.08-1,.58-1s.79.3.9.91c1.15,3.28,2.77,5.53,4.85,6.73,1.8,1.1,4.49,1.64,8.05,1.64a8.34,8.34,0,0,0,4.6-1.31,4.68,4.68,0,0,0,2.38-4q0-3.53-5.34-5.83-4.84-2.06-9.78-4.19-5.34-3-5.33-8,0-9.69,11.41-9.7a86.77,86.77,0,0,1,11.17,1c.55.06.82.33.82.82l.17,8.13c0,.66-.17,1-.49,1s-.5-.25-.66-.74q-1.48-4.44-4.11-5.91c-1.53-.88-4-1.32-7.39-1.32q-6.4,0-6.41,4.93,0,2.79,5.34,5.09,9.45,4,10,4.36Q218.58,171,218.58,176.18Z"/><path class="cls-1" d="M242.07,185.22c0,.38-.44.57-1.31.57H223.51q-1.32,0-1.32-.57c0-.5.44-.82,1.32-1l2.54-.49q2.72-.5,2.71-3.7V157q0-3.12-2.71-3.61l-2.79-.49c-.87-.17-1.31-.47-1.31-.91s.44-.65,1.31-.65h10.6c.82,0,1.2.32,1.15,1l-.33,5.42V180c0,2.19.9,3.43,2.71,3.7l3.37.49C241.63,184.34,242.07,184.67,242.07,185.22ZM235,137.74a4.15,4.15,0,0,1-1.43,3.08,4.49,4.49,0,0,1-3.21,1.36,3.42,3.42,0,0,1-2.4-1,3.06,3.06,0,0,1-1-2.34,4.18,4.18,0,0,1,1.38-3.12,4.49,4.49,0,0,1,3.17-1.31Q235,134.46,235,137.74Z"/><path class="cls-1" d="M280.67,154c0,.54-.3.82-.9.82l-8.95.25a11.67,11.67,0,0,1-1.4,16.53A16,16,0,0,1,259,175h-2.38c-3.29,0-4.93,1.06-4.93,3.16q0,2.76,3.45,2.76c.33,0,1.67-.06,4-.17s4.25-.16,5.67-.16c4,0,6.95.63,8.87,1.89q3.38,2.3,3.37,7.8,0,6.74-6.74,10.18a27.43,27.43,0,0,1-12.73,2.72,17.13,17.13,0,0,1-9.11-2.22,8.74,8.74,0,0,1-4.36-7.89q0-5.74,5.42-8.7a4.85,4.85,0,0,1-2-4,5.83,5.83,0,0,1,3.78-5.91c.38-.16.58-.36.58-.57s-.17-.42-.51-.58c-4.86-2.14-7.3-5.69-7.3-10.68a10.82,10.82,0,0,1,4.25-8.83,16.31,16.31,0,0,1,10.52-3.41,18.24,18.24,0,0,1,7.18,1.4l13.7-.57c.6,0,.9.22.9.65Zm-8.21,37.61c0-2.13-.71-3.64-2.14-4.51s-3.86-1.32-7.31-1.32c-1.58,0-3.87,0-6.85.13l-5,.12q-2.55.83-2.55,5,0,3.85,4.35,5.91a18.64,18.64,0,0,0,7.89,1.56Q272.46,198.52,272.46,191.62Zm-4.76-28q0-9.94-9.33-9.94-8.09,0-8.09,8.13a11.06,11.06,0,0,0,2.4,7.47q2.38,2.81,7,2.8a7.56,7.56,0,0,0,5.94-2.3A8.88,8.88,0,0,0,267.7,163.62Z"/><path class="cls-1" d="M319.28,185.14c0,.43-.44.65-1.32.65H306.63c-.72,0-1.07-.19-1.07-.57a7.21,7.21,0,0,1,1-1.11q1-1,1-4.23V162.22q0-7.4-7.64-7.39a10.82,10.82,0,0,0-5.75,1.72q-3.2,2-3.2,4.68V180a3.44,3.44,0,0,0,2.71,3.7l1.73.49c.87.28,1.31.58,1.31.91s-.44.65-1.31.65H280.75c-.87,0-1.31-.19-1.31-.57s.44-.71,1.31-1l1.73-.49a3.43,3.43,0,0,0,2.63-3.7v-42c0-2.13-.91-3.34-2.71-3.61L279,134c-.88-.11-1.31-.41-1.31-.91s.43-.65,1.31-.65H290.2c.82,0,1.2.32,1.15,1l-.33,5.42v16a.39.39,0,0,0,.66.33q3.52-4.68,10.27-4.69a10.92,10.92,0,0,1,8.41,3.41q3.17,3.42,3.17,9.65V180a3.44,3.44,0,0,0,2.71,3.7l1.8.49C318.86,184.56,319.28,184.86,319.28,185.14Z"/><path class="cls-1" d="M343.34,183.71a.51.51,0,0,1-.16.65,11.25,11.25,0,0,1-6.74,1.84q-10.1,0-10.1-7.41V155.4h-6.49c-.55,0-.82-.25-.82-.77v-2.48c0-.57.27-.85.82-.85h4.76q1.39,0,2.22-1.89l3.86-9.2c.22-.49.49-.74.82-.74.5,0,.74.33.74,1V151.3h9.36c.55,0,.83.22.83.65v2.8c0,.43-.25.65-.74.65h-9.45v21.82q0,6.53,5.09,6.52a9.31,9.31,0,0,0,4.77-1.15c.33-.33.6-.3.82.08Z"/><path class="cls-1" d="M396,172.82l-2,12.07a1,1,0,0,1-1.15.9H360.92q-1.32,0-1.32-.57t1.32-1q2.54-.57,2.54-3.69V142.18q0-3.21-2.71-3.61l-3.37-.5c-.87-.11-1.31-.41-1.31-.9s.44-.66,1.31-.66h18.48q1.32,0,1.32.57c0,.5-.44.82-1.32,1l-2.71.49c-1.86.33-2.79,1.55-2.79,3.68v38.63c0,1,.58,1.47,1.73,1.47h10.26c3.95-.05,6.76-1,8.46-2.87q1.89-2,3.37-7.48c.22-.71.6-1.06,1.15-1.06S396.21,171.56,396,172.82Z"/><path class="cls-1" d="M431.47,185.14c0,.43-.44.65-1.32.65H422a1.52,1.52,0,0,1-1.39-.9l-.66-1.15a1,1,0,0,0-.82-.58,1.9,1.9,0,0,0-1.07.41,17.44,17.44,0,0,1-10.27,3,11,11,0,0,1-7.14-2.21,8.23,8.23,0,0,1-3-6.66q0-5.91,5.67-8.37a31.58,31.58,0,0,1,5.42-1.56q4.59-1.08,6-1.48c2.91-.88,4.36-2.27,4.36-4.19v-3.21a4.59,4.59,0,0,0-2.63-4.18,10,10,0,0,0-4.85-1.15c-3,0-5.24.65-6.69,2s-2.51,3.53-3.16,6.65a.59.59,0,0,1-.58.41.43.43,0,0,1-.49-.49l-.08-9.86c0-.49.27-.76.82-.82.87-.05,2.6-.25,5.17-.57a41.72,41.72,0,0,1,5.18-.42q6.57,0,9.69,2.55,3.53,3,3.53,9.69V180q0,3.21,2.63,3.7l2.46.49C431,184.4,431.47,184.7,431.47,185.14Zm-12.32-7.89v-8.13c0-.71-.3-.93-.91-.66l-10.75,3.12q-4,1.15-4,4.77,0,7.14,6.41,7.14a11.85,11.85,0,0,0,6.57-1.76A5.23,5.23,0,0,0,419.15,177.25Z"/><path class="cls-1" d="M465.88,168.79q0,8-4.35,12.9a13.71,13.71,0,0,1-10.68,4.92,26.07,26.07,0,0,1-6.82-.82,23.07,23.07,0,0,0-3.69-.82,5.45,5.45,0,0,0-2.47.44,14.15,14.15,0,0,1-1.56.79c-.65,0-1-.3-1-.9a2,2,0,0,1,.45-.86,2.8,2.8,0,0,0,.45-1.69V138.07c0-2.13-.9-3.34-2.71-3.61l-3.37-.49c-.87-.11-1.31-.41-1.31-.91s.44-.65,1.31-.65h11.17c.83,0,1.21.32,1.15,1l-.32,5.42v15.44c0,.28.1.44.32.5a.58.58,0,0,0,.58-.17,11.68,11.68,0,0,1,8.7-4.11,12.5,12.5,0,0,1,9.86,4.19Q465.89,159.52,465.88,168.79Zm-6.24,0q0-14.08-9.28-14.09-4.61,0-7.64,4.67a3.25,3.25,0,0,0-.57,1.72v14.17q0,4.42,1.8,6.31,1.89,2.13,6.57,2.13a7.52,7.52,0,0,0,6.66-4Q459.64,175.64,459.64,168.75Z"/><path class="cls-1" d="M496.6,176.18q0,10.44-12.73,10.43A43.48,43.48,0,0,1,472.29,185c-.71-.22-1.15-1-1.32-2.38,0-1,0-2-.08-3.08s-.19-2.51-.41-4.31c-.11-.66.08-1,.58-1s.79.3.9.91c1.15,3.28,2.76,5.53,4.85,6.73,1.8,1.1,4.48,1.64,8,1.64a8.31,8.31,0,0,0,4.6-1.31,4.67,4.67,0,0,0,2.39-4q0-3.53-5.34-5.83-4.85-2.06-9.78-4.19-5.34-3-5.34-8,0-9.69,11.42-9.7a86.77,86.77,0,0,1,11.17,1c.55.06.82.33.82.82l.17,8.13c0,.66-.17,1-.5,1s-.49-.25-.65-.74q-1.49-4.44-4.11-5.91c-1.53-.88-4-1.32-7.39-1.32q-6.4,0-6.41,4.93,0,2.79,5.34,5.09,9.45,4,10,4.36Q496.6,171,496.6,176.18Z"/><rect class="cls-1" x="179.9" y="34" width="154.24" height="4.36"/><path class="cls-1" d="M270.14,85.37,270.06,81c1.24,0,3.05,0,5.14,0,4.63,0,11,0,13.71-.28a14.89,14.89,0,0,0,8.51-4c3.41-3.08,5.1-7.06,5.16-12.18,0-1.64,0-3.28,0-4.92,0-2.58,0-5.25.09-7.9a17.67,17.67,0,0,1,17.56-17.56c3.14-.09,6.32-.08,9.4-.07h4v4.36c-1.33,0-2.66,0-4,0-3,0-6.19,0-9.27.07a13.26,13.26,0,0,0-13.32,13.33c-.08,2.58-.08,5.23-.09,7.78,0,1.66,0,3.31,0,5A20.12,20.12,0,0,1,300.34,80a19.34,19.34,0,0,1-10.94,5.06c-3,.34-9.21.33-14.21.31C273.12,85.36,271.33,85.35,270.14,85.37Z"/><path class="cls-1" d="M242.35,85.37c-1.22,0-2.51,0-3.89,0a82.68,82.68,0,0,1-9.55-.31A19.37,19.37,0,0,1,218,80c-4.3-3.88-6.52-9-6.6-15.36,0-1.65,0-3.31,0-5,0-2.56,0-5.2-.08-7.79a13.27,13.27,0,0,0-13.33-13.33c-3.13-.08-8.74-.08-13.24-.07-1.85,0-3.52,0-4.8,0l0-4.36h4.77c4.54,0,10.18,0,13.38.07a17.67,17.67,0,0,1,17.56,17.56c.07,2.65.08,5.32.09,7.91,0,1.64,0,3.28,0,4.91.07,5.12,1.76,9.1,5.17,12.18a14.86,14.86,0,0,0,8.51,4,84.4,84.4,0,0,0,9,.28c1.4,0,2.72,0,4,0Z"/><path class="cls-2" d="M256.86,97.52A14.47,14.47,0,0,1,242.39,82.9a14.26,14.26,0,0,1,14.67-14.32A14.46,14.46,0,0,1,271.33,83.1,14.69,14.69,0,0,1,256.86,97.52Z"/><path class="cls-1" d="M348.8,21.45A14.45,14.45,0,0,1,363.08,36a14.66,14.66,0,0,1-14.45,14.43,14.45,14.45,0,0,1-14.49-14.6A14.27,14.27,0,0,1,348.8,21.45Z"/><path class="cls-3" d="M164.39,20.16A15.75,15.75,0,0,1,179.9,36a16,16,0,0,1-15.78,15.67,15.75,15.75,0,0,1-15.74-16A15.55,15.55,0,0,1,164.39,20.16Z"/><path class="cls-1" d="M256.72,99.43a16.38,16.38,0,0,1,.08-32.76H257a16.37,16.37,0,0,1,16.16,16.45,16.54,16.54,0,0,1-16.38,16.31Zm.08-28.94a12.41,12.41,0,0,0-12.59,12.42,12.59,12.59,0,0,0,3.67,9,12.4,12.4,0,0,0,8.84,3.68v1.91l0-1.91a12.71,12.71,0,0,0,12.57-12.53A12.55,12.55,0,0,0,257,70.49Z"/><path class="cls-1" d="M348.46,52.3a16.13,16.13,0,0,1-11.53-4.8,16.38,16.38,0,0,1-4.79-11.72,16.19,16.19,0,0,1,16.39-16.24h.2A16.34,16.34,0,0,1,364.9,36,16.54,16.54,0,0,1,348.55,52.3Zm.07-28.94A12.41,12.41,0,0,0,336,35.8a12.57,12.57,0,0,0,3.68,9,12.34,12.34,0,0,0,8.82,3.67h.07a12.7,12.7,0,0,0,12.55-12.54,12.51,12.51,0,0,0-12.4-12.58Z"/><path class="cls-1" d="M164,53.59a17.44,17.44,0,0,1-12.46-5.18,17.71,17.71,0,0,1-5.16-12.69,17.49,17.49,0,0,1,17.7-17.47h.24A17.67,17.67,0,0,1,181.72,36,17.85,17.85,0,0,1,164,53.59Zm.08-31.52A13.7,13.7,0,0,0,150.2,35.75a13.89,13.89,0,0,0,4.05,10A13.63,13.63,0,0,0,164,49.77v1.91l0-1.91A14,14,0,0,0,177.9,36,13.59,13.59,0,0,0,174,26.27a13.74,13.74,0,0,0-9.72-4.2Z"/></svg>
\ No newline at end of file


Test patch:
diff --git a/pandas/tests/frame/methods/test_cov_corr.py b/pandas/tests/frame/methods/test_cov_corr.py
index d5e94382b8..6dfbc325aa 100644
--- a/pandas/tests/frame/methods/test_cov_corr.py
+++ b/pandas/tests/frame/methods/test_cov_corr.py
@@ -485,3 +485,15 @@ class TestDataFrameCorrWith:
         result = df_bool.corrwith(ser_bool, min_periods=3)
         expected = Series([0.57735, 0.57735], index=["A", "B"])
         tm.assert_series_equal(result, expected)
+
+    def test_corr_within_bounds(self):
+        df1 = DataFrame({"x": [0, 1], "y": [1.35951, 1.3595100000000007]})
+        result1 = df1.corr().max().max()
+        expected1 = 1.0
+        tm.assert_equal(result1, expected1)
+
+        rng = np.random.default_rng(seed=42)
+        df2 = DataFrame(rng.random((100, 4)))
+        corr_matrix = df2.corr()
+        assert corr_matrix.min().min() >= -1.0
+        assert corr_matrix.max().max() <= 1.0