summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/builtin.txt53
-rw-r--r--runtime/doc/eval.txt2
-rw-r--r--runtime/doc/mlang.txt6
-rw-r--r--runtime/doc/various.txt2
-rwxr-xr-xsrc/auto/configure42
-rw-r--r--src/config.h.in1
-rw-r--r--src/configure.ac26
-rw-r--r--src/dict.c2
-rw-r--r--src/errors.h19
-rw-r--r--src/eval.c65
-rw-r--r--src/evalfunc.c65
-rw-r--r--src/ex_cmds.c22
-rw-r--r--src/feature.h5
-rw-r--r--src/float.c2
-rw-r--r--src/gui_gtk_x11.c2
-rw-r--r--src/gui_x11.c2
-rw-r--r--src/if_lua.c7
-rw-r--r--src/if_mzsch.c4
-rw-r--r--src/if_py_both.h6
-rw-r--r--src/if_ruby.c4
-rw-r--r--src/json.c25
-rw-r--r--src/list.c8
-rw-r--r--src/locale.c4
-rw-r--r--src/macros.h2
-rw-r--r--src/message_test.c2
-rw-r--r--src/os_mac_conv.c2
-rw-r--r--src/os_vms_conf.h1
-rw-r--r--src/profiler.c10
-rw-r--r--src/session.c2
-rw-r--r--src/strings.c22
-rw-r--r--src/structs.h2
-rw-r--r--src/syntax.c6
-rw-r--r--src/testdir/runtest.vim4
-rw-r--r--src/testdir/test_assert.vim28
-rw-r--r--src/testdir/test_blob.vim4
-rw-r--r--src/testdir/test_cscope.vim36
-rw-r--r--src/testdir/test_eval_stuff.vim18
-rw-r--r--src/testdir/test_execute_func.vim8
-rw-r--r--src/testdir/test_expr.vim244
-rw-r--r--src/testdir/test_float_func.vim1
-rw-r--r--src/testdir/test_functions.vim36
-rw-r--r--src/testdir/test_glob2regpat.vim6
-rw-r--r--src/testdir/test_json.vim56
-rw-r--r--src/testdir/test_listdict.vim34
-rw-r--r--src/testdir/test_lua.vim1
-rw-r--r--src/testdir/test_messages.vim8
-rw-r--r--src/testdir/test_method.vim1
-rw-r--r--src/testdir/test_perl.vim6
-rw-r--r--src/testdir/test_python2.vim5
-rw-r--r--src/testdir/test_python3.vim23
-rw-r--r--src/testdir/test_random.vim4
-rw-r--r--src/testdir/test_reltime.vim1
-rw-r--r--src/testdir/test_ruby.vim6
-rw-r--r--src/testdir/test_sort.vim57
-rw-r--r--src/testdir/test_substitute.vim2
-rw-r--r--src/testdir/test_terminal.vim4
-rw-r--r--src/testdir/test_true_false.vim5
-rw-r--r--src/testdir/test_user_func.vim8
-rw-r--r--src/testdir/test_vim9_assign.vim58
-rw-r--r--src/testdir/test_vim9_builtin.vim26
-rw-r--r--src/testdir/test_vim9_disassemble.vim74
-rw-r--r--src/testdir/test_vim9_expr.vim342
-rw-r--r--src/testdir/test_vimscript.vim152
-rw-r--r--src/testing.c2
-rw-r--r--src/time.c10
-rw-r--r--src/typval.c18
-rw-r--r--src/version.c6
-rw-r--r--src/vim9.h2
-rw-r--r--src/vim9compile.c4
-rw-r--r--src/vim9execute.c24
-rw-r--r--src/vim9expr.c2
-rw-r--r--src/vim9instr.c14
-rw-r--r--src/vim9type.c6
-rw-r--r--src/viminfo.c4
74 files changed, 605 insertions, 1168 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 53179ca85a..4a05fdc528 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -753,8 +753,6 @@ abs({expr}) *abs()*
Can also be used as a |method|: >
Compute()->abs()
-< {only available when compiled with the |+float| feature}
-
acos({expr}) *acos()*
Return the arc cosine of {expr} measured in radians, as a
@@ -770,8 +768,6 @@ acos({expr}) *acos()*
Can also be used as a |method|: >
Compute()->acos()
-< {only available when compiled with the |+float| feature}
-
add({object}, {expr}) *add()*
Append the item {expr} to |List| or |Blob| {object}. Returns
@@ -904,8 +900,6 @@ asin({expr}) *asin()*
Can also be used as a |method|: >
Compute()->asin()
-<
- {only available when compiled with the |+float| feature}
assert_ functions are documented here: |assert-functions-details|
@@ -925,8 +919,6 @@ atan({expr}) *atan()*
Can also be used as a |method|: >
Compute()->atan()
-<
- {only available when compiled with the |+float| feature}
atan2({expr1}, {expr2}) *atan2()*
@@ -943,8 +935,6 @@ atan2({expr1}, {expr2}) *atan2()*
Can also be used as a |method|: >
Compute()->atan2(1)
-<
- {only available when compiled with the |+float| feature}
autocmd_add({acmds}) *autocmd_add()*
@@ -1428,8 +1418,6 @@ ceil({expr}) *ceil()*
Can also be used as a |method|: >
Compute()->ceil()
-<
- {only available when compiled with the |+float| feature}
ch_ functions are documented here: |channel-functions-details|
@@ -1801,8 +1789,6 @@ cos({expr}) *cos()*
Can also be used as a |method|: >
Compute()->cos()
-<
- {only available when compiled with the |+float| feature}
cosh({expr}) *cosh()*
@@ -1818,8 +1804,6 @@ cosh({expr}) *cosh()*
Can also be used as a |method|: >
Compute()->cosh()
-<
- {only available when compiled with the |+float| feature}
count({comp}, {expr} [, {ic} [, {start}]]) *count()*
@@ -2405,8 +2389,6 @@ exp({expr}) *exp()*
Can also be used as a |method|: >
Compute()->exp()
-<
- {only available when compiled with the |+float| feature}
expand({string} [, {nosuf} [, {list}]]) *expand()*
@@ -2807,8 +2789,6 @@ float2nr({expr}) *float2nr()*
Can also be used as a |method|: >
Compute()->float2nr()
-<
- {only available when compiled with the |+float| feature}
floor({expr}) *floor()*
@@ -2826,8 +2806,6 @@ floor({expr}) *floor()*
Can also be used as a |method|: >
Compute()->floor()
-<
- {only available when compiled with the |+float| feature}
fmod({expr1}, {expr2}) *fmod()*
@@ -2848,8 +2826,6 @@ fmod({expr1}, {expr2}) *fmod()*
Can also be used as a |method|: >
Compute()->fmod(1.22)
-<
- {only available when compiled with |+float| feature}
fnameescape({string}) *fnameescape()*
@@ -5050,8 +5026,6 @@ isinf({expr}) *isinf()*
Can also be used as a |method|: >
Compute()->isinf()
-<
- {only available when compiled with the |+float| feature}
islocked({expr}) *islocked()* *E786*
The result is a Number, which is |TRUE| when {expr} is the
@@ -5080,8 +5054,6 @@ isnan({expr}) *isnan()*
Can also be used as a |method|: >
Compute()->isnan()
-<
- {only available when compiled with the |+float| feature}
items({dict}) *items()*
Return a |List| with all the key-value pairs of {dict}. Each
@@ -5510,8 +5482,6 @@ log({expr}) *log()*
Can also be used as a |method|: >
Compute()->log()
-<
- {only available when compiled with the |+float| feature}
log10({expr}) *log10()*
@@ -5526,8 +5496,6 @@ log10({expr}) *log10()*
Can also be used as a |method|: >
Compute()->log10()
-<
- {only available when compiled with the |+float| feature}
luaeval({expr} [, {expr}]) *luaeval()*
Evaluate Lua expression {expr} and return its result converted
@@ -5535,8 +5503,7 @@ luaeval({expr} [, {expr}]) *luaeval()*
argument accessible as _A inside first {expr}.
Strings are returned as they are.
Boolean objects are converted to numbers.
- Numbers are converted to |Float| values if vim was compiled
- with |+float| and to numbers otherwise.
+ Numbers are converted to |Float| values.
Dictionaries and lists obtained by vim.eval() are returned
as-is.
Other objects are returned as zero without any errors.
@@ -6483,8 +6450,6 @@ pow({x}, {y}) *pow()*
Can also be used as a |method|: >
Compute()->pow(3)
-<
- {only available when compiled with the |+float| feature}
prevnonblank({lnum}) *prevnonblank()*
Return the line number of the first line at or above {lnum}
@@ -7366,8 +7331,6 @@ round({expr}) *round()*
Can also be used as a |method|: >
Compute()->round()
-<
- {only available when compiled with the |+float| feature}
rubyeval({expr}) *rubyeval()*
Evaluate Ruby expression {expr} and return its result
@@ -8536,8 +8499,6 @@ sin({expr}) *sin()*
Can also be used as a |method|: >
Compute()->sin()
-<
- {only available when compiled with the |+float| feature}
sinh({expr}) *sinh()*
@@ -8553,8 +8514,6 @@ sinh({expr}) *sinh()*
Can also be used as a |method|: >
Compute()->sinh()
-<
- {only available when compiled with the |+float| feature}
slice({expr}, {start} [, {end}]) *slice()*
@@ -8821,8 +8780,6 @@ sqrt({expr}) *sqrt()*
Can also be used as a |method|: >
Compute()->sqrt()
-<
- {only available when compiled with the |+float| feature}
srand([{expr}]) *srand()*
@@ -8896,8 +8853,6 @@ str2float({string} [, {quoted}]) *str2float()*
Can also be used as a |method|: >
let f = text->substitute(',', '', 'g')->str2float()
-<
- {only available when compiled with the |+float| feature}
str2list({string} [, {utf8}]) *str2list()*
Return a list containing the number values which represent
@@ -9643,8 +9598,6 @@ tan({expr}) *tan()*
Can also be used as a |method|: >
Compute()->tan()
-<
- {only available when compiled with the |+float| feature}
tanh({expr}) *tanh()*
@@ -9660,8 +9613,6 @@ tanh({expr}) *tanh()*
Can also be used as a |method|: >
Compute()->tanh()
-<
- {only available when compiled with the |+float| feature}
tempname() *tempname()* *temp-file-name*
@@ -9897,8 +9848,6 @@ trunc({expr}) *trunc()*
Can also be used as a |method|: >
Compute()->trunc()
<
- {only available when compiled with the |+float| feature}
-
*type()*
type({expr}) The result is a Number representing the type of {expr}.
Instead of using the number directly, it is better to use the
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index e99e9baa0a..145d3bd76b 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -54,7 +54,6 @@ Number A 32 or 64 bit signed number. |expr-number|
Examples: -123 0x10 0177 0o177 0b1011
Float A floating point number. |floating-point-format| *Float*
- {only when compiled with the |+float| feature} *E1076*
Examples: 123.456 1.15e-6 -1.1e3
String A NUL terminated string of 8-bit unsigned characters (bytes).
@@ -1441,7 +1440,6 @@ digits are ignored.
{exp} is the exponent, power of 10.
Only a decimal point is accepted, not a comma. No matter what the current
locale is.
-{only when compiled with the |+float| feature}
Examples:
123.456
diff --git a/runtime/doc/mlang.txt b/runtime/doc/mlang.txt
index edab4d43ce..724ec46a85 100644
--- a/runtime/doc/mlang.txt
+++ b/runtime/doc/mlang.txt
@@ -82,9 +82,9 @@ use of "-" and "_".
characters. This sets $LC_COLLATE.
Without an argument all are set, and additionally
$LANG is set.
- When compiled with the |+float| feature the LC_NUMERIC
- value will always be set to "C", so that floating
- point numbers use '.' as the decimal point.
+ If available the LC_NUMERIC value will always be set
+ to "C", so that floating point numbers use '.' as the
+ decimal point.
This will make a difference for items that depend on
the language (some messages, time and date format).
Not fully supported on all systems
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index ac8b4afcd0..6e4afec5b3 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -381,7 +381,7 @@ N *+find_in_path* include file searches: |[I|, |:isearch|,
N *+folding* |folding|
*+footer* |gui-footer|
*+fork* Unix only: |fork| shell commands
- *+float* Floating point support
+T *+float* Floating point support Always enabled since 9.0.0491
N *+gettext* message translations |multi-lang|
- *+GUI_Athena* Unix only: Athena |GUI|
*+GUI_neXtaw* Unix only: neXtaw |GUI|
diff --git a/src/auto/configure b/src/auto/configure
index 18836113be..8c770c8012 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -13379,48 +13379,6 @@ _ACEOF
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strtod() and other floating point functions" >&5
-$as_echo_n "checking for strtod() and other floating point functions... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#ifdef HAVE_MATH_H
-# include <math.h>
-#endif
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#endif
-
-int
-main ()
-{
-char *s; double d;
- d = strtod("1.1", &s);
- d = fabs(1.11);
- d = ceil(1.11);
- d = floor(1.11);
- d = log10(1.11);
- d = pow(1.11, 2.22);
- d = sqrt(1.11);
- d = sin(1.11);
- d = cos(1.11);
- d = atan(1.11);
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }; $as_echo "#define HAVE_FLOAT_FUNCS 1" >>confdefs.h
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for isinf()" >&5
$as_echo_n "checking for isinf()... " >&6; }
diff --git a/src/config.h.in b/src/config.h.in
index 5f0d6aef2a..875d9afd54 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -157,7 +157,6 @@
#undef HAVE_FCHDIR
#undef HAVE_FCHOWN
#undef HAVE_FCHMOD
-#undef HAVE_FLOAT_FUNCS
#undef HAVE_FSEEKO
#undef HAVE_FSYNC
#undef HAVE_FTRUNCATE
diff --git a/src/configure.ac b/src/configure.ac
index 76eb56327c..b688032d00 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -3952,32 +3952,8 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
AC_MSG_RESULT(no))
-dnl Need various functions for floating point support. Only enable
-dnl floating point when they are all present.
+dnl Floating point support may require the "m" library
AC_CHECK_LIB(m, strtod)
-AC_MSG_CHECKING([for strtod() and other floating point functions])
-AC_LINK_IFELSE([AC_LANG_PROGRAM([
-#ifdef HAVE_MATH_H
-# include <math.h>
-#endif
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#endif
-], [char *s; double d;
- d = strtod("1.1", &s);
- d = fabs(1.11);
- d = ceil(1.11);
- d = floor(1.11);
- d = log10(1.11);
- d = pow(1.11, 2.22);
- d = sqrt(1.11);
- d = sin(1.11);
- d = cos(1.11);
- d = atan(1.11);
- ])],
- AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
- AC_MSG_RESULT(no))
dnl isinf() and isnan() need to include header files and may need -lm.
AC_MSG_CHECKING([for isinf()])
diff --git a/src/dict.c b/src/dict.c
index fa54c60c41..1cb3e89a8d 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -984,13 +984,11 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
}
if (evaluate)
{
-#ifdef FEAT_FLOAT
if (tvkey.v_type == VAR_FLOAT)
{
tvkey.vval.v_string = typval_tostring(&tvkey, TRUE);
tvkey.v_type = VAR_STRING;
}
-#endif
key = tv_get_string_buf_chk(&tvkey, buf);
if (key == NULL)
{
diff --git a/src/errors.h b/src/errors.h
index 944dc43c5d..e293876528 100644
--- a/src/errors.h
+++ b/src/errors.h
@@ -895,7 +895,7 @@ EXTERN char e_cannot_execute_shell_with_f_option[]
INIT(= N_("E360: Cannot execute shell with -f option"));
#endif
// E361 unused
-#if defined(FEAT_EVAL) && defined(FEAT_FLOAT)
+#if defined(FEAT_EVAL)
EXTERN char e_using_boolean_value_as_float[]
INIT(= N_("E362: Using a boolean value as a Float"));
#endif
@@ -2044,17 +2044,13 @@ EXTERN char e_cannot_use_percent_with_float[]
// xgettext:no-c-format
INIT(= N_("E804: Cannot use '%' with Float"));
#endif
-#ifdef FEAT_FLOAT
EXTERN char e_using_float_as_number[]
INIT(= N_("E805: Using a Float as a Number"));
EXTERN char e_using_float_as_string[]
INIT(= N_("E806: Using a Float as a String"));
-#endif
-#ifdef FEAT_FLOAT
EXTERN char e_expected_float_argument_for_printf[]
INIT(= N_("E807: Expected Float argument for printf()"));
-#endif
-#if defined(FEAT_EVAL) && defined(FEAT_FLOAT)
+#if defined(FEAT_EVAL)
EXTERN char e_number_or_float_required[]
INIT(= N_("E808: Number or Float required"));
#endif
@@ -2290,7 +2286,6 @@ EXTERN char e_number_required[]
EXTERN char e_trailing_char_after_rsb_str_str[]
INIT(= N_("E890: Trailing char after ']': %s]%s"));
#endif
-#ifdef FEAT_FLOAT
EXTERN char e_using_funcref_as_float[]
INIT(= N_("E891: Using a Funcref as a Float"));
EXTERN char e_using_string_as_float[]
@@ -2299,7 +2294,6 @@ EXTERN char e_using_list_as_float[]
INIT(= N_("E893: Using a List as a Float"));
EXTERN char e_using_dictionary_as_float[]
INIT(= N_("E894: Using a Dictionary as a Float"));
-#endif
#ifdef FEAT_MZSCHEME
EXTERN char e_sorry_this_command_is_disabled_the_mzscheme_racket_base_module_could_not_be_loaded[]
INIT(= N_("E895: Sorry, this command is disabled, the MzScheme's racket/base module could not be loaded."));
@@ -2340,10 +2334,8 @@ EXTERN char e_received_unknown_command_str[]
EXTERN char e_not_an_open_channel[]
INIT(= N_("E906: Not an open channel"));
#endif
-#ifdef FEAT_FLOAT
EXTERN char e_using_special_value_as_float[]
INIT(= N_("E907: Using a special value as a Float"));
-#endif
#ifdef FEAT_EVAL
EXTERN char e_using_invalid_value_as_string_str[]
INIT(= N_("E908: Using an invalid value as a String: %s"));
@@ -2537,10 +2529,8 @@ EXTERN char e_blob_literal_should_have_an_even_number_of_hex_characters[]
INIT(= N_("E973: Blob literal should have an even number of hex characters"));
EXTERN char e_using_blob_as_number[]
INIT(= N_("E974: Using a Blob as a Number"));
-# ifdef FEAT_FLOAT
EXTERN char e_using_blob_as_float[]
INIT(= N_("E975: Using a Blob as a Float"));
-# endif
EXTERN char e_using_blob_as_string[]
INIT(= N_("E976: Using a Blob as a String"));
EXTERN char e_can_only_compare_blob_with_blob[]
@@ -2775,10 +2765,7 @@ EXTERN char e_no_white_space_allowed_after_dot[]
INIT(= N_("E1074: No white space allowed after dot"));
EXTERN char e_namespace_not_supported_str[]
INIT(= N_("E1075: Namespace not supported: %s"));
-# ifndef FEAT_FLOAT
-EXTERN char e_this_vim_is_not_compiled_with_float_support[]
- INIT(= N_("E1076: This Vim is not compiled with float support"));
-# endif
+// E1076 was deleted
EXTERN char e_missing_argument_type_for_str[]
INIT(= N_("E1077: Missing argument type for %s"));
#endif
diff --git a/src/eval.c b/src/eval.c
index 3209d08dcc..948faa2ee5 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -525,9 +525,7 @@ typval2string(typval_T *tv, int convert)
{
garray_T ga;
char_u *retval;
-#ifdef FEAT_FLOAT
char_u numbuf[NUMBUFLEN];
-#endif
if (convert && tv->v_type == VAR_LIST)
{
@@ -541,13 +539,11 @@ typval2string(typval_T *tv, int convert)
ga_append(&ga, NUL);
retval = (char_u *)ga.ga_data;
}
-#ifdef FEAT_FLOAT
else if (convert && tv->v_type == VAR_FLOAT)
{
vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv->vval.v_float);
retval = vim_strsave(numbuf);
}
-#endif
else
retval = vim_strsave(tv_get_string(tv));
return retval;
@@ -1683,7 +1679,6 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op)
{
// nr += nr , nr -= nr , nr *=nr , nr /= nr , nr %= nr
n = tv_get_number(tv1);
-#ifdef FEAT_FLOAT
if (tv2->v_type == VAR_FLOAT)
{
float_T f = n;
@@ -1702,7 +1697,6 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op)
tv1->vval.v_float = f;
}
else
-#endif
{
switch (*op)
{
@@ -1734,7 +1728,6 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op)
return failed ? FAIL : OK;
case VAR_FLOAT:
-#ifdef FEAT_FLOAT
{
float_T f;
@@ -1755,7 +1748,6 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *