Joaquín Triñanes f738932bbd
Fix range contains (#14011)
# Description

This PR changes the range contains logic to take the step into account. 

```nushell
# before
2 in 1..3.. # true

# now
2 in 1..3.. # false
```

---

I encountered another issue while adding tests. Due to floating point
precision, `2.1 in 1..1.1..3` will return `false`. The floating point
error is even bigger than `f64::EPSILON` (`0.09999999999999876` vs
`2.220446049250313e-16`). This issue disappears with bigger numbers.

I tried a different algorithm (checking if the estimated number of steps
is close enough to any integer) but the results are still pretty bad:

```rust
let n_steps = (value - self.start) / self.step; // 14.999999999999988
(n_steps - n_steps.round()).abs() < f64::EPSILON // returns false
```

Maybe it can be shipped like this, the REPL already has floating point
errors (`1.1 - 1` returns `0.10000000000000009`). Or maybe there's a way
to fix this that I didn't think of. I'm open to ideas! But in any case
performing this kind of checks on a range of floats seems more niche
than doing it on a range of ints.

# User-Facing Changes

Code that depended on this behavior to check if a number is between
`start` and `end` will potentially return a different value.

# Tests + Formatting

# After Submitting
2024-10-22 10:34:41 -05:00
..
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:14:11 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-22 10:34:41 -05:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2024-10-20 23:12:41 +02:00
2022-02-07 14:54:06 -05:00

Nushell core libraries and plugins

These sub-crates form both the foundation for Nu and a set of plugins which extend Nu with additional functionality.

Foundational libraries are split into two kinds of crates:

  • Core crates - those crates that work together to build the Nushell language engine
  • Support crates - a set of crates that support the engine with additional features like JSON support, ANSI support, and more.

Plugins are likewise also split into two types:

  • Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
  • Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.