From f71d202628824c451f7783fdad0f5d7477745620 Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Tue, 13 Feb 2024 14:57:50 +0530
Subject: [PATCH 01/20] Fix for issue #57268 - ENH: Preserve input start/end
 type in interval_range

---
 pandas/core/indexes/interval.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py
index 46d1ee49c22a0..68e47639178d4 100644
--- a/pandas/core/indexes/interval.py
+++ b/pandas/core/indexes/interval.py
@@ -1120,10 +1120,12 @@ def interval_range(
             # error: Argument 1 to "maybe_downcast_numeric" has incompatible type
             # "Union[ndarray[Any, Any], TimedeltaIndex, DatetimeIndex]";
             # expected "ndarray[Any, Any]"  [
+            dtype = start.dtype if start.dtype == end.dtype else np.dtype("int64")
             breaks = maybe_downcast_numeric(
                 breaks,  # type: ignore[arg-type]
-                np.dtype("int64"),
+                dtype,
             )
+            return IntervalIndex.from_breaks(breaks, name=name, closed=closed, dtype=IntervalDtype(subtype=dtype, closed=closed))
     else:
         # delegate to the appropriate range function
         if isinstance(endpoint, Timestamp):

From ddbc2cd10232203667a4d4ebecd428368036643a Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Tue, 13 Feb 2024 17:19:49 +0530
Subject: [PATCH 02/20] issue #57268 - github actions resolution

---
 pandas/core/indexes/interval.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py
index 68e47639178d4..009ea17d36060 100644
--- a/pandas/core/indexes/interval.py
+++ b/pandas/core/indexes/interval.py
@@ -1120,10 +1120,13 @@ def interval_range(
             # error: Argument 1 to "maybe_downcast_numeric" has incompatible type
             # "Union[ndarray[Any, Any], TimedeltaIndex, DatetimeIndex]";
             # expected "ndarray[Any, Any]"  [
-            dtype = start.dtype if start.dtype == end.dtype else np.dtype("int64")
+            if isinstance(start, int) or isinstance(end, int):
+                dtype = np.dtype("int64")
+            else:
+                dtype = start.dtype if start.dtype == end.dtype else np.dtype("int64")
             breaks = maybe_downcast_numeric(
                 breaks,  # type: ignore[arg-type]
-                dtype,
+                dtype
             )
             return IntervalIndex.from_breaks(breaks, name=name, closed=closed, dtype=IntervalDtype(subtype=dtype, closed=closed))
     else:

From 0462b08fdd437785071f8e8e156802d38c60a529 Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Tue, 13 Feb 2024 18:54:53 +0530
Subject: [PATCH 03/20] Use generated datatype from breaks

---
 pandas/core/indexes/interval.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py
index 009ea17d36060..e023fdc99cc53 100644
--- a/pandas/core/indexes/interval.py
+++ b/pandas/core/indexes/interval.py
@@ -1127,8 +1127,8 @@ def interval_range(
             breaks = maybe_downcast_numeric(
                 breaks,  # type: ignore[arg-type]
                 dtype
-            )
-            return IntervalIndex.from_breaks(breaks, name=name, closed=closed, dtype=IntervalDtype(subtype=dtype, closed=closed))
+            )        
+            return IntervalIndex.from_breaks(breaks, name=name, closed=closed, dtype=IntervalDtype(subtype=breaks.dtype, closed=closed))
     else:
         # delegate to the appropriate range function
         if isinstance(endpoint, Timestamp):

From f1afeec3fa485a1a439cb6e4488360e5ed1cb47e Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Tue, 13 Feb 2024 19:37:35 +0530
Subject: [PATCH 04/20] Ruff - Pre-commit issue fix

---
 pandas/core/indexes/interval.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py
index e023fdc99cc53..6e58aeb34da75 100644
--- a/pandas/core/indexes/interval.py
+++ b/pandas/core/indexes/interval.py
@@ -1126,9 +1126,14 @@ def interval_range(
                 dtype = start.dtype if start.dtype == end.dtype else np.dtype("int64")
             breaks = maybe_downcast_numeric(
                 breaks,  # type: ignore[arg-type]
-                dtype
-            )        
-            return IntervalIndex.from_breaks(breaks, name=name, closed=closed, dtype=IntervalDtype(subtype=breaks.dtype, closed=closed))
+                dtype,
+            )
+            return IntervalIndex.from_breaks(
+                breaks,
+                name=name,
+                closed=closed,
+                dtype=IntervalDtype(subtype=breaks.dtype, closed=closed),
+            )
     else:
         # delegate to the appropriate range function
         if isinstance(endpoint, Timestamp):

From a1e23230cb998129b9474a7aa5de8fbc6b99bd3c Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Wed, 14 Feb 2024 00:25:12 +0530
Subject: [PATCH 05/20] Fix for issue #57268 - floating point support

---
 pandas/core/indexes/interval.py | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py
index 6e58aeb34da75..0f8e2458df7ac 100644
--- a/pandas/core/indexes/interval.py
+++ b/pandas/core/indexes/interval.py
@@ -1103,7 +1103,13 @@ def interval_range(
     if is_number(endpoint):
         if com.all_not_none(start, end, freq):
             # 0.1 ensures we capture end
-            breaks = np.arange(start, end + (freq * 0.1), freq)
+            if isinstance(start, float | np.float16) or isinstance(
+                end, float | np.float16
+            ):
+                dtype = np.dtype("float64")
+            else:
+                dtype = start.dtype if start.dtype == end.dtype else np.dtype("float64")
+            breaks = np.arange(start, end + (freq * 0.1), freq, dtype=dtype)
         else:
             # compute the period/start/end if unspecified (at most one)
             if periods is None:
@@ -1128,12 +1134,6 @@ def interval_range(
                 breaks,  # type: ignore[arg-type]
                 dtype,
             )
-            return IntervalIndex.from_breaks(
-                breaks,
-                name=name,
-                closed=closed,
-                dtype=IntervalDtype(subtype=breaks.dtype, closed=closed),
-            )
     else:
         # delegate to the appropriate range function
         if isinstance(endpoint, Timestamp):
@@ -1141,4 +1141,9 @@ def interval_range(
         else:
             breaks = timedelta_range(start=start, end=end, periods=periods, freq=freq)
 
-    return IntervalIndex.from_breaks(breaks, name=name, closed=closed)
+    return IntervalIndex.from_breaks(
+        breaks,
+        name=name,
+        closed=closed,
+        dtype=IntervalDtype(subtype=breaks.dtype, closed=closed),
+    )

From cc2a1d672d598ba003758571b948ba1760083daa Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Wed, 14 Feb 2024 01:19:55 +0530
Subject: [PATCH 06/20] int - float dtype compatability

---
 pandas/core/indexes/interval.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py
index 0f8e2458df7ac..32fdd8d89eabf 100644
--- a/pandas/core/indexes/interval.py
+++ b/pandas/core/indexes/interval.py
@@ -1102,13 +1102,19 @@ def interval_range(
 
     if is_number(endpoint):
         if com.all_not_none(start, end, freq):
-            # 0.1 ensures we capture end
             if isinstance(start, float | np.float16) or isinstance(
                 end, float | np.float16
             ):
                 dtype = np.dtype("float64")
+            elif isinstance(start, int) or isinstance(end, int):
+                dtype = np.dtype("int64")
+            elif np.issubdtype(start.dtype, np.integer) or np.issubdtype(
+                end.dtype, np.integer
+            ):
+                dtype = start.dtype if start.dtype == end.dtype else np.dtype("int64")
             else:
                 dtype = start.dtype if start.dtype == end.dtype else np.dtype("float64")
+            # 0.1 ensures we capture end
             breaks = np.arange(start, end + (freq * 0.1), freq, dtype=dtype)
         else:
             # compute the period/start/end if unspecified (at most one)
@@ -1126,10 +1132,6 @@ def interval_range(
             # error: Argument 1 to "maybe_downcast_numeric" has incompatible type
             # "Union[ndarray[Any, Any], TimedeltaIndex, DatetimeIndex]";
             # expected "ndarray[Any, Any]"  [
-            if isinstance(start, int) or isinstance(end, int):
-                dtype = np.dtype("int64")
-            else:
-                dtype = start.dtype if start.dtype == end.dtype else np.dtype("int64")
             breaks = maybe_downcast_numeric(
                 breaks,  # type: ignore[arg-type]
                 dtype,

From 81e7a5e870fc0d1c758adabd4bc2ccb846ff6d15 Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Wed, 14 Feb 2024 01:20:14 +0530
Subject: [PATCH 07/20] whatsnew documentation update

---
 doc/source/whatsnew/v3.0.0.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/source/whatsnew/v3.0.0.rst b/doc/source/whatsnew/v3.0.0.rst
index 0758d58ed3912..3a6a279b1c3fa 100644
--- a/doc/source/whatsnew/v3.0.0.rst
+++ b/doc/source/whatsnew/v3.0.0.rst
@@ -31,7 +31,7 @@ Other enhancements
 - :func:`DataFrame.to_excel` now raises an ``UserWarning`` when the character count in a cell exceeds Excel's limitation of 32767 characters (:issue:`56954`)
 - :func:`read_stata` now returns ``datetime64`` resolutions better matching those natively stored in the stata format (:issue:`55642`)
 - Allow dictionaries to be passed to :meth:`pandas.Series.str.replace` via ``pat`` parameter (:issue:`51748`)
--
+- :func:`interval_range` Preserves start/end data types
 
 .. ---------------------------------------------------------------------------
 .. _whatsnew_300.notable_bug_fixes:

From 3265f532390e6e5a7bf51dac1925d6da6183cd54 Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Wed, 14 Feb 2024 01:42:44 +0530
Subject: [PATCH 08/20] OS based varaible access

---
 pandas/core/indexes/interval.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py
index 32fdd8d89eabf..64ee09e7fdd68 100644
--- a/pandas/core/indexes/interval.py
+++ b/pandas/core/indexes/interval.py
@@ -1101,6 +1101,7 @@ def interval_range(
     breaks: np.ndarray | TimedeltaIndex | DatetimeIndex
 
     if is_number(endpoint):
+        dtype = np.dtype("int64")
         if com.all_not_none(start, end, freq):
             if isinstance(start, float | np.float16) or isinstance(
                 end, float | np.float16

From 41ea0fa93dde72682cfd9152ebd1e0085a5b9502 Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Wed, 14 Feb 2024 02:11:39 +0530
Subject: [PATCH 09/20] Fixing failed unit test cases

---
 pandas/core/indexes/interval.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py
index 64ee09e7fdd68..e8777e575fe90 100644
--- a/pandas/core/indexes/interval.py
+++ b/pandas/core/indexes/interval.py
@@ -1101,7 +1101,6 @@ def interval_range(
     breaks: np.ndarray | TimedeltaIndex | DatetimeIndex
 
     if is_number(endpoint):
-        dtype = np.dtype("int64")
         if com.all_not_none(start, end, freq):
             if isinstance(start, float | np.float16) or isinstance(
                 end, float | np.float16
@@ -1135,7 +1134,7 @@ def interval_range(
             # expected "ndarray[Any, Any]"  [
             breaks = maybe_downcast_numeric(
                 breaks,  # type: ignore[arg-type]
-                dtype,
+                breaks.dtype,
             )
     else:
         # delegate to the appropriate range function

From baf1dd9033a75914d2c01815950350935d82ece4 Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Wed, 14 Feb 2024 03:44:18 +0530
Subject: [PATCH 10/20] pytest - interval passsed

---
 pandas/core/indexes/interval.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py
index e8777e575fe90..2565f8fadf494 100644
--- a/pandas/core/indexes/interval.py
+++ b/pandas/core/indexes/interval.py
@@ -1101,21 +1101,25 @@ def interval_range(
     breaks: np.ndarray | TimedeltaIndex | DatetimeIndex
 
     if is_number(endpoint):
+        dtype = np.dtype("int64")
         if com.all_not_none(start, end, freq):
-            if isinstance(start, float | np.float16) or isinstance(
-                end, float | np.float16
+            if (
+                isinstance(start, float | np.float16)
+                or isinstance(end, float | np.float16)
+                or isinstance(freq, float | np.float16)
             ):
                 dtype = np.dtype("float64")
             elif isinstance(start, int) or isinstance(end, int):
                 dtype = np.dtype("int64")
-            elif np.issubdtype(start.dtype, np.integer) or np.issubdtype(
+            elif np.issubdtype(start.dtype, np.integer) and np.issubdtype(
                 end.dtype, np.integer
             ):
                 dtype = start.dtype if start.dtype == end.dtype else np.dtype("int64")
             else:
                 dtype = start.dtype if start.dtype == end.dtype else np.dtype("float64")
             # 0.1 ensures we capture end
-            breaks = np.arange(start, end + (freq * 0.1), freq, dtype=dtype)
+            breaks = np.arange(start, end + (freq * 0.1), freq)
+            breaks = maybe_downcast_numeric(breaks, dtype)
         else:
             # compute the period/start/end if unspecified (at most one)
             if periods is None:
@@ -1134,7 +1138,7 @@ def interval_range(
             # expected "ndarray[Any, Any]"  [
             breaks = maybe_downcast_numeric(
                 breaks,  # type: ignore[arg-type]
-                breaks.dtype,
+                dtype,
             )
     else:
         # delegate to the appropriate range function

From ce469d87738d7d3204561087a99d815ed8872cf1 Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Wed, 14 Feb 2024 04:55:30 +0530
Subject: [PATCH 11/20] Python backwards compatability

---
 pandas/core/indexes/interval.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py
index 2565f8fadf494..0b473b88c6b4c 100644
--- a/pandas/core/indexes/interval.py
+++ b/pandas/core/indexes/interval.py
@@ -1104,9 +1104,12 @@ def interval_range(
         dtype = np.dtype("int64")
         if com.all_not_none(start, end, freq):
             if (
-                isinstance(start, float | np.float16)
-                or isinstance(end, float | np.float16)
-                or isinstance(freq, float | np.float16)
+                isinstance(start, float)
+                or isinstance(start, np.float16)
+                or isinstance(end, float)
+                or isinstance(end, np.float16)
+                or isinstance(freq, float)
+                or isinstance(freq, np.float16)
             ):
                 dtype = np.dtype("float64")
             elif isinstance(start, int) or isinstance(end, int):

From 4d70ec18aba493366c7fb15c2d4fbfb710b91ded Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Wed, 14 Feb 2024 04:56:24 +0530
Subject: [PATCH 12/20] Pytest

---
 .../indexes/interval/test_interval_range.py   | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/pandas/tests/indexes/interval/test_interval_range.py b/pandas/tests/indexes/interval/test_interval_range.py
index e8de59f84bcc6..7649a9882c8e8 100644
--- a/pandas/tests/indexes/interval/test_interval_range.py
+++ b/pandas/tests/indexes/interval/test_interval_range.py
@@ -220,6 +220,27 @@ def test_float_subtype(self, start, end, freq):
         expected = "int64" if is_integer(start + end) else "float64"
         assert result == expected
 
+    @pytest.mark.parametrize(
+        "iteration, start, end",
+        [
+            (0, np.int8(1), np.int8(10)),
+            (1, np.int8(1), np.float16(10)),
+            (2, np.float32(1), np.float32(10)),
+            (3, 1, 10),
+            (4, 1, 10.0),
+        ],
+    )
+    def test_interval_dtype(self, iteration, start, end):
+        result = interval_range(start=start, end=end).dtype.subtype
+        expected = [
+            np.dtype("int8"),
+            np.dtype("float64"),
+            np.dtype("float32"),
+            np.dtype("int64"),
+            np.dtype("float64"),
+        ]
+        assert result == expected[iteration]
+
     def test_interval_range_fractional_period(self):
         # float value for periods
         expected = interval_range(start=0, periods=10)

From b9b9838a5e8d24f78f0f431f4410ab1cbb27d352 Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Wed, 14 Feb 2024 10:57:01 +0530
Subject: [PATCH 13/20] Fixing PyLint and mypy issues

---
 pandas/core/indexes/interval.py | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py
index 0b473b88c6b4c..24419432a284d 100644
--- a/pandas/core/indexes/interval.py
+++ b/pandas/core/indexes/interval.py
@@ -1101,15 +1101,12 @@ def interval_range(
     breaks: np.ndarray | TimedeltaIndex | DatetimeIndex
 
     if is_number(endpoint):
-        dtype = np.dtype("int64")
+        dtype: Any = np.dtype("int64")
         if com.all_not_none(start, end, freq):
             if (
-                isinstance(start, float)
-                or isinstance(start, np.float16)
-                or isinstance(end, float)
-                or isinstance(end, np.float16)
-                or isinstance(freq, float)
-                or isinstance(freq, np.float16)
+                isinstance(start, (float, np.float16))
+                or isinstance(end, (float, np.float16))
+                or isinstance(freq, (float, np.float16))
             ):
                 dtype = np.dtype("float64")
             elif isinstance(start, int) or isinstance(end, int):

From f66310abdea967dbdc1162a1bad50f297f0a178e Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Wed, 14 Feb 2024 23:54:13 +0530
Subject: [PATCH 14/20] dtype specification

---
 pandas/core/indexes/interval.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py
index 24419432a284d..234627e05d485 100644
--- a/pandas/core/indexes/interval.py
+++ b/pandas/core/indexes/interval.py
@@ -1101,7 +1101,7 @@ def interval_range(
     breaks: np.ndarray | TimedeltaIndex | DatetimeIndex
 
     if is_number(endpoint):
-        dtype: Any = np.dtype("int64")
+        dtype: np.dtype = np.dtype("int64")
         if com.all_not_none(start, end, freq):
             if (
                 isinstance(start, (float, np.float16))

From 7b10fd822e47a4dfdc1e6a7ab9909b9642773134 Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Thu, 15 Feb 2024 00:01:07 +0530
Subject: [PATCH 15/20] Conditional statement simplification

---
 pandas/core/indexes/interval.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py
index 234627e05d485..3e8a1f062c263 100644
--- a/pandas/core/indexes/interval.py
+++ b/pandas/core/indexes/interval.py
@@ -1111,12 +1111,12 @@ def interval_range(
                 dtype = np.dtype("float64")
             elif isinstance(start, int) or isinstance(end, int):
                 dtype = np.dtype("int64")
-            elif np.issubdtype(start.dtype, np.integer) and np.issubdtype(
-                end.dtype, np.integer
+            elif (
+                isinstance(start, (np.integer, np.floating))
+                and isinstance(end, (np.integer, np.floating))
+                and start.dtype == end.dtype
             ):
-                dtype = start.dtype if start.dtype == end.dtype else np.dtype("int64")
-            else:
-                dtype = start.dtype if start.dtype == end.dtype else np.dtype("float64")
+                dtype = start.dtype
             # 0.1 ensures we capture end
             breaks = np.arange(start, end + (freq * 0.1), freq)
             breaks = maybe_downcast_numeric(breaks, dtype)

From e18ea331ac1621c335260cbb082444bc198a4843 Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Thu, 15 Feb 2024 00:02:36 +0530
Subject: [PATCH 16/20] remove redundant code blocks

---
 pandas/core/indexes/interval.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py
index 3e8a1f062c263..85f873fcd62a5 100644
--- a/pandas/core/indexes/interval.py
+++ b/pandas/core/indexes/interval.py
@@ -1109,9 +1109,7 @@ def interval_range(
                 or isinstance(freq, (float, np.float16))
             ):
                 dtype = np.dtype("float64")
-            elif isinstance(start, int) or isinstance(end, int):
-                dtype = np.dtype("int64")
-            elif (
+            if (
                 isinstance(start, (np.integer, np.floating))
                 and isinstance(end, (np.integer, np.floating))
                 and start.dtype == end.dtype

From 2d021bdc9f88d8b4d83869855e52cfc639946687 Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Thu, 15 Feb 2024 00:04:40 +0530
Subject: [PATCH 17/20] Changing whatsnew to interval section

---
 doc/source/whatsnew/v3.0.0.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/source/whatsnew/v3.0.0.rst b/doc/source/whatsnew/v3.0.0.rst
index 1a0785c4ab898..9e75ab6ffbc6b 100644
--- a/doc/source/whatsnew/v3.0.0.rst
+++ b/doc/source/whatsnew/v3.0.0.rst
@@ -31,7 +31,7 @@ Other enhancements
 - :func:`DataFrame.to_excel` now raises an ``UserWarning`` when the character count in a cell exceeds Excel's limitation of 32767 characters (:issue:`56954`)
 - :func:`read_stata` now returns ``datetime64`` resolutions better matching those natively stored in the stata format (:issue:`55642`)
 - Allow dictionaries to be passed to :meth:`pandas.Series.str.replace` via ``pat`` parameter (:issue:`51748`)
-- :func:`interval_range` Preserves start/end data types
+-
 
 .. ---------------------------------------------------------------------------
 .. _whatsnew_300.notable_bug_fixes:
@@ -211,7 +211,7 @@ Strings
 
 Interval
 ^^^^^^^^
--
+- :func:`interval_range` Preserves start/end data types
 -
 
 Indexing

From d9ffa5fbc8733fb1fea52787499ff20351ac0372 Mon Sep 17 00:00:00 2001
From: visweswaran1998 <visweswaran.nagasivam98@gmail.com>
Date: Thu, 15 Feb 2024 01:04:54 +0530
Subject: [PATCH 18/20] Passing expected in parameterize

---
 .../indexes/interval/test_interval_range.py   | 23 +++++++------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/pandas/tests/indexes/interval/test_interval_range.py b/pandas/tests/indexes/interval/test_interval_range.py
index 7649a9882c8e8..7aea481b49221 100644
--- a/pandas/tests/indexes/interval/test_interval_range.py
+++ b/pandas/tests/indexes/interval/test_interval_range.py
@@ -221,25 +221,18 @@ def test_float_subtype(self, start, end, freq):
         assert result == expected
 
     @pytest.mark.parametrize(
-        "iteration, start, end",
+        "start, end, expected",
         [
-            (0, np.int8(1), np.int8(10)),
-            (1, np.int8(1), np.float16(10)),
-            (2, np.float32(1), np.float32(10)),
-            (3, 1, 10),
-            (4, 1, 10.0),
+            (np.int8(1), np.int8(10), np.dtype("int8")),
+            (np.int8(1), np.float16(10), np.dtype("float64")),
+            (np.float32(1), np.float32(10), np.dtype("float32")),
+            (1, 10, np.dtype("int64")),
+            (1, 10.0, np.dtype("float64")),
         ],
     )
-    def test_interval_dtype(self, iteration, start, end):
+    def test_interval_dtype(self, start, end, expected):
         result = interval_range(start=start, end=end).dtype.subtype
-        expected = [
-            np.dtype("int8"),
-            np.dtype("float64"),
-            np.dtype("float32"),
-            np.dtype("int64"),
-            np.dtype("float64"),
-        ]
-        assert result == expected[iteration]
+        assert result == expected
 
     def test_interval_range_fractional_period(self):
         # float value for periods

From d9a7cc42df4a97d496d05daed12fc52d3964df6f Mon Sep 17 00:00:00 2001
From: VISWESWARAN1998 <visweswaran.nagasivam98@gmail.com>
Date: Thu, 15 Feb 2024 09:38:46 +0530
Subject: [PATCH 19/20] Update doc/source/whatsnew/v3.0.0.rst

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
---
 doc/source/whatsnew/v3.0.0.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/source/whatsnew/v3.0.0.rst b/doc/source/whatsnew/v3.0.0.rst
index 9e75ab6ffbc6b..941ad4612b73c 100644
--- a/doc/source/whatsnew/v3.0.0.rst
+++ b/doc/source/whatsnew/v3.0.0.rst
@@ -211,7 +211,7 @@ Strings
 
 Interval
 ^^^^^^^^
-- :func:`interval_range` Preserves start/end data types
+- Bug in :func:`interval_range` where start and end numeric types were always cast to 64 bit (:issue:`57268`)
 -
 
 Indexing

From 940f6401d7d163171139339bf9345e50a01ab6a6 Mon Sep 17 00:00:00 2001
From: VISWESWARAN1998 <visweswaran.nagasivam98@gmail.com>
Date: Thu, 15 Feb 2024 09:39:07 +0530
Subject: [PATCH 20/20] Update pandas/core/indexes/interval.py

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
---
 pandas/core/indexes/interval.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py
index 85f873fcd62a5..7695193a15608 100644
--- a/pandas/core/indexes/interval.py
+++ b/pandas/core/indexes/interval.py
@@ -1109,7 +1109,7 @@ def interval_range(
                 or isinstance(freq, (float, np.float16))
             ):
                 dtype = np.dtype("float64")
-            if (
+            elif (
                 isinstance(start, (np.integer, np.floating))
                 and isinstance(end, (np.integer, np.floating))
                 and start.dtype == end.dtype