Skip to content

Commit 1498714

Browse files
committed
Remove MAXVALUE and MINVALUE
These are superseded by MAXINT
1 parent 581a386 commit 1498714

File tree

4 files changed

+3
-21
lines changed

4 files changed

+3
-21
lines changed

TinyExprChanges.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ The following are changes from the original TinyExpr C library:
5050
- `if`: if a value is true (i.e., non-zero), then returns the second argument; otherwise, returns the third argument.
5151
- `ifs`: checks up to three conditions, returning the value corresponding to the first met condition.
5252
- `max`: returns the maximum of a range of values (accepts 1-7 arguments).
53+
- `maxint`: returns the largest integer value that the parser can store.
5354
- `min`: returns the minimum of a range of values (accepts 1-7 arguments).
5455
- `mod`: returns remainder from a division.
5556
- `nan`: returns `NaN` (i.e., Not-a-Number) in a boolean expression.
@@ -95,6 +96,7 @@ The following are changes from the original TinyExpr C library:
9596
(In this context, a constant is a variable mapped to a double value in the parser, rather than mapped to a runtime variable.)
9697
- Added `get_constant()` function to return the value of a constant (custom) variable by name.
9798
- Added `TE_FLOAT` preprocessor flag to use `float` instead of `double` for the parser's data type.
99+
- Added `TE_LONG_DOUBLE` preprocessor flag to use `long double` instead of `double` for the parser's data type.
98100
- Binary search (i.e., `std::set`) is now used to look up custom variables and functions (small optimization).
99101
- You no longer need to specify the number of arguments for custom functions; it will deduce that for you.
100102
- The position of an error when evaluating an expression is now managed by the `te_parser` class and accessible via `get_last_error_position()`.

docs/manual/functions.qmd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ The following built-in functions are available:
3636
| LN(Number) | Natural logarithm of *Number* (base Euler). |
3737
| LOG10(Number) | Common logarithm of *Number* (base 10). |
3838
| MIN(Number1, Number2, ...) | Returns the smallest value from a specified range of values. |
39-
| MINVALUE() | Returns the smallest value that the parser can process. |
4039
| MAX(Number1, Number2, ...) | Returns the largest value from a specified range of values. |
4140
| MAXINT() | Returns the largest integer that the parser can process. |
42-
| MAXVALUE() | Returns the largest value that the parser can process. |
4341
| MOD(Number, Divisor) | Returns the remainder after *Number* is divided by *Divisor*. The result has the same sign as divisor. |
4442
| NAN | Returns an invalid value (i.e., Not-a-number). |
4543
| NCR(Number, NumberChosen) | Alias for `COMBIN()`. |

tinyexpr.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -835,19 +835,7 @@ namespace te_builtins
835835
{
836836
return te_parser::te_nan;
837837
}
838-
839-
[[nodiscard]]
840-
constexpr static te_type te_min_value() noexcept
841-
{
842-
return te_parser::te_min_value;
843-
}
844-
845-
[[nodiscard]]
846-
constexpr static te_type te_max_value() noexcept
847-
{
848-
return te_parser::te_max_value;
849-
}
850-
838+
851839
[[nodiscard]]
852840
static te_type te_max_integer() noexcept
853841
{
@@ -980,10 +968,8 @@ const std::set<te_variable> te_parser::m_functions = { // NOLINT
980968
{ "max", static_cast<te_fun7>(te_builtins::te_max),
981969
static_cast<te_variable_flags>(TE_PURE | TE_VARIADIC) },
982970
{ "maxint", static_cast<te_fun0>(te_builtins::te_max_integer), TE_PURE },
983-
{ "maxvalue", static_cast<te_fun0>(te_builtins::te_max_value), TE_PURE },
984971
{ "min", static_cast<te_fun7>(te_builtins::te_min),
985972
static_cast<te_variable_flags>(TE_PURE | TE_VARIADIC) },
986-
{ "minvalue", static_cast<te_fun0>(te_builtins::te_min_value), TE_PURE },
987973
{ "mod", static_cast<te_fun2>(te_builtins::te_modulus), TE_PURE },
988974
{ "nan", static_cast<te_fun0>(te_builtins::te_nan_value), TE_PURE },
989975
{ "ncr", static_cast<te_fun2>(te_builtins::te_ncr), TE_PURE },

tinyexpr.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,6 @@ class te_parser
254254

255255
/// @brief NaN (not-a-number) constant to indicate an invalid value.
256256
constexpr static auto te_nan = std::numeric_limits<te_type>::quiet_NaN();
257-
/// @brief Minimum value that can be used.
258-
constexpr static auto te_min_value = std::numeric_limits<te_type>::min();
259-
/// @brief Maximum value that can be used.
260-
constexpr static auto te_max_value = std::numeric_limits<te_type>::max();
261257
/// @brief No position, which is what get_last_error_position() returns
262258
/// when there was no parsing error.
263259
constexpr static int64_t npos = -1;

0 commit comments

Comments
 (0)