Repository: ManimCommunity/manim

Issue:
`Numberline` elongated ticks do not work for certain float values
## Description of bug / unexpected behavior
<!-- Add a clear and concise description of the problem you encountered. -->
When attempting to specify precisely which ticks were to be elongated in `NumberLine` or `UnitInterval`, I found that some of the ticks specified were not in fact elongated in the output. This is likely due to floating point equality being used to check which ticks should be elongated.

## Expected behavior
<!-- Add a clear and concise description of what you expected to happen. -->
There should be elongated ticks on every tick specified in the argument.

## How to reproduce the issue
<!-- Provide a piece of code illustrating the undesired behavior. -->

<details><summary>Code for reproducing the problem</summary>

```py
from manim import *

class NumberLineBug(Scene):
    def construct(self):
        ui = UnitInterval(numbers_with_elongated_ticks=(
            (0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0)))
        self.add(ui)
```

</details>


## Additional media files
<!-- Paste in the files manim produced on rendering the code above. -->

<details><summary>Images/GIFs</summary>

![NumberLineBug_ManimCE_v0 17 3](https://github.com/ManimCommunity/manim/assets/20744112/e33cabf0-c120-413e-9edd-3fa2227e8999)

</details>


## Logs
<details><summary>Terminal output</summary>
<!-- Add "-v DEBUG" when calling manim to generate more detailed logs -->

```
❯ manim scene.py NumberLineBug --media_dir /mnt/c/Users/narah/Videos/manim -qm -v DEBUG
Manim Community v0.17.3

[10/08/23 16:16:53] INFO                                                                                                            scene_file_writer.py:736
                             File ready at '/mnt/c/Users/narah/Videos/manim/images/scene/NumberLineBug_ManimCE_v0.17.3.png'

                    INFO     Rendered NumberLineBug                                                                                             scene.py:241
                             Played 0 animations

```

<!-- Insert screenshots here (only when absolutely necessary, we prefer copy/pasted output!) -->

</details>


## System specifications

<details><summary>System Details</summary>

- OS: WSL2 (Debian 11, Bullseye) on Windows 11
- RAM: 16GB
- Python version (`python/py/python3 --version`): 3.9.2
- Installed modules (provide output from `pip list`):
```
Package             Version
------------------- ---------
certifi             2023.7.22
charset-normalizer  3.3.0
click               8.1.7
click-default-group 1.2.4
cloup               0.13.1
colour              0.1.5
contourpy           1.1.1
cycler              0.12.1
decorator           5.1.1
fonttools           4.43.1
glcontext           2.4.0
idna                3.4
importlib-resources 6.1.0
isosurfaces         0.1.0
kiwisolver          1.4.5
manim               0.17.3
ManimPango          0.4.4
mapbox-earcut       1.0.1
markdown-it-py      3.0.0
matplotlib          3.8.0
mdurl               0.1.2
moderngl            5.8.2
moderngl-window     2.4.4
multipledispatch    1.0.0
networkx            2.8.8
numpy               1.26.0
packaging           23.2
Pillow              9.5.0
pip                 23.2.1
pkg_resources       0.0.0
pycairo             1.25.0
pydub               0.25.1
pyglet              2.0.9
Pygments            2.16.1
pyparsing           3.1.1
pyrr                0.10.3
python-dateutil     2.8.2
requests            2.31.0
rich                13.6.0
scipy               1.11.3
screeninfo          0.8.1
setuptools          44.1.1
six                 1.16.0
skia-pathops        0.7.4
srt                 3.5.3
svgelements         1.9.6
tqdm                4.66.1
urllib3             2.0.6
watchdog            2.3.1
zipp                3.17.0
```
</details>

<details><summary>LaTeX details</summary>

+ LaTeX distribution: TeX Live 2020/Debian
+ Installed LaTeX packages:
On debian, so `tlmgr` does not work. Almost certainly not relevant for this issue anyway.
<!-- output of `tlmgr list --only-installed` for TeX Live or a screenshot of the Packages page for MikTeX -->
</details>

<details><summary>FFMPEG</summary>

Output of `ffmpeg -version`:

```
ffmpeg version 4.3.6-0+deb11u1 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil      56. 51.100 / 56. 51.100
libavcodec     58. 91.100 / 58. 91.100
libavformat    58. 45.100 / 58. 45.100
libavdevice    58. 10.100 / 58. 10.100
libavfilter     7. 85.100 /  7. 85.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  7.100 /  5.  7.100
libswresample   3.  7.100 /  3.  7.100
libpostproc    55.  7.100 / 55.  7.100
```
</details>

## Additional comments
<!-- Add further context that you think might be relevant for this issue here. -->



Discussion:

Resolving patch:
diff --git a/manim/mobject/graphing/number_line.py b/manim/mobject/graphing/number_line.py
--- a/manim/mobject/graphing/number_line.py
+++ b/manim/mobject/graphing/number_line.py
@@ -277,9 +277,10 @@ def add_ticks(self):
         via ``self.ticks``."""
         ticks = VGroup()
         elongated_tick_size = self.tick_size * self.longer_tick_multiple
+        elongated_tick_offsets = self.numbers_with_elongated_ticks - self.x_min
         for x in self.get_tick_range():
             size = self.tick_size
-            if x in self.numbers_with_elongated_ticks:
+            if np.any(np.isclose(x - self.x_min, elongated_tick_offsets)):
                 size = elongated_tick_size
             ticks.add(self.get_tick(x, size))
         self.add(ticks)


Test patch:
diff --git a/tests/module/mobject/graphing/test_ticks.py b/tests/module/mobject/graphing/test_ticks.py
--- a/tests/module/mobject/graphing/test_ticks.py
+++ b/tests/module/mobject/graphing/test_ticks.py
@@ -13,6 +13,27 @@ def test_duplicate_ticks_removed_for_axes():
     assert np.unique(ticks).size == ticks.size
 
 
+def test_elongated_ticks_float_equality():
+    nline = NumberLine(
+        x_range=[1 + 1e-5, 1 + 2e-5, 1e-6],
+        numbers_with_elongated_ticks=[
+            1 + 12e-6,
+            1 + 17e-6,
+        ],  # Elongate the 3rd and 8th tick
+        include_ticks=True,
+    )
+
+    tick_heights = {tick.height for tick in nline.ticks}
+    default_tick_height, elongated_tick_height = min(tick_heights), max(tick_heights)
+
+    assert all(
+        tick.height == elongated_tick_height
+        if ind in [2, 7]
+        else tick.height == default_tick_height
+        for ind, tick in enumerate(nline.ticks)
+    )
+
+
 def test_ticks_not_generated_on_origin_for_axes():
     axes = Axes(
         x_range=[-10, 10],