# HG changeset patch # User Bram Moolenaar # Date 1663445705 -7200 # Node ID 029c59bf78f1ac8df7a00e8798447734e9bd1b9b # Parent 4ba3d27b53575ad550838520230477a95e7e57f4 patch 9.0.0491: no good reason to build without the float feature Commit: https://github.com/vim/vim/commit/73e28dcc6125f616cf1f2d56443d22428a79e434 Author: Bram Moolenaar Date: Sat Sep 17 21:08:33 2022 +0100 patch 9.0.0491: no good reason to build without the float feature Problem: No good reason to build without the float feature. Solution: Remove configure check for float and "#ifdef FEAT_FLOAT". diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt --- 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}]) *str 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 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -54,7 +54,6 @@ Number A 32 or 64 bit signed 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 --- 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 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -381,7 +381,7 @@ N *+find_in_path* include file searches 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 --- a/src/auto/configure +++ b/src/auto/configure @@ -13379,48 +13379,6 @@ if test "x$ac_cv_lib_m_strtod" = xyes; t 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 -#endif -#if STDC_HEADERS -# include -# include -#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 --- 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 --- 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 -#endif -#if STDC_HEADERS -# include -# include -#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 --- a/src/dict.c +++ b/src/dict.c @@ -984,13 +984,11 @@ eval_dict(char_u **arg, typval_T *rettv, } 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 --- a/src/errors.h +++ b/src/errors.h @@ -895,7 +895,7 @@ EXTERN char e_cannot_execute_shell_with_ 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_fl // 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_s 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_a 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_aft 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 --- 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 { // 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 tv1->vval.v_float = f; } else -#endif { switch (*op) { @@ -1734,7 +1728,6 @@ tv_op(typval_T *tv1, typval_T *tv2, char 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 case '/': tv1->vval.v_float /= f; break; } } -#endif return OK; } } @@ -3238,9 +3230,7 @@ eval6(char_u **arg, typval_T *rettv, eva } if ((op != '+' || (rettv->v_type != VAR_LIST && rettv->v_type != VAR_BLOB)) -#ifdef FEAT_FLOAT && (op == '.' || rettv->v_type != VAR_FLOAT) -#endif && evaluate) { int error = FALSE; @@ -3293,14 +3283,12 @@ eval6(char_u **arg, typval_T *rettv, eva || var2.v_type == VAR_JOB)) semsg(_(e_using_invalid_value_as_string_str), vartype_name(var2.v_type)); -#ifdef FEAT_FLOAT else if (vim9script && var2.v_type == VAR_FLOAT) { vim_snprintf((char *)buf2, NUMBUFLEN, "%g", var2.vval.v_float); s2 = buf2; } -#endif else s2 = tv_get_string_buf_chk(&var2, buf2); if (s2 == NULL) // type error ? @@ -3327,8 +3315,7 @@ eval6(char_u **arg, typval_T *rettv, eva { int error = FALSE; varnumber_T n1, n2; -#ifdef FEAT_FLOAT - float_T f1 = 0, f2 = 0; + float_T f1 = 0, f2 = 0; if (rettv->v_type == VAR_FLOAT) { @@ -3336,7 +3323,6 @@ eval6(char_u **arg, typval_T *rettv, eva n1 = 0; } else -#endif { n1 = tv_get_number_chk(rettv, &error); if (error) @@ -3349,19 +3335,15 @@ eval6(char_u **arg, typval_T *rettv, eva clear_tv(&var2); return FAIL; } -#ifdef FEAT_FLOAT if (var2.v_type == VAR_FLOAT) f1 = n1; -#endif } -#ifdef FEAT_FLOAT if (var2.v_type == VAR_FLOAT) { f2 = var2.vval.v_float; n2 = 0; } else -#endif { n2 = tv_get_number_chk(&var2, &error); if (error) @@ -3370,14 +3352,11 @@ eval6(char_u **arg, typval_T *rettv, eva clear_tv(&var2); return FAIL; } -#ifdef FEAT_FLOAT if (rettv->v_type == VAR_FLOAT) f2 = n2; -#endif } clear_tv(rettv); -#ifdef FEAT_FLOAT // If there is a float on either side the result is a float. if (rettv->v_type == VAR_FLOAT || var2.v_type == VAR_FLOAT) { @@ -3389,7 +3368,6 @@ eval6(char_u **arg, typval_T *rettv, eva rettv->vval.v_float = f1; } else -#endif { if (op == '+') n1 = n1 + n2; @@ -3423,9 +3401,7 @@ eval7( evalarg_T *evalarg, int want_string) // after "." operator { -#ifdef FEAT_FLOAT int use_float = FALSE; -#endif /* * Get the first expression. @@ -3444,9 +3420,7 @@ eval7( char_u *p; int op; varnumber_T n1, n2; -#ifdef FEAT_FLOAT float_T f1, f2; -#endif int error; // "*=", "/=" and "%=" are assignments @@ -3469,14 +3443,11 @@ eval7( *arg = p; } -#ifdef FEAT_FLOAT f1 = 0; f2 = 0; -#endif error = FALSE; if (evaluate) { -#ifdef FEAT_FLOAT if (rettv->v_type == VAR_FLOAT) { f1 = rettv->vval.v_float; @@ -3484,7 +3455,6 @@ eval7( n1 = 0; } else -#endif n1 = tv_get_number_chk(rettv, &error); clear_tv(rettv); if (error) @@ -3508,7 +3478,6 @@ eval7( if (evaluate) { -#ifdef FEAT_FLOAT if (var2.v_type == VAR_FLOAT) { if (!use_float) @@ -3520,30 +3489,26 @@ eval7( n2 = 0; } else -#endif { n2 = tv_get_number_chk(&var2, &error); clear_tv(&var2); if (error) return FAIL; -#ifdef FEAT_FLOAT if (use_float) f2 = n2; -#endif } /* * Compute the result. * When either side is a float the result is a float. */ -#ifdef FEAT_FLOAT if (use_float) { if (op == '*') f1 = f1 * f2; else if (op == '/') { -# ifdef VMS +#ifdef VMS // VMS crashes on divide by zero, work around it if (f2 == 0.0) { @@ -3556,11 +3521,11 @@ eval7( } else f1 = f1 / f2; -# else +#else // We rely on the floating point library to handle divide // by zero to result in "inf" and not a crash. f1 = f1 / f2; -# endif +#endif } else { @@ -3571,7 +3536,6 @@ eval7( rettv->vval.v_float = f1; } else -#endif { int failed = FALSE; @@ -3858,11 +3822,7 @@ eval9( return FAIL; end_leader = *arg; - if (**arg == '.' && (!isdigit(*(*arg + 1)) -#ifdef FEAT_FLOAT - || in_old_script(2) -#endif - )) + if (**arg == '.' && (!isdigit(*(*arg + 1)) || in_old_script(2))) { semsg(_(e_invalid_expression_str), *arg); ++*arg; @@ -4129,13 +4089,11 @@ eval9_leader( varnumber_T val = 0; vartype_T type = rettv->v_type; int vim9script = in_vim9script(); -#ifdef FEAT_FLOAT float_T f = 0.0; if (rettv->v_type == VAR_FLOAT) f = rettv->vval.v_float; else -#endif { while (VIM_ISWHITE(end_leader[-1])) --end_leader; @@ -4161,7 +4119,6 @@ eval9_leader( ++end_leader; break; } -#ifdef FEAT_FLOAT if (rettv->v_type == VAR_FLOAT) { if (vim9script) @@ -4173,7 +4130,6 @@ eval9_leader( f = !f; } else -#endif { val = !val; type = VAR_BOOL; @@ -4181,25 +4137,21 @@ eval9_leader( } else if (*end_leader == '-') { -#ifdef FEAT_FLOAT if (rettv->v_type == VAR_FLOAT) f = -f; else -#endif { val = -val; type = VAR_NUMBER; } } } -#ifdef FEAT_FLOAT if (rettv->v_type == VAR_FLOAT) { clear_tv(rettv); rettv->vval.v_float = f; } else -#endif { clear_tv(rettv); if (vim9script) @@ -4500,7 +4452,6 @@ eval_index( { int error = FALSE; -#ifdef FEAT_FLOAT // allow for indexing with float if (vim9script && rettv->v_type == VAR_DICT && var1.v_type == VAR_FLOAT) @@ -4508,7 +4459,7 @@ eval_index( var1.vval.v_string = typval_tostring(&var1, TRUE); var1.v_type = VAR_STRING; } -#endif + if (vim9script && rettv->v_type == VAR_LIST) tv_get_number_chk(&var1, &error); else @@ -4599,11 +4550,9 @@ check_can_index(typval_T *rettv, int eva emsg(_(e_cannot_index_a_funcref)); return FAIL; case VAR_FLOAT: -#ifdef FEAT_FLOAT if (verbose) emsg(_(e_using_float_as_string)); return FAIL; -#endif case VAR_BOOL: case VAR_SPECIAL: case VAR_JOB: @@ -5696,12 +5645,10 @@ echo_string_core( break; case VAR_FLOAT: -#ifdef FEAT_FLOAT *tofree = NULL; vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv->vval.v_float); r = numbuf; break; -#endif case VAR_BOOL: case VAR_SPECIAL: diff --git a/src/evalfunc.c b/src/evalfunc.c --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -1512,12 +1512,7 @@ typedef struct #define FEARG_3 3 // base is the third argument #define FEARG_4 4 // base is the fourth argument -#ifdef FEAT_FLOAT -# define FLOAT_FUNC(name) name -#else -# define FLOAT_FUNC(name) NULL -#endif -#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H) +#if defined(HAVE_MATH_H) # define MATH_FUNC(name) name #else # define MATH_FUNC(name) NULL @@ -1556,9 +1551,9 @@ typedef struct static funcentry_T global_functions[] = { {"abs", 1, 1, FEARG_1, arg1_float_or_nr, - ret_any, FLOAT_FUNC(f_abs)}, + ret_any, f_abs}, {"acos", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_acos)}, + ret_float, f_acos}, {"add", 2, 2, FEARG_1, arg2_listblob_item, ret_first_arg, f_add}, {"and", 2, 2, FEARG_1, arg2_number, @@ -1576,7 +1571,7 @@ static funcentry_T global_functions[] = {"argv", 0, 2, 0, arg2_number, ret_argv, f_argv}, {"asin", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_asin)}, + ret_float, f_asin}, {"assert_beeps", 1, 1, FEARG_1, arg1_string, ret_number_bool, f_assert_beeps}, {"assert_equal", 2, 3, FEARG_2, NULL, @@ -1604,9 +1599,9 @@ static funcentry_T global_functions[] = {"assert_true", 1, 2, FEARG_1, NULL, ret_number_bool, f_assert_true}, {"atan", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_atan)}, + ret_float, f_atan}, {"atan2", 2, 2, FEARG_1, arg2_float_or_nr, - ret_float, FLOAT_FUNC(f_atan2)}, + ret_float, f_atan2}, {"autocmd_add", 1, 1, FEARG_1, arg1_list_any, ret_number_bool, f_autocmd_add}, {"autocmd_delete", 1, 1, FEARG_1, arg1_list_any, @@ -1676,7 +1671,7 @@ static funcentry_T global_functions[] = {"call", 2, 3, FEARG_1, arg3_any_list_dict, ret_any, f_call}, {"ceil", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_ceil)}, + ret_float, f_ceil}, {"ch_canread", 1, 1, FEARG_1, arg1_chan_or_job, ret_number_bool, JOB_FUNC(f_ch_canread)}, {"ch_close", 1, 1, FEARG_1, arg1_chan_or_job, @@ -1744,9 +1739,9 @@ static funcentry_T global_functions[] = {"copy", 1, 1, FEARG_1, NULL, ret_copy, f_copy}, {"cos", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_cos)}, + ret_float, f_cos}, {"cosh", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_cosh)}, + ret_float, f_cosh}, {"count", 2, 4, FEARG_1, arg24_count, ret_number, f_count}, {"cscope_connection",0,3, 0, arg3_number_string_string, @@ -1804,7 +1799,7 @@ static funcentry_T global_functions[] = {"exists_compiled", 1, 1, FEARG_1, arg1_string, ret_number_bool, f_exists_compiled}, {"exp", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_exp)}, + ret_float, f_exp}, {"expand", 1, 3, FEARG_1, arg3_string_bool_bool, ret_any, f_expand}, {"expandcmd", 1, 2, FEARG_1, arg2_string_dict, @@ -1832,11 +1827,11 @@ static funcentry_T global_functions[] = {"flattennew", 1, 2, FEARG_1, arg2_list_any_number, ret_list_any, f_flattennew}, {"float2nr", 1, 1, FEARG_1, arg1_float_or_nr, - ret_number, FLOAT_FUNC(f_float2nr)}, + ret_number, f_float2nr}, {"floor", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_floor)}, + ret_float, f_floor}, {"fmod", 2, 2, FEARG_1, arg2_float_or_nr, - ret_float, FLOAT_FUNC(f_fmod)}, + ret_float, f_fmod}, {"fnameescape", 1, 1, FEARG_1, arg1_string, ret_string, f_fnameescape}, {"fnamemodify", 2, 2, FEARG_1, arg2_string, @@ -2088,9 +2083,9 @@ static funcentry_T global_functions[] = {"localtime", 0, 0, 0, NULL, ret_number, f_localtime}, {"log", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_log)}, + ret_float, f_log}, {"log10", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_log10)}, + ret_float, f_log10}, {"luaeval", 1, 2, FEARG_1, arg2_string_any, ret_any, #ifdef FEAT_LUA @@ -2216,7 +2211,7 @@ static funcentry_T global_functions[] = {"popup_show", 1, 1, FEARG_1, arg1_number, ret_void, PROP_FUNC(f_popup_show)}, {"pow", 2, 2, FEARG_1, arg2_float_or_nr, - ret_float, FLOAT_FUNC(f_pow)}, + ret_float, f_pow}, {"prevnonblank", 1, 1, FEARG_1, arg1_lnum, ret_number, f_prevnonblank}, {"printf", 1, 19, FEARG_2, arg119_printf, @@ -2300,7 +2295,7 @@ static funcentry_T global_functions[] = {"reltime", 0, 2, FEARG_1, arg2_list_number, ret_list_any, f_reltime}, {"reltimefloat", 1, 1, FEARG_1, arg1_list_number, - ret_float, FLOAT_FUNC(f_reltimefloat)}, + ret_float, f_reltimefloat}, {"reltimestr", 1, 1, FEARG_1, arg1_list_number, ret_string, f_reltimestr}, {"remote_expr", 2, 4, FEARG_1, arg24_remote_expr, @@ -2326,7 +2321,7 @@ static funcentry_T global_functions[] = {"reverse", 1, 1, FEARG_1, arg1_list_or_blob, ret_first_arg, f_reverse}, {"round", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_round)}, + ret_float, f_round}, {"rubyeval", 1, 1, FEARG_1, arg1_string, ret_any, #ifdef FEAT_RUBY @@ -2438,9 +2433,9 @@ static funcentry_T global_functions[] = {"simplify", 1, 1, FEARG_1, arg1_string, ret_string, f_simplify}, {"sin", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_sin)}, + ret_float, f_sin}, {"sinh", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_sinh)}, + ret_float, f_sinh}, {"slice", 2, 3, FEARG_1, arg23_slice, ret_slice, f_slice}, {"sort", 1, 3, FEARG_1, arg13_sortuniq, @@ -2462,13 +2457,13 @@ static funcentry_T global_functions[] = {"split", 1, 3, FEARG_1, arg3_string_string_bool, ret_list_string, f_split}, {"sqrt", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_sqrt)}, + ret_float, f_sqrt}, {"srand", 0, 1, FEARG_1, arg1_number, ret_list_number, f_srand}, {"state", 0, 1, FEARG_1, arg1_string, ret_string, f_state}, {"str2float", 1, 2, FEARG_1, arg2_string_bool, - ret_float, FLOAT_FUNC(f_str2float)}, + ret_float, f_str2float}, {"str2list", 1, 2, FEARG_1, arg2_string_bool, ret_list_number, f_str2list}, {"str2nr", 1, 3, FEARG_1, arg3_string_number_bool, @@ -2546,9 +2541,9 @@ static funcentry_T global_functions[] = {"taglist", 1, 2, FEARG_1, arg2_string, ret_list_dict_any, f_taglist}, {"tan", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_tan)}, + ret_float, f_tan}, {"tanh", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_tanh)}, + ret_float, f_tanh}, {"tempname", 0, 0, 0, NULL, ret_string, f_tempname}, {"term_dumpdiff", 2, 3, FEARG_1, arg3_string_string_dict, @@ -2680,7 +2675,7 @@ static funcentry_T global_functions[] = {"trim", 1, 3, FEARG_1, arg3_string_string_number, ret_string, f_trim}, {"trunc", 1, 1, FEARG_1, arg1_float_or_nr, - ret_float, FLOAT_FUNC(f_trunc)}, + ret_float, f_trunc}, {"type", 1, 1, FEARG_1, NULL, ret_number, f_type}, {"typename", 1, 1, FEARG_1, NULL, @@ -3670,10 +3665,8 @@ f_empty(typval_T *argvars, typval_T *ret n = argvars[0].vval.v_number == 0; break; case VAR_FLOAT: -#ifdef FEAT_FLOAT n = argvars[0].vval.v_float == 0.0; break; -#endif case VAR_LIST: n = argvars[0].vval.v_list == NULL || argvars[0].vval.v_list->lv_len == 0; @@ -5644,13 +5637,7 @@ f_has(typval_T *argvars, typval_T *rettv 0 #endif }, - {"float", -#ifdef FEAT_FLOAT - 1 -#else - 0 -#endif - }, + {"float", 1}, {"folding", #ifdef FEAT_FOLDING 1 diff --git a/src/ex_cmds.c b/src/ex_cmds.c --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -14,9 +14,7 @@ #include "vim.h" #include "version.h" -#ifdef FEAT_FLOAT -# include -#endif +#include static int linelen(int *has_tab); static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, int do_in, int do_out); @@ -275,9 +273,7 @@ static int sort_lc; // sort using locale static int sort_ic; // ignore case static int sort_nr; // sort on number static int sort_rx; // sort on regex instead of skipping it -#ifdef FEAT_FLOAT static int sort_flt; // sort on floating number -#endif static int sort_abort; // flag to indicate if sorting has been interrupted @@ -296,9 +292,7 @@ typedef struct varnumber_T value; // value if sorting by integer int is_number; // TRUE when line contains a number } num; -#ifdef FEAT_FLOAT float_T value_flt; // value if sorting by float -#endif } st_u; } sorti_T; @@ -334,11 +328,9 @@ sort_compare(const void *s1, const void result = l1.st_u.num.value == l2.st_u.num.value ? 0 : l1.st_u.num.value > l2.st_u.num.value ? 1 : -1; } -#ifdef FEAT_FLOAT else if (sort_flt) result = l1.st_u.value_flt == l2.st_u.value_flt ? 0 : l1.st_u.value_flt > l2.st_u.value_flt ? 1 : -1; -#endif else { // We need to copy one line into "sortbuf1", because there is no @@ -399,9 +391,7 @@ ex_sort(exarg_T *eap) goto sortend; sort_abort = sort_ic = sort_lc = sort_rx = sort_nr = 0; -#ifdef FEAT_FLOAT sort_flt = 0; -#endif for (p = eap->arg; *p != NUL; ++p) { @@ -418,13 +408,11 @@ ex_sort(exarg_T *eap) sort_nr = 1; ++format_found; } -#ifdef FEAT_FLOAT else if (*p == 'f') { sort_flt = 1; ++format_found; } -#endif else if (*p == 'b') { sort_what = STR2NR_BIN + STR2NR_FORCE; @@ -521,11 +509,7 @@ ex_sort(exarg_T *eap) if (regmatch.regprog != NULL) end_col = 0; - if (sort_nr -#ifdef FEAT_FLOAT - || sort_flt -#endif - ) + if (sort_nr || sort_flt) { // Make sure vim_str2nr doesn't read any digits past the end // of the match, by temporarily terminating the string there @@ -558,7 +542,6 @@ ex_sort(exarg_T *eap) NULL, 0, FALSE); } } -#ifdef FEAT_FLOAT else { s = skipwhite(p); @@ -572,7 +555,6 @@ ex_sort(exarg_T *eap) nrs[lnum - eap->line1].st_u.value_flt = strtod((char *)s, NULL); } -#endif *s2 = c; } else diff --git a/src/feature.h b/src/feature.h --- a/src/feature.h +++ b/src/feature.h @@ -121,6 +121,7 @@ * +wildignore 'wildignore' and 'backupskip' options * +wildmenu 'wildmenu' option * +builtin_terms all builtin termcap entries included + * +float Floating point variables. * * Obsolete: * +tag_old_static Old style static tags: "file:tag file ..". @@ -251,13 +252,9 @@ /* * +eval Built-in script language and expression evaluation, * ":let", ":if", etc. - * +float Floating point variables. */ #ifdef FEAT_NORMAL # define FEAT_EVAL -# if defined(HAVE_FLOAT_FUNCS) || defined(MSWIN) || defined(MACOS_X) -# define FEAT_FLOAT -# endif #endif #ifdef FEAT_EVAL diff --git a/src/float.c b/src/float.c --- a/src/float.c +++ b/src/float.c @@ -14,7 +14,7 @@ #include "vim.h" -#if (defined(FEAT_EVAL) && defined(FEAT_FLOAT)) || defined(PROTO) +#if defined(FEAT_EVAL) || defined(PROTO) #ifdef VMS # include diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -3598,7 +3598,7 @@ gui_mch_init(void) { gnome_program_init(VIMPACKAGE, VIM_VERSION_SHORT, LIBGNOMEUI_MODULE, gui_argc, gui_argv, NULL); -# if defined(FEAT_FLOAT) && defined(LC_NUMERIC) +# if defined(LC_NUMERIC) { char *p = setlocale(LC_NUMERIC, NULL); diff --git a/src/gui_x11.c b/src/gui_x11.c --- a/src/gui_x11.c +++ b/src/gui_x11.c @@ -1184,7 +1184,7 @@ gui_mch_init_check(void) cmdline_options, XtNumber(cmdline_options), CARDINAL &gui_argc, gui_argv); -# if defined(FEAT_FLOAT) && defined(LC_NUMERIC) +# if defined(LC_NUMERIC) { // The call to XtOpenDisplay() may have set the locale from the // environment. Set LC_NUMERIC to "C" to make sure that strtod() uses a diff --git a/src/if_lua.c b/src/if_lua.c --- a/src/if_lua.c +++ b/src/if_lua.c @@ -559,11 +559,9 @@ luaV_pushtypval(lua_State *L, typval_T * case VAR_NUMBER: lua_pushinteger(L, (int) tv->vval.v_number); break; -#ifdef FEAT_FLOAT case VAR_FLOAT: lua_pushnumber(L, (lua_Number) tv->vval.v_float); break; -#endif case VAR_LIST: luaV_pushlist(L, tv->vval.v_list); break; @@ -619,7 +617,6 @@ luaV_totypval(lua_State *L, int pos, typ tv->vval.v_string = vim_strsave((char_u *) lua_tostring(L, pos)); break; case LUA_TNUMBER: -#ifdef FEAT_FLOAT { const lua_Number n = lua_tonumber(L, pos); @@ -635,10 +632,6 @@ luaV_totypval(lua_State *L, int pos, typ tv->vval.v_number = (varnumber_T)n; } } -#else - tv->v_type = VAR_NUMBER; - tv->vval.v_number = (varnumber_T) lua_tointeger(L, pos); -#endif break; case LUA_TFUNCTION: { diff --git a/src/if_mzsch.c b/src/if_mzsch.c --- a/src/if_mzsch.c +++ b/src/if_mzsch.c @@ -3009,13 +3009,11 @@ vim_to_mzscheme_impl(typval_T *vim_value result = scheme_make_integer((long)vim_value->vval.v_number); MZ_GC_CHECK(); } -# ifdef FEAT_FLOAT else if (vim_value->v_type == VAR_FLOAT) { result = scheme_make_double((double)vim_value->vval.v_float); MZ_GC_CHECK(); } -# endif else if (vim_value->v_type == VAR_LIST) { list_T *list = vim_value->vval.v_list; @@ -3208,13 +3206,11 @@ mzscheme_to_vim_impl(Scheme_Object *obj, tv->v_type = VAR_BOOL; tv->vval.v_number = SCHEME_TRUEP(obj); } -# ifdef FEAT_FLOAT else if (SCHEME_DBLP(obj)) { tv->v_type = VAR_FLOAT; tv->vval.v_float = SCHEME_DBL_VAL(obj); } -# endif else if (SCHEME_BYTE_STRINGP(obj)) { tv->v_type = VAR_STRING; diff --git a/src/if_py_both.h b/src/if_py_both.h --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -761,7 +761,6 @@ VimToPython(typval_T *our_tv, int depth, sprintf(buf, "%ld", (long)our_tv->vval.v_number); ret = PyString_FromString((char *)buf); } -#ifdef FEAT_FLOAT else if (our_tv->v_type == VAR_FLOAT) { char buf[NUMBUFLEN]; @@ -769,7 +768,6 @@ VimToPython(typval_T *our_tv, int depth, sprintf(buf, "%f", our_tv->vval.v_float); ret = PyString_FromString((char *)buf); } -#endif else if (our_tv->v_type == VAR_LIST) { list_T *list = our_tv->vval.v_list; @@ -6329,13 +6327,11 @@ ConvertFromPyObject(PyObject *obj, typva } else if (PyDict_Check(obj)) return convert_dl(obj, tv, pydict_to_tv, lookup_dict); -#ifdef FEAT_FLOAT else if (PyFloat_Check(obj)) { tv->v_type = VAR_FLOAT; tv->vval.v_float = (float_T) PyFloat_AsDouble(obj); } -#endif else if (PyObject_HasAttrString(obj, "keys")) return convert_dl(obj, tv, pymap_to_tv, lookup_dict); // PyObject_GetIter can create built-in iterator for any sequence object @@ -6388,9 +6384,7 @@ ConvertToPyObject(typval_T *tv) case VAR_NUMBER: return PyLong_FromLong((long) tv->vval.v_number); case VAR_FLOAT: -#ifdef FEAT_FLOAT return PyFloat_FromDouble((double) tv->vval.v_float); -#endif case VAR_LIST: return NEW_LIST(tv->vval.v_list); case VAR_DICT: diff --git a/src/if_ruby.c b/src/if_ruby.c --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -1221,12 +1221,10 @@ vim_to_ruby(typval_T *tv) { result = INT2NUM(tv->vval.v_number); } -# ifdef FEAT_FLOAT else if (tv->v_type == VAR_FLOAT) { result = rb_float_new(tv->vval.v_float); } -# endif else if (tv->v_type == VAR_LIST) { list_T *list = tv->vval.v_list; @@ -1932,12 +1930,10 @@ ruby_convert_to_vim_value(VALUE val, typ rettv->v_type = VAR_NUMBER; rettv->vval.v_number = (varnumber_T)NUM2LONG(val); break; -#ifdef FEAT_FLOAT case T_FLOAT: rettv->v_type = VAR_FLOAT; rettv->vval.v_float = (float_T)NUM2DBL(val); break; -#endif default: val = rb_obj_as_string(val); // FALLTHROUGH diff --git a/src/json.c b/src/json.c --- a/src/json.c +++ b/src/json.c @@ -409,8 +409,7 @@ json_encode_item(garray_T *gap, typval_T break; case VAR_FLOAT: -#ifdef FEAT_FLOAT -# if defined(HAVE_MATH_H) +#if defined(HAVE_MATH_H) if (isnan(val->vval.v_float)) ga_concat(gap, (char_u *)"NaN"); else if (isinf(val->vval.v_float)) @@ -421,14 +420,13 @@ json_encode_item(garray_T *gap, typval_T ga_concat(gap, (char_u *)"Infinity"); } else -# endif +#endif { vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", val->vval.v_float); ga_concat(gap, numbuf); } break; -#endif case VAR_UNKNOWN: case VAR_ANY: case VAR_VOID: @@ -861,7 +859,6 @@ json_decode_item(js_read_T *reader, typv } } sp = skipdigits(sp); -#ifdef FEAT_FLOAT if (*sp == '.' || *sp == 'e' || *sp == 'E') { if (cur_item == NULL) @@ -878,7 +875,6 @@ json_decode_item(js_read_T *reader, typv } } else -#endif { varnumber_T nr; @@ -934,7 +930,6 @@ json_decode_item(js_read_T *reader, typv retval = OK; break; } -#ifdef FEAT_FLOAT if (STRNICMP((char *)p, "NaN", 3) == 0) { reader->js_used += 3; @@ -968,19 +963,19 @@ json_decode_item(js_read_T *reader, typv retval = OK; break; } -#endif // check for truncated name len = (int)(reader->js_end - (reader->js_buf + reader->js_used)); if ( (len < 5 && STRNICMP((char *)p, "false", len) == 0) -#ifdef FEAT_FLOAT - || (len < 9 && STRNICMP((char *)p, "-Infinity", len) == 0) - || (len < 8 && STRNICMP((char *)p, "Infinity", len) == 0) + || (len < 9 + && STRNICMP((char *)p, "-Infinity", len) == 0) + || (len < 8 + && STRNICMP((char *)p, "Infinity", len) == 0) || (len < 3 && STRNICMP((char *)p, "NaN", len) == 0) -#endif - || (len < 4 && (STRNICMP((char *)p, "true", len) == 0 - || STRNICMP((char *)p, "null", len) == 0))) + || (len < 4 + && (STRNICMP((char *)p, "true", len) == 0 + || STRNICMP((char *)p, "null", len) == 0))) retval = MAYBE; else @@ -998,7 +993,6 @@ json_decode_item(js_read_T *reader, typv if (top_item != NULL && top_item->jd_type == JSON_OBJECT_KEY && cur_item != NULL) { -#ifdef FEAT_FLOAT if (cur_item->v_type == VAR_FLOAT) { // cannot use a float as a key @@ -1006,7 +1000,6 @@ json_decode_item(js_read_T *reader, typv retval = FAIL; goto theend; } -#endif top_item->jd_key = tv_get_string_buf_chk(cur_item, key_buf); if (top_item->jd_key == NULL) { diff --git a/src/list.c b/src/list.c --- a/src/list.c +++ b/src/list.c @@ -1876,9 +1876,7 @@ typedef struct int item_compare_lc; int item_compare_numeric; int item_compare_numbers; -#ifdef FEAT_FLOAT int item_compare_float; -#endif char_u *item_compare_func; partial_T *item_compare_partial; dict_T *item_compare_selfdict; @@ -1915,7 +1913,6 @@ item_compare(const void *s1, const void return v1 == v2 ? 0 : v1 > v2 ? 1 : -1; } -#ifdef FEAT_FLOAT if (sortinfo->item_compare_float) { float_T v1 = tv_get_float(tv1); @@ -1923,7 +1920,6 @@ item_compare(const void *s1, const void return v1 == v2 ? 0 : v1 > v2 ? 1 : -1; } -#endif // tv2string() puts quotes around a string and allocates memory. Don't do // that for string variables. Use a single quote when comparing with a @@ -2160,9 +2156,7 @@ parse_sort_uniq_args(typval_T *argvars, info->item_compare_lc = FALSE; info->item_compare_numeric = FALSE; info->item_compare_numbers = FALSE; -#ifdef FEAT_FLOAT info->item_compare_float = FALSE; -#endif info->item_compare_func = NULL; info->item_compare_partial = NULL; info->item_compare_selfdict = NULL; @@ -2215,13 +2209,11 @@ parse_sort_uniq_args(typval_T *argvars, info->item_compare_func = NULL; info->item_compare_numbers = TRUE; } -#ifdef FEAT_FLOAT else if (STRCMP(info->item_compare_func, "f") == 0) { info->item_compare_func = NULL; info->item_compare_float = TRUE; } -#endif else if (STRCMP(info->item_compare_func, "i") == 0) { info->item_compare_func = NULL; diff --git a/src/locale.c b/src/locale.c --- a/src/locale.c +++ b/src/locale.c @@ -225,7 +225,7 @@ init_locale(void) // Tell Gtk not to change our locale settings. gtk_disable_setlocale(); # endif -# if defined(FEAT_FLOAT) && defined(LC_NUMERIC) +# if defined(LC_NUMERIC) // Make sure strtod() uses a decimal point, not a comma. setlocale(LC_NUMERIC, "C"); # endif @@ -333,7 +333,7 @@ ex_language(exarg_T *eap) # endif { loc = setlocale(what, (char *)name); -# if defined(FEAT_FLOAT) && defined(LC_NUMERIC) +# if defined(LC_NUMERIC) // Make sure strtod() uses a decimal point, not a comma. setlocale(LC_NUMERIC, "C"); # endif diff --git a/src/macros.h b/src/macros.h --- a/src/macros.h +++ b/src/macros.h @@ -261,7 +261,7 @@ # define MESSAGE_QUEUE #endif -#if defined(FEAT_EVAL) && defined(FEAT_FLOAT) +#if defined(FEAT_EVAL) # include # if defined(HAVE_MATH_H) // for isnan() and isinf() diff --git a/src/message_test.c b/src/message_test.c --- a/src/message_test.c +++ b/src/message_test.c @@ -211,7 +211,6 @@ test_vim_snprintf(void) assert(bsize == 0 || STRNCMP(buf, "001100", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); -#ifdef FEAT_FLOAT n = vim_snprintf(buf, bsize, "%f", 1.234); assert(n == 8); assert(bsize == 0 || STRNCMP(buf, "1.234000", bsize_int) == 0); @@ -241,7 +240,6 @@ test_vim_snprintf(void) assert(n == 9); assert(bsize == 0 || STRNCMP(buf, "-0.000000", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); -#endif n = vim_snprintf(buf, bsize, "%s", "漢語"); assert(n == 6); diff --git a/src/os_mac_conv.c b/src/os_mac_conv.c --- a/src/os_mac_conv.c +++ b/src/os_mac_conv.c @@ -585,7 +585,7 @@ mac_lang_init(void) # ifdef HAVE_LOCALE_H setlocale(LC_ALL, ""); # endif -# if defined(FEAT_FLOAT) && defined(LC_NUMERIC) +# if defined(LC_NUMERIC) // Make sure strtod() uses a decimal point, not a comma. setlocale(LC_NUMERIC, "C"); # endif diff --git a/src/os_vms_conf.h b/src/os_vms_conf.h --- a/src/os_vms_conf.h +++ b/src/os_vms_conf.h @@ -110,7 +110,6 @@ #define HAVE_SETENV #define HAVE_SETJMP_H #define HAVE_MATH_H -#define HAVE_FLOAT_FUNCS #define HAVE_GETTIMEOFDAY #define HAVE_PWD_H #define HAVE_NETDB_H diff --git a/src/profiler.c b/src/profiler.c --- a/src/profiler.c +++ b/src/profiler.c @@ -90,23 +90,21 @@ profile_msg(proftime_T *tm) return buf; } -# if defined(FEAT_FLOAT) || defined(PROTO) /* * Return a float that represents the time in "tm". */ float_T profile_float(proftime_T *tm) { -# ifdef MSWIN +# ifdef MSWIN LARGE_INTEGER fr; QueryPerformanceFrequency(&fr); return (float_T)tm->QuadPart / (float_T)fr.QuadPart; -# else +# else return (float_T)tm->tv_sec + (float_T)tm->tv_usec / 1000000.0; -# endif +# endif } -# endif /* * Put the time "msec" past now in "tm". @@ -173,7 +171,7 @@ profile_zero(proftime_T *tm) # endif // FEAT_PROFILE || FEAT_RELTIME -#if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_FLOAT) && defined(FEAT_PROFILE) +#if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_PROFILE) # if defined(HAVE_MATH_H) # include # endif diff --git a/src/session.c b/src/session.c --- a/src/session.c +++ b/src/session.c @@ -577,7 +577,6 @@ store_session_globals(FILE *fd) } vim_free(p); } -#ifdef FEAT_FLOAT else if (this_var->di_tv.v_type == VAR_FLOAT && var_flavour(this_var->di_key) == VAR_FLAVOUR_SESSION) { @@ -594,7 +593,6 @@ store_session_globals(FILE *fd) || put_eol(fd) == FAIL) return FAIL; } -#endif } } return OK; diff --git a/src/strings.c b/src/strings.c --- a/src/strings.c +++ b/src/strings.c @@ -1895,7 +1895,6 @@ tv_str(typval_T *tvs, int *idxp, char_u return s; } -# ifdef FEAT_FLOAT /* * Get float argument from "idxp" entry in "tvs". First entry is 1. */ @@ -1919,11 +1918,9 @@ tv_float(typval_T *tvs, int *idxp) } return f; } -# endif #endif -#ifdef FEAT_FLOAT /* * Return the representation of infinity for printf() function: * "-inf", "inf", "+inf", " inf", "-INF", "INF", "+INF" or " INF". @@ -1945,7 +1942,6 @@ infinity_str(int positive, idx += 4; return table[idx]; } -#endif /* * This code was included to provide a portable vsnprintf() and snprintf(). @@ -2079,13 +2075,9 @@ vim_vsnprintf_typval( char length_modifier = '\0'; // temporary buffer for simple numeric->string conversion -# if defined(FEAT_FLOAT) -# define TMP_LEN 350 // On my system 1e308 is the biggest number possible. +# define TMP_LEN 350 // On my system 1e308 is the biggest number possible. // That sounds reasonable to use as the maximum // printable. -# else -# define TMP_LEN 66 -# endif char tmp[TMP_LEN]; // string address in case of string argument @@ -2637,7 +2629,6 @@ vim_vsnprintf_typval( break; } -# ifdef FEAT_FLOAT case 'f': case 'F': case 'e': @@ -2653,9 +2644,9 @@ vim_vsnprintf_typval( int remove_trailing_zeroes = FALSE; f = -# if defined(FEAT_EVAL) +# if defined(FEAT_EVAL) tvs != NULL ? tv_float(tvs, &arg_idx) : -# endif +# endif va_arg(ap, double); abs_f = f < 0 ? -f : f; @@ -2672,11 +2663,11 @@ vim_vsnprintf_typval( } if ((fmt_spec == 'f' || fmt_spec == 'F') && -# ifdef VAX +# ifdef VAX abs_f > 1.0e38 -# else +# else abs_f > 1.0e307 -# endif +# endif ) { // Avoid a buffer overflow @@ -2801,7 +2792,6 @@ vim_vsnprintf_typval( str_arg = tmp; break; } -# endif default: // unrecognized conversion specifier, keep format string diff --git a/src/structs.h b/src/structs.h --- a/src/structs.h +++ b/src/structs.h @@ -1460,9 +1460,7 @@ typedef struct union { varnumber_T v_number; // number value -#ifdef FEAT_FLOAT float_T v_float; // floating number value -#endif char_u *v_string; // string value (can be NULL!) list_T *v_list; // list value (can be NULL!) dict_T *v_dict; // dict value (can be NULL!) diff --git a/src/syntax.c b/src/syntax.c --- a/src/syntax.c +++ b/src/syntax.c @@ -6694,7 +6694,7 @@ syntime_report(void) { int idx; synpat_T *spp; -# if defined(FEAT_RELTIME) && defined(FEAT_FLOAT) +# if defined(FEAT_RELTIME) proftime_T tm; # endif int len; @@ -6724,7 +6724,7 @@ syntime_report(void) p->match = spp->sp_time.match; total_count += spp->sp_time.count; p->slowest = spp->sp_time.slowest; -# if defined(FEAT_RELTIME) && defined(FEAT_FLOAT) +# if defined(FEAT_RELTIME) profile_divide(&spp->sp_time.total, spp->sp_time.count, &tm); p->average = tm; # endif @@ -6758,10 +6758,8 @@ syntime_report(void) msg_puts(profile_msg(&p->slowest)); msg_puts(" "); msg_advance(38); -# ifdef FEAT_FLOAT msg_puts(profile_msg(&p->average)); msg_puts(" "); -# endif msg_advance(50); msg_outtrans(highlight_group_name(p->id - 1)); msg_puts(" "); diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim --- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -283,11 +283,11 @@ func RunTheTest(test) if has('reltime') let message ..= repeat(' ', 50 - len(message)) let time = reltime(func_start) - if has('float') && reltimefloat(time) > 0.1 + if reltimefloat(time) > 0.1 let message = s:t_bold .. message endif let message ..= ' in ' .. reltimestr(time) .. ' seconds' - if has('float') && reltimefloat(time) > 0.1 + if reltimefloat(time) > 0.1 let message ..= s:t_normal endif endif diff --git a/src/testdir/test_assert.vim b/src/testdir/test_assert.vim --- a/src/testdir/test_assert.vim +++ b/src/testdir/test_assert.vim @@ -352,21 +352,19 @@ func Test_assert_inrange() call assert_fails('call assert_inrange(1, 1)', 'E119:') - if has('float') - call assert_equal(0, assert_inrange(7.0, 7, 7)) - call assert_equal(0, assert_inrange(7, 7.0, 7)) - call assert_equal(0, assert_inrange(7, 7, 7.0)) - call assert_equal(0, assert_inrange(5, 7, 5.0)) - call assert_equal(0, assert_inrange(5, 7, 6.0)) - call assert_equal(0, assert_inrange(5, 7, 7.0)) + call assert_equal(0, assert_inrange(7.0, 7, 7)) + call assert_equal(0, assert_inrange(7, 7.0, 7)) + call assert_equal(0, assert_inrange(7, 7, 7.0)) + call assert_equal(0, assert_inrange(5, 7, 5.0)) + call assert_equal(0, assert_inrange(5, 7, 6.0)) + call assert_equal(0, assert_inrange(5, 7, 7.0)) - call assert_equal(1, assert_inrange(5, 7, 4.0)) - call assert_match("Expected range 5.0 - 7.0, but got 4.0", v:errors[0]) - call remove(v:errors, 0) - call assert_equal(1, assert_inrange(5, 7, 8.0)) - call assert_match("Expected range 5.0 - 7.0, but got 8.0", v:errors[0]) - call remove(v:errors, 0) - endif + call assert_equal(1, assert_inrange(5, 7, 4.0)) + call assert_match("Expected range 5.0 - 7.0, but got 4.0", v:errors[0]) + call remove(v:errors, 0) + call assert_equal(1, assert_inrange(5, 7, 8.0)) + call assert_match("Expected range 5.0 - 7.0, but got 8.0", v:errors[0]) + call remove(v:errors, 0) endfunc func Test_assert_with_msg() diff --git a/src/testdir/test_blob.vim b/src/testdir/test_blob.vim --- a/src/testdir/test_blob.vim +++ b/src/testdir/test_blob.vim @@ -669,9 +669,7 @@ func Test_blob_lock() endfunc func Test_blob_sort() - if has('float') - call v9.CheckLegacyAndVim9Failure(['call sort([1.0, 0z11], "f")'], 'E975:') - endif + call v9.CheckLegacyAndVim9Failure(['call sort([1.0, 0z11], "f")'], 'E975:') call v9.CheckLegacyAndVim9Failure(['call sort([11, 0z11], "N")'], 'E974:') endfunc diff --git a/src/testdir/test_cscope.vim b/src/testdir/test_cscope.vim --- a/src/testdir/test_cscope.vim +++ b/src/testdir/test_cscope.vim @@ -122,25 +122,23 @@ func Test_cscopeWithCscopeConnections() call assert_fails('cs find', 'E560:') call assert_fails('cs find x', 'E560:') - if has('float') - " Test: Find places where this symbol is assigned a value - " this needs a cscope >= 15.8 - " unfortunately, Travis has cscope version 15.7 - let cscope_version = systemlist('cscope --version')[0] - let cs_version = str2float(matchstr(cscope_version, '\d\+\(\.\d\+\)\?')) - if cs_version >= 15.8 - for cmd in ['cs find a item', 'cs find 9 item'] - let a = execute(cmd) - call assert_equal(['', '(1 of 4): <> item = LALLOC_CLEAR_ONE(mf_hashitem_T);'], split(a, '\n', 1)) - call assert_equal(' item = LALLOC_CLEAR_ONE(mf_hashitem_T);', getline('.')) - cnext - call assert_equal(' item = mf_hash_find(&ht, key);', getline('.')) - cnext - call assert_equal(' item = mf_hash_find(&ht, key);', getline('.')) - cnext - call assert_equal(' item = mf_hash_find(&ht, key);', getline('.')) - endfor - endif + " Test: Find places where this symbol is assigned a value + " this needs a cscope >= 15.8 + " unfortunately, Travis has cscope version 15.7 + let cscope_version = systemlist('cscope --version')[0] + let cs_version = str2float(matchstr(cscope_version, '\d\+\(\.\d\+\)\?')) + if cs_version >= 15.8 + for cmd in ['cs find a item', 'cs find 9 item'] + let a = execute(cmd) + call assert_equal(['', '(1 of 4): <> item = LALLOC_CLEAR_ONE(mf_hashitem_T);'], split(a, '\n', 1)) + call assert_equal(' item = LALLOC_CLEAR_ONE(mf_hashitem_T);', getline('.')) + cnext + call assert_equal(' item = mf_hash_find(&ht, key);', getline('.')) + cnext + call assert_equal(' item = mf_hash_find(&ht, key);', getline('.')) + cnext + call assert_equal(' item = mf_hash_find(&ht, key);', getline('.')) + endfor endif " Test: leading whitespace is not removed for cscope find text diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim index 7d8421b7250d54f0a0dcd39338a729c2faeff781..33ab45fcd4a16e6fa59e34d1df278e963abef02b GIT binary patch literal 26144 zc%02${c__ta?ii#2iW|JWiCVcV#}f=du*5Gia+GtsqD>O&1_9=mF-ed6eRJ6B6TF? zkDJ}9JWU=UFOWCMlcXB}L4X7(dS*6zzFSEIx*NZ4G#U+%#5m+9n&lapCn~x+aon7Kj zlQiEUBu}5=laQ3=n=~f3_hd98JtzwNJXoq#9$e6Ph79mk2;`y}&Ix0gaPrAxm@g+Z zO_Q{<%fv+y@w1Gk`Go#$<3}BDuK=@K2vmi|Ng*!Flax-fFrqQ=uCfIa$gjVZ3gpW) zd1N39I$-2~& z6?EL6+4lkP<#Yz(+_hUZMV@YGC(MA12B7A1m1%cZ=_7~yls-eplRP0S|05;zDa>*# zDELE~ky%2s*v$#EJ>#omD#5fw3>GB^RF9&y&rE}8q# zMKk8Seq6`;%tXshagY3@jJwW7`@w#SRM38k{ zMMI~gb~sGbk||bl&uBz*+A&Jj>ySB}*V^UI)Y}t{=FFcrQ8dZ&6ifgfza8oAeF3d^ z+D0*d8h}P<5y?3`L{8mduaiF`{WXm`vA?1fm-SDv5c~alyQ^~I+K?z)xR}juu$#VG zLv;smbNZCKpfsl;-7awtM332Ey`w=hq<3FIcW9)Q`Y&ngOVn2a)r`(5enu={IppU& zS>veBS8Ebx1Y({KqaOk)%r@NJXL}@0@`8|rc}AmoHQ4b=^gKl;#ob(`oi=e$$TJL; zC^OS?$-6sDt7}A#Gaef&WJ&{nlTqRTjYEPY&LPBS#K|^OXA9T^p!pKOR?-4*HMA(T zMSOXQN-Vh5bt>HPYxP50wN!G12JSWUrxhT=Y1`Z43!PSv2EUhUJ|^i$%;;zgz?02l z+0s3$n7`CRzdmk@4=Pdd|Ig-zK#0lQ1kr}^#z&P{Czy3ilCF}tSOUSSA&g^i%@^=~a((xdocyY>08cn) zi!VYByo1Ao{y}zd7xOGR#MlMvxzvBOX_-90ysqV$qC+$Pflerpj>s$c!qpR$!mm-7 zCCA5yCxR}BbHZ1D2sA*T_1u-gE2#f%RICfTrfq&$#Gg%^%RXZ3OENk;gXJEK)A8GD zhKLZ)^2by_F4W@IO=9Za3l@o$OQ~dytR-AH2{boJ>T(MwarDf39Bl39+~CEEEJ*!q zSqOW#i9dv^4qt76sQnFj`{Ua&*{5VbBm3`(BAe_7GP!fW4MKi?r!=B>1z1R} zbob8-K$aa13yM81u+q^)3ac~&jPPH-MH8PPxt=Bnxemy^OL0vMlEn{%&wo0f)s$U} zYHOu-@RwtLnZ1tKOH(dz@E8Wj0M#YagccO&rEy9)hF( z9V%87rtoJRap3>tYy|UZzdP(59a?(JWidh8NNJLHMm^!xP&F!u0f@NCLLD(lSv02lVMyBcQwR7Zbj@N z-o6bgaux&2CSiaS!|f9G`%Ox7jHaBE=C~hP>|YwTb7V#ZG;F@oH-IYDZgmUubEO!t z^0^)}9O}B}*{;`xMeKanW;L&! z)x1_#^IBM~G*NZfRrNGGsnSo+4VRvFst{|6|ETE3WZ8XCjJ3(UAvfrqsWkeVOsTwtVtANa%^~kzaa4KjO zCAJb4KO?*=ctE@!{25iyDbLAq&+`uZhsH!;76$pm4+5HHCiAfL`V?c;CwHDC?kVwp zt@|H#WRJXhg``~|Gotb|0!x<-8@p`S$}xv^#}qE}dXMzH*Op3%7rmsh_D5^&F$z95 zR~~vEN`C#?!hAG@>Z#}Udi?*ECVIo;!`DYZ`s6hd4*IW;j+rW3t8TrI`^SLV3fLe4iZi4Y0Gu)`N ztu6$yvZEJ4*zIh;%Uox~2qqbg^NfXY8YNS~c=B3=>N=IO)7VNXtkZFUULfk9v_rIs zKgP*pT;S=6ZQF28SakbqGF6|D*aqUSrDlbsmYl)Tk7F8Dx%r;2>B*SQY6_VzEHo#p zFrH-L->JMY5aKQRn_$w@4BY8txo@mRmHvyy&55#UeCL#asu*`ZI$c+ZY?yiI0`T!r|$rI<6 zk={G?5=|gh-o=hp;|-57$4 zmEEyc946T2(d$hvoVvJ|P;7b^k;4%i*l_}*B>I*lqtRUq|Is_gfz?j&C;#eG| zxV5nmJLrAB{n~N==yGQiTd<~ylKIqR>Stk4MrdBzfo0ep^Oy_#4$3I3+R9gLbs>#) zA-h2@Gsr*_F)_F9h*^Gwv?JW_uL8O#00j+*E;K}px`e=)B{oZKYm|(k8ES+-q6VlR zG^mV4aa^Ue0=t>AjS3YeRBDUa`|jQg%q|deP9x4zu2Hv^oGd68YW|C#>#$78?ZVU<3F4qYM2;j z1sIoh-4b9CP4H#er3jrC@_vtvNqK(UN~l@1e@m!(NO2>)AEn zlA84ptu@%;MN&S)CZxq5<0E=ob@K%R&{ad&57e-KrG)S+X@hF1O{YK)=U4V1epQe( zO-NT2WQ<;eB84bO8>wD`T*BL;LeunrrN+P#9Ah&flp^a2wc%-_-pI^t)Nv-NuX#@x zRh+54bgdZvS}IX3wZWX}y>M+e{&hjZqq-egC8%FBJ6=x}I8xAkE1EXg(Ztu~5JkSa z3RFlPH)udh4Tb{USi%}h#Cn+xA*~=B8!bC7U^Q8GT(|6)S#3O3ph!XYt!P@~E-gDY zT2@MJ3NB2A4;5hiON}17Ik?cOI&HbyC}?4}4urX&xhZ<&;oQ^?C#<;Ajl_E+b<)dh zi073qxiMn9DX=v~$Qw0XxnZWf2^0`g#Ctm8Y0 z>pKZqFS9{hR3Ls=%=89)OM&nEvfBZH5#-VU@_PyBdkIo6vw>VzKz`o<@{Iub#%#Se zYR|ust-q0o^fDWwHx)#03M>w}Sg&!XGhUFlKkz3w1vLBSLcijwwM4Y<>Wi>is@1Oq zo!VU5uS}-3387z!ytT33Hx2fh>-KBDTl1d2*?npq*muqAa0g;ui@k)tx-p=vu50DC zKEBW+B=042K)e*N>=EZu&B-oR47_v8)ZbWV!+2Ru=s8GR>S#5cp7jC*HJ8-^+G=eO zuPRwCr*BNMgefhP=(U#n>1eKXthQPk*6T_xxCQID$)sZy=2!3CE@Kn$;OL*Jn=w|-L zyj^&HW3k3;IfZH748^i^V&kU_khJL?kEVG>Ao7WBDNT`g0wnZjYW!~^_CieyD zik`2?pD5NL+)zXcwnW9!pb$I`dtgz#``r*8zmfO7>j6&c&SY&1cdGKD@!wGL3qtEl z{%m1b?*akBzWMR?ht|6w!~LEdFb*#eA&^JJ;r^hk85U(gMUipduYhRPlH{Q0j)Vly$Iu zV$q-0!FI}+&)ZP02BlO@zML2YPGuh8GNh@Q6s1m+Q%*#`JC4>*&3swUjGV^pxnWch zjwPyaydEfZLs?pMd&5IFa&WVD%K3@6pw!`?l%+-YH$9p1jd!B(mSz{NC|840uGWH_ZUs_h zcI7gp(U}ybPLos4@4q{a)=$@9OO@$fOzaNPdy42?Ma+F=*=k0dOdM_FS99q zP*M8880#1n6AEg#!J|Za_+4VEmAAm>0jIkw0 zki>V6#SWvbc2Gp9t;S`$;3VvwITA$SdYbs@Y^QuDP?m}J`(pY?eqqOEeY+#y_tVa$ zk{s-CL>lKAVw8tX5E^CTpeok1|3H~{ic_z}`+Fspt{{9fCo!H;6vvdG>zya$=l%CI zeV}+~23aTI+S3SMjl<(KvSqS~W+dAL0i{9+zSlHC!C*Q(C&vAgE8jJP-@Dp7aaeG# zvn6XhRP9wTmBsLT)%%OUUVC z7~>av&)Hdq4y)^L1*vye(Ok6?o%WQwn#~GxmN4+6<8to@07W-(HVR&c?#5pbWiC5r z2R#OUW;v|URYwzl&(!nmugR*^-V4e3{ZTx+N$^=uL)7^2NUna%6R)+VTA!0GxEzc^ zw~mKBgA)T|K0Y=aF==8ReE~DZ0~U51erlfM=+F&s+Xb66dY*vDa1pPla#~<^nmza_ zzLbdH#o;H5(}gHqD5Vj5AFxumFcp4svs1Ur=znGBPb}b)QT|#{PaHSEnDHEc{83^n zP)NC?6ik?8Qi>*DLpJG>s&pv&n(|EzysQNv+Qen&DVGcNl6Ru<;1EjJ5SqX#vf?~0 zaVqAcpOF+IFNPR=%{!TsEcb(tMyGV>6D2N8X-tEZuBi``eg}|xy*`zNHRoqHysqQm~h+QCB}EXPD2O zla;?l-aQb9(`a#c<%*s0^oWOA!lZ_fKpvNp?WqT(3)J{demaSh3CB9g)-+%z41hsn zJlhxAA!mQy|KI=ouXA#CwVIuao=ZT+ghmjqGw2pP9rf($-FeXsQW@t?Fr%^SM@EQq zKola0dbb?vdRxW6+F@4{_wHFnTGIPeIHBz$(llyc5oD`sXEQ z4HDEg;^~|5%xEMbVS^jqBuG<-j>e{tam>a;G{B9D1F7&h1>V&YKwBMQn~eSA8{mNM zCl?$&3uly^oflpSBQDK_JF+8~*Ga?ibFaCHiqTR6`j!&$x@^+8YupI~J0ZOCYL{tr7PL9qY; diff --git a/src/testdir/test_execute_func.vim b/src/testdir/test_execute_func.vim --- a/src/testdir/test_execute_func.vim +++ b/src/testdir/test_execute_func.vim @@ -38,11 +38,9 @@ func Test_execute_string() call assert_equal("\nsomething", execute('echo "something"', 'silent')) call assert_equal("\nsomething", execute('echo "something"', 'silent!')) call assert_equal("", execute('burp', 'silent!')) - if has('float') - call assert_fails('call execute(3.4)', 'E492:') - call assert_equal("\nx", execute("echo \"x\"", 3.4)) - call v9.CheckDefExecAndScriptFailure(['execute("echo \"x\"", 3.4)'], ['E1013: Argument 2: type mismatch, expected string but got float', 'E1174:']) - endif + call assert_fails('call execute(3.4)', 'E492:') + call assert_equal("\nx", execute("echo \"x\"", 3.4)) + call v9.CheckDefExecAndScriptFailure(['execute("echo \"x\"", 3.4)'], ['E1013: Argument 2: type mismatch, expected string but got float', 'E1174:']) endfunc func Test_execute_list() diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim --- a/src/testdir/test_expr.vim +++ b/src/testdir/test_expr.vim @@ -77,9 +77,7 @@ func Test_op_falsy() call assert_equal(0z00, 0z00 ?? 456) call assert_equal([1], [1] ?? 456) call assert_equal({'one': 1}, {'one': 1} ?? 456) - if has('float') - call assert_equal(0.1, 0.1 ?? 456) - endif + call assert_equal(0.1, 0.1 ?? 456) call assert_equal(456, v:false ?? 456) call assert_equal(456, 0 ?? 456) @@ -87,9 +85,7 @@ func Test_op_falsy() call assert_equal(456, 0z ?? 456) call assert_equal(456, [] ?? 456) call assert_equal(456, {} ?? 456) - if has('float') - call assert_equal(456, 0.0 ?? 456) - endif + call assert_equal(456, 0.0 ?? 456) END call v9.CheckLegacyAndVim9Success(lines) endfunc @@ -200,10 +196,8 @@ func Test_compare_with_null() call assert_false(s:value == v:null) let s:value = 0 call assert_true(s:value == v:null) - if has('float') - let s:value = 0.0 - call assert_true(s:value == v:null) - endif + let s:value = 0.0 + call assert_true(s:value == v:null) let s:value = '' call assert_false(s:value == v:null) let s:value = 0z @@ -467,116 +461,114 @@ func Test_printf_misc() endfunc func Test_printf_float() - if has('float') - let lines =<< trim END - call assert_equal('1.000000', printf('%f', 1)) - call assert_equal('1.230000', printf('%f', 1.23)) - call assert_equal('1.230000', printf('%F', 1.23)) - call assert_equal('9999999.9', printf('%g', 9999999.9)) - call assert_equal('9999999.9', printf('%G', 9999999.9)) - call assert_equal('1.00000001e7', printf('%.8g', 10000000.1)) - call assert_equal('1.00000001E7', printf('%.8G', 10000000.1)) - call assert_equal('1.230000e+00', printf('%e', 1.23)) - call assert_equal('1.230000E+00', printf('%E', 1.23)) - call assert_equal('1.200000e-02', printf('%e', 0.012)) - call assert_equal('-1.200000e-02', printf('%e', -0.012)) - call assert_equal('0.33', printf('%.2f', 1.0 / 3.0)) - call assert_equal(' 0.33', printf('%6.2f', 1.0 / 3.0)) - call assert_equal(' -0.33', printf('%6.2f', -1.0 / 3.0)) - call assert_equal('000.33', printf('%06.2f', 1.0 / 3.0)) - call assert_equal('-00.33', printf('%06.2f', -1.0 / 3.0)) - call assert_equal('-00.33', printf('%+06.2f', -1.0 / 3.0)) - call assert_equal('+00.33', printf('%+06.2f', 1.0 / 3.0)) - call assert_equal(' 00.33', printf('% 06.2f', 1.0 / 3.0)) - call assert_equal('000.33', printf('%06.2g', 1.0 / 3.0)) - call assert_equal('-00.33', printf('%06.2g', -1.0 / 3.0)) - call assert_equal('0.33', printf('%3.2f', 1.0 / 3.0)) - call assert_equal('003.33e-01', printf('%010.2e', 1.0 / 3.0)) - call assert_equal(' 03.33e-01', printf('% 010.2e', 1.0 / 3.0)) - call assert_equal('+03.33e-01', printf('%+010.2e', 1.0 / 3.0)) - call assert_equal('-03.33e-01', printf('%010.2e', -1.0 / 3.0)) + let lines =<< trim END + call assert_equal('1.000000', printf('%f', 1)) + call assert_equal('1.230000', printf('%f', 1.23)) + call assert_equal('1.230000', printf('%F', 1.23)) + call assert_equal('9999999.9', printf('%g', 9999999.9)) + call assert_equal('9999999.9', printf('%G', 9999999.9)) + call assert_equal('1.00000001e7', printf('%.8g', 10000000.1)) + call assert_equal('1.00000001E7', printf('%.8G', 10000000.1)) + call assert_equal('1.230000e+00', printf('%e', 1.23)) + call assert_equal('1.230000E+00', printf('%E', 1.23)) + call assert_equal('1.200000e-02', printf('%e', 0.012)) + call assert_equal('-1.200000e-02', printf('%e', -0.012)) + call assert_equal('0.33', printf('%.2f', 1.0 / 3.0)) + call assert_equal(' 0.33', printf('%6.2f', 1.0 / 3.0)) + call assert_equal(' -0.33', printf('%6.2f', -1.0 / 3.0)) + call assert_equal('000.33', printf('%06.2f', 1.0 / 3.0)) + call assert_equal('-00.33', printf('%06.2f', -1.0 / 3.0)) + call assert_equal('-00.33', printf('%+06.2f', -1.0 / 3.0)) + call assert_equal('+00.33', printf('%+06.2f', 1.0 / 3.0)) + call assert_equal(' 00.33', printf('% 06.2f', 1.0 / 3.0)) + call assert_equal('000.33', printf('%06.2g', 1.0 / 3.0)) + call assert_equal('-00.33', printf('%06.2g', -1.0 / 3.0)) + call assert_equal('0.33', printf('%3.2f', 1.0 / 3.0)) + call assert_equal('003.33e-01', printf('%010.2e', 1.0 / 3.0)) + call assert_equal(' 03.33e-01', printf('% 010.2e', 1.0 / 3.0)) + call assert_equal('+03.33e-01', printf('%+010.2e', 1.0 / 3.0)) + call assert_equal('-03.33e-01', printf('%010.2e', -1.0 / 3.0)) - #" When precision is 0, the dot should be omitted. - call assert_equal(' 2', printf('%3.f', 7.0 / 3.0)) - call assert_equal(' 2', printf('%3.g', 7.0 / 3.0)) - call assert_equal(' 2e+00', printf('%7.e', 7.0 / 3.0)) + #" When precision is 0, the dot should be omitted. + call assert_equal(' 2', printf('%3.f', 7.0 / 3.0)) + call assert_equal(' 2', printf('%3.g', 7.0 / 3.0)) + call assert_equal(' 2e+00', printf('%7.e', 7.0 / 3.0)) - #" Float zero can be signed. - call assert_equal('+0.000000', printf('%+f', 0.0)) - call assert_equal('0.000000', printf('%f', 1.0 / (1.0 / 0.0))) - call assert_equal('-0.000000', printf('%f', 1.0 / (-1.0 / 0.0))) - call assert_equal('0.0', printf('%s', 1.0 / (1.0 / 0.0))) - call assert_equal('-0.0', printf('%s', 1.0 / (-1.0 / 0.0))) - call assert_equal('0.0', printf('%S', 1.0 / (1.0 / 0.0))) - call assert_equal('-0.0', printf('%S', 1.0 / (-1.0 / 0.0))) + #" Float zero can be signed. + call assert_equal('+0.000000', printf('%+f', 0.0)) + call assert_equal('0.000000', printf('%f', 1.0 / (1.0 / 0.0))) + call assert_equal('-0.000000', printf('%f', 1.0 / (-1.0 / 0.0))) + call assert_equal('0.0', printf('%s', 1.0 / (1.0 / 0.0))) + call assert_equal('-0.0', printf('%s', 1.0 / (-1.0 / 0.0))) + call assert_equal('0.0', printf('%S', 1.0 / (1.0 / 0.0))) + call assert_equal('-0.0', printf('%S', 1.0 / (-1.0 / 0.0))) - #" Float infinity can be signed. - call assert_equal('inf', printf('%f', 1.0 / 0.0)) - call assert_equal('-inf', printf('%f', -1.0 / 0.0)) - call assert_equal('inf', printf('%g', 1.0 / 0.0)) - call assert_equal('-inf', printf('%g', -1.0 / 0.0)) - call assert_equal('inf', printf('%e', 1.0 / 0.0)) - call assert_equal('-inf', printf('%e', -1.0 / 0.0)) - call assert_equal('INF', printf('%F', 1.0 / 0.0)) - call assert_equal('-INF', printf('%F', -1.0 / 0.0)) - call assert_equal('INF', printf('%E', 1.0 / 0.0)) - call assert_equal('-INF', printf('%E', -1.0 / 0.0)) - call assert_equal('INF', printf('%E', 1.0 / 0.0)) - call assert_equal('-INF', printf('%G', -1.0 / 0.0)) - call assert_equal('+inf', printf('%+f', 1.0 / 0.0)) - call assert_equal('-inf', printf('%+f', -1.0 / 0.0)) - call assert_equal(' inf', printf('% f', 1.0 / 0.0)) - call assert_equal(' inf', printf('%6f', 1.0 / 0.0)) - call assert_equal(' -inf', printf('%6f', -1.0 / 0.0)) - call assert_equal(' inf', printf('%6g', 1.0 / 0.0)) - call assert_equal(' -inf', printf('%6g', -1.0 / 0.0)) - call assert_equal(' +inf', printf('%+6f', 1.0 / 0.0)) - call assert_equal(' inf', printf('% 6f', 1.0 / 0.0)) - call assert_equal(' +inf', printf('%+06f', 1.0 / 0.0)) - call assert_equal('inf ', printf('%-6f', 1.0 / 0.0)) - call assert_equal('-inf ', printf('%-6f', -1.0 / 0.0)) - call assert_equal('+inf ', printf('%-+6f', 1.0 / 0.0)) - call assert_equal(' inf ', printf('%- 6f', 1.0 / 0.0)) - call assert_equal('-INF ', printf('%-6F', -1.0 / 0.0)) - call assert_equal('+INF ', printf('%-+6F', 1.0 / 0.0)) - call assert_equal(' INF ', printf('%- 6F', 1.0 / 0.0)) - call assert_equal('INF ', printf('%-6G', 1.0 / 0.0)) - call assert_equal('-INF ', printf('%-6G', -1.0 / 0.0)) - call assert_equal('INF ', printf('%-6E', 1.0 / 0.0)) - call assert_equal('-INF ', printf('%-6E', -1.0 / 0.0)) - call assert_equal('inf', printf('%s', 1.0 / 0.0)) - call assert_equal('-inf', printf('%s', -1.0 / 0.0)) + #" Float infinity can be signed. + call assert_equal('inf', printf('%f', 1.0 / 0.0)) + call assert_equal('-inf', printf('%f', -1.0 / 0.0)) + call assert_equal('inf', printf('%g', 1.0 / 0.0)) + call assert_equal('-inf', printf('%g', -1.0 / 0.0)) + call assert_equal('inf', printf('%e', 1.0 / 0.0)) + call assert_equal('-inf', printf('%e', -1.0 / 0.0)) + call assert_equal('INF', printf('%F', 1.0 / 0.0)) + call assert_equal('-INF', printf('%F', -1.0 / 0.0)) + call assert_equal('INF', printf('%E', 1.0 / 0.0)) + call assert_equal('-INF', printf('%E', -1.0 / 0.0)) + call assert_equal('INF', printf('%E', 1.0 / 0.0)) + call assert_equal('-INF', printf('%G', -1.0 / 0.0)) + call assert_equal('+inf', printf('%+f', 1.0 / 0.0)) + call assert_equal('-inf', printf('%+f', -1.0 / 0.0)) + call assert_equal(' inf', printf('% f', 1.0 / 0.0)) + call assert_equal(' inf', printf('%6f', 1.0 / 0.0)) + call assert_equal(' -inf', printf('%6f', -1.0 / 0.0)) + call assert_equal(' inf', printf('%6g', 1.0 / 0.0)) + call assert_equal(' -inf', printf('%6g', -1.0 / 0.0)) + call assert_equal(' +inf', printf('%+6f', 1.0 / 0.0)) + call assert_equal(' inf', printf('% 6f', 1.0 / 0.0)) + call assert_equal(' +inf', printf('%+06f', 1.0 / 0.0)) + call assert_equal('inf ', printf('%-6f', 1.0 / 0.0)) + call assert_equal('-inf ', printf('%-6f', -1.0 / 0.0)) + call assert_equal('+inf ', printf('%-+6f', 1.0 / 0.0)) + call assert_equal(' inf ', printf('%- 6f', 1.0 / 0.0)) + call assert_equal('-INF ', printf('%-6F', -1.0 / 0.0)) + call assert_equal('+INF ', printf('%-+6F', 1.0 / 0.0)) + call assert_equal(' INF ', printf('%- 6F', 1.0 / 0.0)) + call assert_equal('INF ', printf('%-6G', 1.0 / 0.0)) + call assert_equal('-INF ', printf('%-6G', -1.0 / 0.0)) + call assert_equal('INF ', printf('%-6E', 1.0 / 0.0)) + call assert_equal('-INF ', printf('%-6E', -1.0 / 0.0)) + call assert_equal('inf', printf('%s', 1.0 / 0.0)) + call assert_equal('-inf', printf('%s', -1.0 / 0.0)) - #" Test special case where max precision is truncated at 340. - call assert_equal('1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%.330f', 1.0)) - call assert_equal('1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%.340f', 1.0)) - call assert_equal('1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%.350f', 1.0)) + #" Test special case where max precision is truncated at 340. + call assert_equal('1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%.330f', 1.0)) + call assert_equal('1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%.340f', 1.0)) + call assert_equal('1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%.350f', 1.0)) - #" Float nan (not a number) has no sign. - call assert_equal('nan', printf('%f', sqrt(-1.0))) - call assert_equal('nan', printf('%f', 0.0 / 0.0)) - call assert_equal('nan', printf('%f', -0.0 / 0.0)) - call assert_equal('nan', printf('%g', 0.0 / 0.0)) - call assert_equal('nan', printf('%e', 0.0 / 0.0)) - call assert_equal('NAN', printf('%F', 0.0 / 0.0)) - call assert_equal('NAN', printf('%G', 0.0 / 0.0)) - call assert_equal('NAN', printf('%E', 0.0 / 0.0)) - call assert_equal('NAN', printf('%F', -0.0 / 0.0)) - call assert_equal('NAN', printf('%G', -0.0 / 0.0)) - call assert_equal('NAN', printf('%E', -0.0 / 0.0)) - call assert_equal(' nan', printf('%6f', 0.0 / 0.0)) - call assert_equal(' nan', printf('%06f', 0.0 / 0.0)) - call assert_equal('nan ', printf('%-6f', 0.0 / 0.0)) - call assert_equal('nan ', printf('%- 6f', 0.0 / 0.0)) - call assert_equal('nan', printf('%s', 0.0 / 0.0)) - call assert_equal('nan', printf('%s', -0.0 / 0.0)) - call assert_equal('nan', printf('%S', 0.0 / 0.0)) - call assert_equal('nan', printf('%S', -0.0 / 0.0)) - END - call v9.CheckLegacyAndVim9Success(lines) + #" Float nan (not a number) has no sign. + call assert_equal('nan', printf('%f', sqrt(-1.0))) + call assert_equal('nan', printf('%f', 0.0 / 0.0)) + call assert_equal('nan', printf('%f', -0.0 / 0.0)) + call assert_equal('nan', printf('%g', 0.0 / 0.0)) + call assert_equal('nan', printf('%e', 0.0 / 0.0)) + call assert_equal('NAN', printf('%F', 0.0 / 0.0)) + call assert_equal('NAN', printf('%G', 0.0 / 0.0)) + call assert_equal('NAN', printf('%E', 0.0 / 0.0)) + call assert_equal('NAN', printf('%F', -0.0 / 0.0)) + call assert_equal('NAN', printf('%G', -0.0 / 0.0)) + call assert_equal('NAN', printf('%E', -0.0 / 0.0)) + call assert_equal(' nan', printf('%6f', 0.0 / 0.0)) + call assert_equal(' nan', printf('%06f', 0.0 / 0.0)) + call assert_equal('nan ', printf('%-6f', 0.0 / 0.0)) + call assert_equal('nan ', printf('%- 6f', 0.0 / 0.0)) + call assert_equal('nan', printf('%s', 0.0 / 0.0)) + call assert_equal('nan', printf('%s', -0.0 / 0.0)) + call assert_equal('nan', printf('%S', 0.0 / 0.0)) + call assert_equal('nan', printf('%S', -0.0 / 0.0)) + END + call v9.CheckLegacyAndVim9Success(lines) - call v9.CheckLegacyAndVim9Failure(['echo printf("%f", "a")'], 'E807:') - endif + call v9.CheckLegacyAndVim9Failure(['echo printf("%f", "a")'], 'E807:') endfunc func Test_printf_errors() @@ -585,10 +577,8 @@ func Test_printf_errors() call v9.CheckLegacyAndVim9Failure(['echo printf("%d", 1, 2)'], 'E767:') call v9.CheckLegacyAndVim9Failure(['echo printf("%*d", 1)'], 'E766:') call v9.CheckLegacyAndVim9Failure(['echo printf("%s")'], 'E766:') - if has('float') - call v9.CheckLegacyAndVim9Failure(['echo printf("%d", 1.2)'], 'E805:') - call v9.CheckLegacyAndVim9Failure(['echo printf("%f")'], 'E766:') - endif + call v9.CheckLegacyAndVim9Failure(['echo printf("%d", 1.2)'], 'E805:') + call v9.CheckLegacyAndVim9Failure(['echo printf("%f")'], 'E766:') endfunc func Test_printf_64bit() @@ -607,9 +597,7 @@ func Test_printf_spec_s() call assert_equal("abcdefgi", printf('%s', "abcdefgi")) #" float - if has('float') - call assert_equal("1.23", printf('%s', 1.23)) - endif + call assert_equal("1.23", printf('%s', 1.23)) #" list VAR lvalue = [1, 'two', ['three', 4]] @@ -878,8 +866,6 @@ endfunc " Test for float value comparison func Test_float_compare() - CheckFeature float - let lines =<< trim END call assert_true(1.2 == 1.2) call assert_true(1.0 != 1.2) diff --git a/src/testdir/test_float_func.vim b/src/testdir/test_float_func.vim --- a/src/testdir/test_float_func.vim +++ b/src/testdir/test_float_func.vim @@ -1,7 +1,6 @@ " test float functions source check.vim -CheckFeature float import './vim9.vim' as v9 func Test_abs() diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -54,14 +54,12 @@ func Test_empty() call assert_equal(0, empty(1)) call assert_equal(0, empty(-1)) - if has('float') - call assert_equal(1, empty(0.0)) - call assert_equal(1, empty(-0.0)) - call assert_equal(0, empty(1.0)) - call assert_equal(0, empty(-1.0)) - call assert_equal(0, empty(1.0/0.0)) - call assert_equal(0, empty(0.0/0.0)) - endif + call assert_equal(1, empty(0.0)) + call assert_equal(1, empty(-0.0)) + call assert_equal(0, empty(1.0)) + call assert_equal(0, empty(-1.0)) + call assert_equal(0, empty(1.0/0.0)) + call assert_equal(0, empty(0.0/0.0)) call assert_equal(1, empty([])) call assert_equal(0, empty(['a'])) @@ -90,9 +88,7 @@ endfunc func Test_test_void() call assert_fails('echo 1 == test_void()', 'E1031:') - if has('float') - call assert_fails('echo 1.0 == test_void()', 'E1031:') - endif + call assert_fails('echo 1.0 == test_void()', 'E1031:') call assert_fails('let x = json_encode(test_void())', 'E685:') call assert_fails('let x = copy(test_void())', 'E685:') call assert_fails('let x = copy([test_void()])', 'E1031:') @@ -175,10 +171,8 @@ func Test_strwidth() call assert_fails('call strwidth({})', 'E731:') endfor - if has('float') - call assert_equal(3, strwidth(1.2)) - call v9.CheckDefAndScriptFailure(['echo strwidth(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) - endif + call assert_equal(3, strwidth(1.2)) + call v9.CheckDefAndScriptFailure(['echo strwidth(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) set ambiwidth& endfunc @@ -242,10 +236,8 @@ func Test_str2nr() call assert_fails('call str2nr([])', 'E730:') call assert_fails('call str2nr({->2})', 'E729:') - if has('float') - call assert_equal(1, str2nr(1.2)) - call v9.CheckDefAndScriptFailure(['echo str2nr(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) - endif + call assert_equal(1, str2nr(1.2)) + call v9.CheckDefAndScriptFailure(['echo str2nr(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) call assert_fails('call str2nr(10, [])', 'E745:') endfunc @@ -504,10 +496,8 @@ func Test_simplify() call assert_fails('call simplify({->0})', 'E729:') call assert_fails('call simplify([])', 'E730:') call assert_fails('call simplify({})', 'E731:') - if has('float') - call assert_equal('1.2', simplify(1.2)) - call v9.CheckDefAndScriptFailure(['echo simplify(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) - endif + call assert_equal('1.2', simplify(1.2)) + call v9.CheckDefAndScriptFailure(['echo simplify(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) endfunc func Test_pathshorten() diff --git a/src/testdir/test_glob2regpat.vim b/src/testdir/test_glob2regpat.vim --- a/src/testdir/test_glob2regpat.vim +++ b/src/testdir/test_glob2regpat.vim @@ -3,10 +3,8 @@ import './vim9.vim' as v9 func Test_glob2regpat_invalid() - if has('float') - call assert_equal('^1\.33$', glob2regpat(1.33)) - call v9.CheckDefAndScriptFailure(['echo glob2regpat(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) - endif + call assert_equal('^1\.33$', glob2regpat(1.33)) + call v9.CheckDefAndScriptFailure(['echo glob2regpat(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) call assert_fails('call glob2regpat("}")', 'E219:') call assert_fails('call glob2regpat("{")', 'E220:') endfunc diff --git a/src/testdir/test_json.vim b/src/testdir/test_json.vim --- a/src/testdir/test_json.vim +++ b/src/testdir/test_json.vim @@ -21,16 +21,14 @@ let s:jsonmb = '"s¢cĴgё"' let s:varmb = "s¢cĴgё" let s:jsonnr = '1234' let s:varnr = 1234 -if has('float') - let s:jsonfl = '12.34' - let s:varfl = 12.34 - let s:jsonneginf = '-Infinity' - let s:jsonposinf = 'Infinity' - let s:varneginf = -1.0 / 0.0 - let s:varposinf = 1.0 / 0.0 - let s:jsonnan = 'NaN' - let s:varnan = 0.0 / 0.0 -endif +let s:jsonfl = '12.34' +let s:varfl = 12.34 +let s:jsonneginf = '-Infinity' +let s:jsonposinf = 'Infinity' +let s:varneginf = -1.0 / 0.0 +let s:varposinf = 1.0 / 0.0 +let s:jsonnan = 'NaN' +let s:varnan = 0.0 / 0.0 let s:jsonl1 = '[1,"a",3]' let s:varl1 = [1, "a", 3] @@ -82,12 +80,10 @@ func Test_json_encode() " no test for surrogate pair, json_encode() doesn't create them. call assert_equal(s:jsonnr, json_encode(s:varnr)) - if has('float') - call assert_equal(s:jsonfl, json_encode(s:varfl)) - call assert_equal(s:jsonneginf, json_encode(s:varneginf)) - call assert_equal(s:jsonposinf, json_encode(s:varposinf)) - call assert_equal(s:jsonnan, json_encode(s:varnan)) - endif + call assert_equal(s:jsonfl, json_encode(s:varfl)) + call assert_equal(s:jsonneginf, json_encode(s:varneginf)) + call assert_equal(s:jsonposinf, json_encode(s:varposinf)) + call assert_equal(s:jsonnan, json_encode(s:varnan)) call assert_equal(s:jsonl1, json_encode(s:varl1)) call assert_equal(s:jsonl2, json_encode(s:varl2)) @@ -133,9 +129,7 @@ func Test_json_decode() call assert_equal(s:varsp2, json_decode(s:jsonsp2)) call assert_equal(s:varnr, json_decode(s:jsonnr)) - if has('float') - call assert_equal(s:varfl, json_decode(s:jsonfl)) - endif + call assert_equal(s:varfl, json_decode(s:jsonfl)) call assert_equal(s:varl1, json_decode(s:jsonl1)) call assert_equal(s:varl2x, json_decode(s:jsonl2)) @@ -189,9 +183,7 @@ func Test_json_decode() call assert_fails('call json_decode("{\"n\":1,")', "E491:") call assert_fails('call json_decode("{\"n\",1}")', "E491:") call assert_fails('call json_decode("{-}")', "E491:") - if has('float') - call assert_fails('call json_decode("{3.14:1}")', "E806:") - endif + call assert_fails('call json_decode("{3.14:1}")', "E806:") call assert_fails('call json_decode("[foobar]")', "E491:") call assert_fails('call json_decode("[")', "E491:") @@ -230,12 +222,10 @@ func Test_js_encode() " no test for surrogate pair, js_encode() doesn't create them. call assert_equal(s:jsonnr, js_encode(s:varnr)) - if has('float') - call assert_equal(s:jsonfl, js_encode(s:varfl)) - call assert_equal(s:jsonneginf, js_encode(s:varneginf)) - call assert_equal(s:jsonposinf, js_encode(s:varposinf)) - call assert_equal(s:jsonnan, js_encode(s:varnan)) - endif + call assert_equal(s:jsonfl, js_encode(s:varfl)) + call assert_equal(s:jsonneginf, js_encode(s:varneginf)) + call assert_equal(s:jsonposinf, js_encode(s:varposinf)) + call assert_equal(s:jsonnan, js_encode(s:varnan)) call assert_equal(s:jsonl1, js_encode(s:varl1)) call assert_equal(s:jsonl2, js_encode(s:varl2)) @@ -270,12 +260,10 @@ func Test_js_decode() call assert_equal(s:varsp2, js_decode(s:jsonsp2)) call assert_equal(s:varnr, js_decode(s:jsonnr)) - if has('float') - call assert_equal(s:varfl, js_decode(s:jsonfl)) - call assert_equal(s:varneginf, js_decode(s:jsonneginf)) - call assert_equal(s:varposinf, js_decode(s:jsonposinf)) - call assert_true(isnan(js_decode(s:jsonnan))) - endif + call assert_equal(s:varfl, js_decode(s:jsonfl)) + call assert_equal(s:varneginf, js_decode(s:jsonneginf)) + call assert_equal(s:varposinf, js_decode(s:jsonposinf)) + call assert_true(isnan(js_decode(s:jsonnan))) call assert_equal(s:varl1, js_decode(s:jsonl1)) call assert_equal(s:varl2x, js_decode(s:jsonl2)) diff --git a/src/testdir/test_listdict.vim b/src/testdir/test_listdict.vim --- a/src/testdir/test_listdict.vim +++ b/src/testdir/test_listdict.vim @@ -966,20 +966,18 @@ func Test_reverse_sort_uniq() call assert_equal(['-0', 'A11', 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5], uniq(copy(l))) call assert_equal([1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0'], reverse(l)) call assert_equal([1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0'], reverse(reverse(l))) - if has('float') - call assert_equal(['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]], sort(l)) - call assert_equal([[0, 1, 2], [0, 1, 2], 4, 2, 2, 1.5, 'xaaa', 'x8', 'foo6', 'foo', 'foo', 'A11', '-0'], reverse(sort(l))) - call assert_equal(['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]], sort(reverse(sort(l)))) - call assert_equal(['-0', 'A11', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 4, [0, 1, 2]], uniq(sort(l))) + call assert_equal(['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]], sort(l)) + call assert_equal([[0, 1, 2], [0, 1, 2], 4, 2, 2, 1.5, 'xaaa', 'x8', 'foo6', 'foo', 'foo', 'A11', '-0'], reverse(sort(l))) + call assert_equal(['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]], sort(reverse(sort(l)))) + call assert_equal(['-0', 'A11', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 4, [0, 1, 2]], uniq(sort(l))) - LET l = [7, 9, 'one', 18, 12, 22, 'two', 10.0e-16, -1, 'three', 0xff, 0.22, 'four'] - call assert_equal([-1, 'one', 'two', 'three', 'four', 1.0e-15, 0.22, 7, 9, 12, 18, 22, 255], sort(copy(l), 'n')) + LET l = [7, 9, 'one', 18, 12, 22, 'two', 10.0e-16, -1, 'three', 0xff, 0.22, 'four'] + call assert_equal([-1, 'one', 'two', 'three', 'four', 1.0e-15, 0.22, 7, 9, 12, 18, 22, 255], sort(copy(l), 'n')) - LET l = [7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []] - call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 'i')) - call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 'i')) - call assert_equal(['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar', 'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l))) - endif + LET l = [7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []] + call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 'i')) + call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 'i')) + call assert_equal(['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar', 'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l))) END call v9.CheckLegacyAndVim9Success(lines) @@ -1173,9 +1171,7 @@ func Test_listdict_extend() let l = [1, 2, 3] call assert_fails("call extend(l, [4, 5, 6], 4)", 'E684:') call assert_fails("call extend(l, [4, 5, 6], -4)", 'E684:') - if has('float') - call assert_fails("call extend(l, [4, 5, 6], 1.2)", 'E805:') - endif + call assert_fails("call extend(l, [4, 5, 6], 1.2)", 'E805:') " Test extend() with dictionaries. @@ -1203,9 +1199,7 @@ func Test_listdict_extend() call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 'error')", 'E737:') call assert_fails("call extend(d, {'b': 0}, [])", 'E730:') call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 'xxx')", 'E475:') - if has('float') - call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 1.2)", 'E475:') - endif + call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 1.2)", 'E475:') call assert_equal({'a': 'A', 'b': 'B'}, d) call assert_fails("call extend([1, 2], 1)", 'E712:') diff --git a/src/testdir/test_lua.vim b/src/testdir/test_lua.vim --- a/src/testdir/test_lua.vim +++ b/src/testdir/test_lua.vim @@ -10,7 +10,6 @@ func Test_skip_lua() endfunc CheckFeature lua -CheckFeature float " Depending on the lua version, the error messages are different. let [s:major, s:minor, s:patch] = luaeval('vim.lua_version')->split('\.')->map({-> str2nr(v:val)}) diff --git a/src/testdir/test_messages.vim b/src/testdir/test_messages.vim --- a/src/testdir/test_messages.vim +++ b/src/testdir/test_messages.vim @@ -74,9 +74,7 @@ func Test_echomsg() call assert_equal("\n[1, 2, []]", execute(':echomsg [1, 2, test_null_list()]')) call assert_equal("\n{}", execute(':echomsg {}')) call assert_equal("\n{'a': 1, 'b': 2}", execute(':echomsg {"a": 1, "b": 2}')) - if has('float') - call assert_equal("\n1.23", execute(':echomsg 1.23')) - endif + call assert_equal("\n1.23", execute(':echomsg 1.23')) call assert_match("function('\\d*')", execute(':echomsg {-> 1234}')) endfunc @@ -86,9 +84,7 @@ func Test_echoerr() call assert_equal("\n12345 IgNoRe", execute(':echoerr 12345 "IgNoRe"')) call assert_equal("\n[1, 2, 'IgNoRe']", execute(':echoerr [1, 2, "IgNoRe"]')) call assert_equal("\n{'IgNoRe': 2, 'a': 1}", execute(':echoerr {"a": 1, "IgNoRe": 2}')) - if has('float') - call assert_equal("\n1.23 IgNoRe", execute(':echoerr 1.23 "IgNoRe"')) - endif + call assert_equal("\n1.23 IgNoRe", execute(':echoerr 1.23 "IgNoRe"')) eval ''->test_ignore_error() call assert_match("function('\\d*')", execute(':echoerr {-> 1234}')) call test_ignore_error('RESET') diff --git a/src/testdir/test_method.vim b/src/testdir/test_method.vim --- a/src/testdir/test_method.vim +++ b/src/testdir/test_method.vim @@ -121,7 +121,6 @@ func Test_method_funcref() endfunc func Test_method_float() - CheckFeature float eval 1.234->string()->assert_equal('1.234') eval -1.234->string()->assert_equal('-1.234') endfunc diff --git a/src/testdir/test_perl.vim b/src/testdir/test_perl.vim --- a/src/testdir/test_perl.vim +++ b/src/testdir/test_perl.vim @@ -163,11 +163,7 @@ func Test_perleval() call assert_equal(0, perleval('0')) call assert_equal(2, perleval('2')) call assert_equal(-2, perleval('-2')) - if has('float') - call assert_equal(2.5, perleval('2.5')) - else - call assert_equal(2, perleval('2.5')) - end + call assert_equal(2.5, perleval('2.5')) sandbox call assert_equal(2, perleval('2')) diff --git a/src/testdir/test_python2.vim b/src/testdir/test_python2.vim --- a/src/testdir/test_python2.vim +++ b/src/testdir/test_python2.vim @@ -686,7 +686,6 @@ func Test_python_function_call() endfunc func Test_python_float() - CheckFeature float let l = [0.0] py l = vim.bindeval('l') py l.extend([0.0]) @@ -785,9 +784,7 @@ func Test_python_pyeval() py v = vim.eval('test_null_function()') call assert_equal(v:none, pyeval('v')) - if has('float') - call assert_equal(0.0, pyeval('0.0')) - endif + call assert_equal(0.0, pyeval('0.0')) " Evaluate an invalid values call AssertException(['let v = pyeval(''"\0"'')'], 'E859:') diff --git a/src/testdir/test_python3.vim b/src/testdir/test_python3.vim --- a/src/testdir/test_python3.vim +++ b/src/testdir/test_python3.vim @@ -286,16 +286,14 @@ endfunc " Test vim.eval() with various types. func Test_python3_vim_val() call assert_equal("\n8", execute('py3 print(vim.eval("3+5"))')) - if has('float') - call assert_equal("\n3.140000", execute('py3 print(vim.eval("1.01+2.13"))')) - call assert_equal("\n0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))')) - call assert_equal("\n0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))')) - call assert_equal("\n-0.000000", execute('py3 print(vim.eval("0.0/(-1.0/0.0)"))')) - " Commented out: output of infinity and nan depend on platforms. - " call assert_equal("\ninf", execute('py3 print(vim.eval("1.0/0.0"))')) - " call assert_equal("\n-inf", execute('py3 print(vim.eval("-1.0/0.0"))')) - " call assert_equal("\n-nan", execute('py3 print(vim.eval("0.0/0.0"))')) - endif + call assert_equal("\n3.140000", execute('py3 print(vim.eval("1.01+2.13"))')) + call assert_equal("\n0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))')) + call assert_equal("\n0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))')) + call assert_equal("\n-0.000000", execute('py3 print(vim.eval("0.0/(-1.0/0.0)"))')) + " Commented out: output of infinity and nan depend on platforms. + " call assert_equal("\ninf", execute('py3 print(vim.eval("1.0/0.0"))')) + " call assert_equal("\n-inf", execute('py3 print(vim.eval("-1.0/0.0"))')) + " call assert_equal("\n-nan", execute('py3 print(vim.eval("0.0/0.0"))')) call assert_equal("\nabc", execute('py3 print(vim.eval("\"abc\""))')) call assert_equal("\n['1', '2']", execute('py3 print(vim.eval("[1, 2]"))')) call assert_equal("\n{'1': '2'}", execute('py3 print(vim.eval("{1:2}"))')) @@ -879,7 +877,6 @@ func Test_python3_function_call() endfunc func Test_python3_float() - CheckFeature float let l = [0.0] py3 l = vim.bindeval('l') py3 l.extend([0.0]) @@ -982,9 +979,7 @@ func Test_python3_pyeval() py3 v = vim.eval('test_null_function()') call assert_equal(v:none, py3eval('v')) - if has('float') - call assert_equal(0.0, py3eval('0.0')) - endif + call assert_equal(0.0, py3eval('0.0')) " Evaluate an invalid values call AssertException(['let v = py3eval(''"\0"'')'], 'E859:') diff --git a/src/testdir/test_random.vim b/src/testdir/test_random.vim --- a/src/testdir/test_random.vim +++ b/src/testdir/test_random.vim @@ -26,9 +26,7 @@ func Test_Rand() call assert_equal(1001954530, rand()) call test_srand_seed() - if has('float') - call assert_fails('echo srand(1.2)', 'E805:') - endif + call assert_fails('echo srand(1.2)', 'E805:') call assert_fails('echo srand([1])', 'E745:') call assert_fails('echo rand("burp")', 'E475:') call assert_fails('echo rand([1, 2, 3])', 'E730:') diff --git a/src/testdir/test_reltime.vim b/src/testdir/test_reltime.vim --- a/src/testdir/test_reltime.vim +++ b/src/testdir/test_reltime.vim @@ -2,7 +2,6 @@ source check.vim CheckFeature reltime -CheckFeature float func Test_reltime() let g:test_is_flaky = 1 diff --git a/src/testdir/test_ruby.vim b/src/testdir/test_ruby.vim --- a/src/testdir/test_ruby.vim +++ b/src/testdir/test_ruby.vim @@ -304,10 +304,8 @@ func Test_ruby_Vim_evaluate() " on versions of Ruby. call assert_match('^Integer\|Fixnum$', rubyeval('Vim::evaluate("123").class')) - if has('float') - call assert_equal(1.23, rubyeval('Vim::evaluate("1.23")')) - call assert_equal('Float', rubyeval('Vim::evaluate("1.23").class')) - endif + call assert_equal(1.23, rubyeval('Vim::evaluate("1.23")')) + call assert_equal('Float', rubyeval('Vim::evaluate("1.23").class')) call assert_equal('foo', rubyeval('Vim::evaluate("\"foo\"")')) call assert_equal('String', rubyeval('Vim::evaluate("\"foo\"").class')) diff --git a/src/testdir/test_sort.vim b/src/testdir/test_sort.vim --- a/src/testdir/test_sort.vim +++ b/src/testdir/test_sort.vim @@ -62,7 +62,6 @@ func Test_sort_numbers() endfunc func Test_sort_float() - CheckFeature float call assert_equal([0.28, 3, 13.5], sort([13.5, 0.28, 3], 'f')) endfunc @@ -72,8 +71,6 @@ func Test_sort_nested() endfunc func Test_sort_default() - CheckFeature float - " docs say omitted, empty or zero argument sorts on string representation. call assert_equal(['2', 'A', 'AA', 'a', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"])) call assert_equal(['2', 'A', 'AA', 'a', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"], '')) @@ -1336,34 +1333,32 @@ func Test_sort_cmd() \ ] endif endif - if has('float') - let tests += [ - \ { - \ 'name' : 'float', - \ 'cmd' : 'sort f', - \ 'input' : [ - \ '1.234', - \ '0.88', - \ ' + 123.456', - \ '1.15e-6', - \ '-1.1e3', - \ '-1.01e3', - \ '', - \ '' - \ ], - \ 'expected' : [ - \ '', - \ '', - \ '-1.1e3', - \ '-1.01e3', - \ '1.15e-6', - \ '0.88', - \ '1.234', - \ ' + 123.456' - \ ] - \ }, - \ ] - endif + let tests += [ + \ { + \ 'name' : 'float', + \ 'cmd' : 'sort f', + \ 'input' : [ + \ '1.234', + \ '0.88', + \ ' + 123.456', + \ '1.15e-6', + \ '-1.1e3', + \ '-1.01e3', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ '', + \ '', + \ '-1.1e3', + \ '-1.01e3', + \ '1.15e-6', + \ '0.88', + \ '1.234', + \ ' + 123.456' + \ ] + \ }, + \ ] for t in tests enew! diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim --- a/src/testdir/test_substitute.vim +++ b/src/testdir/test_substitute.vim @@ -464,8 +464,6 @@ func Test_substitute_partial() endfunc func Test_substitute_float() - CheckFeature float - call assert_equal('number 1.23', substitute('number ', '$', { -> 1.23 }, '')) vim9 assert_equal('number 1.23', substitute('number ', '$', () => 1.23, '')) endfunc diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -478,9 +478,7 @@ func Test_terminal_size() call assert_fails("call term_start(cmd, {'term_rows': -1})", 'E475:') call assert_fails("call term_start(cmd, {'term_rows': 1001})", 'E475:') - if has('float') - call assert_fails("call term_start(cmd, {'term_rows': 10.0})", 'E805:') - endif + call assert_fails("call term_start(cmd, {'term_rows': 10.0})", 'E805:') call delete('Xtext') endfunc diff --git a/src/testdir/test_true_false.vim b/src/testdir/test_true_false.vim --- a/src/testdir/test_true_false.vim +++ b/src/testdir/test_true_false.vim @@ -43,9 +43,7 @@ func Test_if() call assert_fails('if [1]', 'E745:') call assert_fails('if {1: 1}', 'E728:') call assert_fails('if function("string")', 'E703:') - if has('float') - call assert_fails('if 1.3")', 'E805:') - endif + call assert_fails('if 1.3")', 'E805:') endfunc function Try_arg_true_false(expr, false_val, true_val) @@ -117,7 +115,6 @@ func Test_true_false_arg() endfunc function Try_arg_non_zero(expr, false_val, true_val) - CheckFeature float for v in ['v:false', '0', '[1]', '{2:3}', '3.4'] let r = eval(substitute(a:expr, '%v%', v, '')) call assert_equal(a:false_val, r, 'result for ' . v . ' is not ' . a:false_val . ' but ' . r) diff --git a/src/testdir/test_user_func.vim b/src/testdir/test_user_func.vim --- a/src/testdir/test_user_func.vim +++ b/src/testdir/test_user_func.vim @@ -129,11 +129,9 @@ func MakeBadFunc() endfunc func Test_default_arg() - if has('float') - call assert_equal(1.0, Log(10)) - call assert_equal(log(10), Log(10, exp(1))) - call assert_fails("call Log(1,2,3)", 'E118:') - endif + call assert_equal(1.0, Log(10)) + call assert_equal(log(10), Log(10, exp(1))) + call assert_fails("call Log(1,2,3)", 'E118:') let res = Args(1) call assert_equal(res.mandatory, 1) diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim --- a/src/testdir/test_vim9_assign.vim +++ b/src/testdir/test_vim9_assign.vim @@ -96,9 +96,7 @@ def Test_assignment() # calling job_start() is in test_vim9_fails.vim, it causes leak reports endif - if has('float') - var float1: float = 3.4 - endif + var float1: float = 3.4 var Funky1: func var Funky2: func = function('len') var Party2: func = funcref('g:Test_syntax') @@ -147,17 +145,15 @@ def Test_assignment() &ts %= 4 assert_equal(2, &ts) - if has('float') - var f100: float = 100.0 - f100 /= 5 - assert_equal(20.0, f100) - - var f200: float = 200.0 - f200 /= 5.0 - assert_equal(40.0, f200) - - v9.CheckDefFailure(['var nr: number = 200', 'nr /= 5.0'], 'E1012:') - endif + var f100: float = 100.0 + f100 /= 5 + assert_equal(20.0, f100) + + var f200: float = 200.0 + f200 /= 5.0 + assert_equal(40.0, f200) + + v9.CheckDefFailure(['var nr: number = 200', 'nr /= 5.0'], 'E1012:') lines =<< trim END &ts = 6 @@ -227,11 +223,9 @@ def Test_assignment() g:inc_counter += 1 assert_equal(2, g:inc_counter) - if has('float') - var f: float - f += 1 - assert_equal(1.0, f) - endif + var f: float + f += 1 + assert_equal(1.0, f) $SOME_ENV_VAR ..= 'more' assert_equal('somemore', $SOME_ENV_VAR) @@ -250,20 +244,16 @@ def Test_assignment() enddef def Test_float_and_number() - if !has('float') - MissingFeature float - else - var lines =<< trim END - var f: float - f += 2 - f -= 1 - assert_equal(1.0, f) - ++f - --f - assert_equal(1.0, f) - END - v9.CheckDefAndScriptSuccess(lines) - endif + var lines =<< trim END + var f: float + f += 2 + f -= 1 + assert_equal(1.0, f) + ++f + --f + assert_equal(1.0, f) + END + v9.CheckDefAndScriptSuccess(lines) enddef let g:someNumber = 43 @@ -1314,10 +1304,8 @@ def Test_assignment_default() var thenumber: number assert_equal(0, thenumber) - if has('float') - var thefloat: float - assert_equal(0.0, thefloat) - endif + var thefloat: float + assert_equal(0.0, thefloat) var thestring: string assert_equal('', thestring) diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -69,11 +69,9 @@ def Test_abs() assert_equal(2, abs(-2)) assert_equal(3, abs(3)) v9.CheckDefAndScriptFailure(['abs("text")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) - if has('float') - assert_equal(0, abs(0)) - assert_equal(2.0, abs(-2.0)) - assert_equal(3.0, abs(3.0)) - endif + assert_equal(0, abs(0)) + assert_equal(2.0, abs(-2.0)) + assert_equal(3.0, abs(3.0)) enddef def Test_add() @@ -1283,8 +1281,6 @@ enddef " Test for float functions argument type def Test_float_funcs_args() - CheckFeature float - # acos() v9.CheckDefAndScriptFailure(['acos("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1']) assert_equal('1.570796', string(acos(0.0))) @@ -4064,15 +4060,11 @@ def Test_state() enddef def Test_str2float() - if !has('float') - CheckFeature float - else - str2float("1.00")->assert_equal(1.00) - str2float("2e-2")->assert_equal(0.02) - str2float('')->assert_equal(0.0) - - v9.CheckDefAndScriptFailure(['str2float(123)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) - endif + str2float("1.00")->assert_equal(1.00) + str2float("2e-2")->assert_equal(0.02) + str2float('')->assert_equal(0.0) + + v9.CheckDefAndScriptFailure(['str2float(123)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) enddef def Test_str2list() @@ -4585,9 +4577,7 @@ def Test_trim() enddef def Test_typename() - if has('float') - assert_equal('func([unknown], [unknown]): float', typename(function('pow'))) - endif + assert_equal('func([unknown], [unknown]): float', typename(function('pow'))) assert_equal('func(...): unknown', test_null_partial()->typename()) assert_equal('list', test_null_list()->typename()) assert_equal('dict', test_null_dict()->typename()) diff --git a/src/testdir/test_vim9_disassemble.vim b/src/testdir/test_vim9_disassemble.vim --- a/src/testdir/test_vim9_disassemble.vim +++ b/src/testdir/test_vim9_disassemble.vim @@ -309,9 +309,7 @@ def s:ScriptFuncPush() var localbool = true var localspec = v:none var localblob = 0z1234 - if has('float') - var localfloat = 1.234 - endif + var localfloat = 1.234 enddef def Test_disassemble_push() @@ -1742,13 +1740,11 @@ def s:Computing() anyres = g:number / 7 anyres = g:number % 7 - if has('float') - var fl = 3.0 - var flres = fl + 7.0 - flres = fl - 7.0 - flres = fl * 7.0 - flres = fl / 7.0 - endif + var fl = 3.0 + var flres = fl + 7.0 + flres = fl - 7.0 + flres = fl * 7.0 + flres = fl / 7.0 enddef def Test_disassemble_computing() @@ -1783,24 +1779,22 @@ def Test_disassemble_computing() 'anyres = g:number % 7.*' .. '\d OPANY %.*', instr) - if has('float') - assert_match('Computing.*' .. - 'var fl = 3.0.*' .. - '\d PUSHF 3.0.*' .. - '\d STORE $3.*' .. - 'var flres = fl + 7.0.*' .. - '\d LOAD $3.*' .. - '\d PUSHF 7.0.*' .. - '\d OPFLOAT +.*' .. - '\d STORE $4.*' .. - 'flres = fl - 7.0.*' .. - '\d OPFLOAT -.*' .. - 'flres = fl \* 7.0.*' .. - '\d OPFLOAT \*.*' .. - 'flres = fl / 7.0.*' .. - '\d OPFLOAT /.*', - instr) - endif + assert_match('Computing.*' .. + 'var fl = 3.0.*' .. + '\d PUSHF 3.0.*' .. + '\d STORE $3.*' .. + 'var flres = fl + 7.0.*' .. + '\d LOAD $3.*' .. + '\d PUSHF 7.0.*' .. + '\d OPFLOAT +.*' .. + '\d STORE $4.*' .. + 'flres = fl - 7.0.*' .. + '\d OPFLOAT -.*' .. + 'flres = fl \* 7.0.*' .. + '\d OPFLOAT \*.*' .. + 'flres = fl / 7.0.*' .. + '\d OPFLOAT /.*', + instr) enddef def s:AddListBlob() @@ -2178,19 +2172,17 @@ def Test_disassemble_compare() ['77 isnot g:xx', 'COMPAREANY isnot'], ] var floatDecl = '' - if has('float') - cases->extend([ - ['1.1 == aFloat', 'COMPAREFLOAT =='], - ['1.1 != aFloat', 'COMPAREFLOAT !='], - ['1.1 > aFloat', 'COMPAREFLOAT >'], - ['1.1 < aFloat', 'COMPAREFLOAT <'], - ['1.1 >= aFloat', 'COMPAREFLOAT >='], - ['1.1 <= aFloat', 'COMPAREFLOAT <='], - ['1.1 =~ aFloat', 'COMPAREFLOAT =\~'], - ['1.1 !~ aFloat', 'COMPAREFLOAT !\~'], - ]) - floatDecl = 'var aFloat = 2.2' - endif + cases->extend([ + ['1.1 == aFloat', 'COMPAREFLOAT =='], + ['1.1 != aFloat', 'COMPAREFLOAT !='], + ['1.1 > aFloat', 'COMPAREFLOAT >'], + ['1.1 < aFloat', 'COMPAREFLOAT <'], + ['1.1 >= aFloat', 'COMPAREFLOAT >='], + ['1.1 <= aFloat', 'COMPAREFLOAT <='], + ['1.1 =~ aFloat', 'COMPAREFLOAT =\~'], + ['1.1 !~ aFloat', 'COMPAREFLOAT !\~'], + ]) + floatDecl = 'var aFloat = 2.2' var nr = 1 for case in cases diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim --- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -18,9 +18,7 @@ def Test_expr1_ternary() assert_equal('one', 1 ? 'one' : 'two') - if has('float') - assert_equal('one', !!0.1 ? 'one' : 'two') - endif + assert_equal('one', !!0.1 ? 'one' : 'two') assert_equal('one', !!'x' ? 'one' : 'two') assert_equal('one', !!'x' ? 'one' @@ -33,9 +31,7 @@ def Test_expr1_ternary() assert_equal('two', false ? 'one' : 'two') assert_equal('two', 0 ? 'one' : 'two') - if has('float') - assert_equal('two', !!0.0 ? 'one' : 'two') - endif + assert_equal('two', !!0.0 ? 'one' : 'two') assert_equal('two', !!'' ? 'one' : 'two') assert_equal('two', !!0z ? 'one' : 'two') assert_equal('two', !![] ? 'one' : 'two') @@ -208,9 +204,7 @@ func Test_expr1_ternary_fails() call v9.CheckDefExecAndScriptFailure(["var x = true ? xxx : 'foo'"], ['E1001:', 'E121:'], 1) call v9.CheckDefExecAndScriptFailure(["var x = false ? 'foo' : xxx"], ['E1001:', 'E121:'], 1) - if has('float') - call v9.CheckDefAndScriptFailure(["var x = 0.1 ? 'one' : 'two'"], 'E805:', 1) - endif + call v9.CheckDefAndScriptFailure(["var x = 0.1 ? 'one' : 'two'"], 'E805:', 1) " missing argument detected even when common type is used call v9.CheckDefAndScriptFailure([ @@ -227,18 +221,14 @@ def Test_expr1_falsy() assert_equal('yes', 'yes' ?? 456) assert_equal([1], [1] ?? 456) assert_equal({one: 1}, {one: 1} ?? 456) - if has('float') - assert_equal(0.1, 0.1 ?? 456) - endif + assert_equal(0.1, 0.1 ?? 456) assert_equal(456, v:false ?? 456) assert_equal(456, 0 ?? 456) assert_equal(456, '' ?? 456) assert_equal(456, [] ?? 456) assert_equal(456, {} ?? 456) - if has('float') - assert_equal(456, 0.0 ?? 456) - endif + assert_equal(456, 0.0 ?? 456) END v9.CheckDefAndScriptSuccess(lines) @@ -567,9 +557,7 @@ let anull = v:null let anint = 10 let theone = 1 let thefour = 4 -if has('float') - let afloat = 0.1 -endif +let afloat = 0.1 let astring = 'asdf' let ablob = 0z01ab let alist = [2, 3, 4] @@ -605,20 +593,18 @@ def Test_expr4_equal() assert_equal(true, g:anint == 10) assert_equal(false, 61 == g:anint) - if has('float') - var ff = 0.3 - assert_equal(true, ff == 0.3) - assert_equal(false, 0.4 == ff) - assert_equal(true, 0.1 == g:afloat) - assert_equal(false, g:afloat == 0.3) - - ff = 3.0 - assert_equal(true, ff == 3) - assert_equal(true, 3 == ff) - ff = 3.1 - assert_equal(false, ff == 3) - assert_equal(false, 3 == ff) - endif + var ff = 0.3 + assert_equal(true, ff == 0.3) + assert_equal(false, 0.4 == ff) + assert_equal(true, 0.1 == g:afloat) + assert_equal(false, g:afloat == 0.3) + + ff = 3.0 + assert_equal(true, ff == 3) + assert_equal(true, 3 == ff) + ff = 3.1 + assert_equal(false, ff == 3) + assert_equal(false, 3 == ff) assert_equal(true, 'abc' == 'abc') assert_equal(false, 'xyz' == 'abc') @@ -706,20 +692,18 @@ def Test_expr4_equal() v9.CheckScriptFailure(lines, 'E1030: Using a String as a Number: "3"') assert_true(g:notReached) - if has('float') - lines =<< trim END - vim9script - var n: any = 2.2 - def Compare() - eval n == '3' - g:notReached = false - enddef - g:notReached = true - Compare() - END - v9.CheckScriptFailure(lines, 'E892: Using a String as a Float') - assert_true(g:notReached) - endif + lines =<< trim END + vim9script + var n: any = 2.2 + def Compare() + eval n == '3' + g:notReached = false + enddef + g:notReached = true + Compare() + END + v9.CheckScriptFailure(lines, 'E892: Using a String as a Float') + assert_true(g:notReached) unlet g:notReached enddef @@ -746,16 +730,14 @@ def Test_expr4_compare_null() assert_true(null != 123) assert_true(null != 0) - if has('float') - assert_false(12.3 == null) - assert_false(0.0 == null) - assert_false(null == 12.3) - assert_false(null == 0.0) - assert_true(12.3 != null) - assert_true(0.0 != null) - assert_true(null != 12.3) - assert_true(null != 0.0) - endif + assert_false(12.3 == null) + assert_false(0.0 == null) + assert_false(null == 12.3) + assert_false(null == 0.0) + assert_true(12.3 != null) + assert_true(0.0 != null) + assert_true(null != 12.3) + assert_true(null != 0.0) assert_true(test_null_blob() == v:null) assert_true(null_blob == null) @@ -1077,20 +1059,18 @@ def Test_expr4_notequal() assert_equal(false, g:anint != 10) assert_equal(true, 61 != g:anint) - if has('float') - var ff = 0.3 - assert_equal(false, 0.3 != ff) - assert_equal(true, 0.4 != ff) - assert_equal(false, 0.1 != g:afloat) - assert_equal(true, g:afloat != 0.3) - - ff = 3.0 - assert_equal(false, ff != 3) - assert_equal(false, 3 != ff) - ff = 3.1 - assert_equal(true, ff != 3) - assert_equal(true, 3 != ff) - endif + var ff = 0.3 + assert_equal(false, 0.3 != ff) + assert_equal(true, 0.4 != ff) + assert_equal(false, 0.1 != g:afloat) + assert_equal(true, g:afloat != 0.3) + + ff = 3.0 + assert_equal(false, ff != 3) + assert_equal(false, 3 != ff) + ff = 3.1 + assert_equal(true, ff != 3) + assert_equal(true, 3 != ff) assert_equal(false, 'abc' != 'abc') assert_equal(true, 'xyz' != 'abc') @@ -1149,13 +1129,11 @@ def Test_expr4_greater() assert_false(nr2 > 2) assert_false(nr2 > 3) - if has('float') - var ff = 2.0 - assert_true(ff > 0.0) - assert_true(ff > 1.0) - assert_false(ff > 2.0) - assert_false(ff > 3.0) - endif + var ff = 2.0 + assert_true(ff > 0.0) + assert_true(ff > 1.0) + assert_false(ff > 2.0) + assert_false(ff > 3.0) END v9.CheckDefAndScriptSuccess(lines) enddef @@ -1171,12 +1149,10 @@ def Test_expr4_greaterequal() assert_true(nr2 >= 0) assert_true(nr2 >= 2) assert_false(nr2 >= 3) - if has('float') - var ff = 2.0 - assert_true(ff >= 0.0) - assert_true(ff >= 2.0) - assert_false(ff >= 3.0) - endif + var ff = 2.0 + assert_true(ff >= 0.0) + assert_true(ff >= 2.0) + assert_false(ff >= 3.0) END v9.CheckDefAndScriptSuccess(lines) enddef @@ -1193,12 +1169,10 @@ def Test_expr4_smaller() assert_false(nr2 < 0) assert_false(nr2 < 2) assert_true(nr2 < 3) - if has('float') - var ff = 2.0 - assert_false(ff < 0.0) - assert_false(ff < 2.0) - assert_true(ff < 3.0) - endif + var ff = 2.0 + assert_false(ff < 0.0) + assert_false(ff < 2.0) + assert_true(ff < 3.0) END v9.CheckDefAndScriptSuccess(lines) enddef @@ -1217,13 +1191,11 @@ def Test_expr4_smallerequal() assert_false(nr2 <= 1) assert_true(nr2 <= 2) assert_true(nr2 <= 3) - if has('float') - var ff = 2.0 - assert_false(ff <= 0.0) - assert_false(ff <= 1.0) - assert_true(ff <= 2.0) - assert_true(ff <= 3.0) - endif + var ff = 2.0 + assert_false(ff <= 0.0) + assert_false(ff <= 1.0) + assert_true(ff <= 2.0) + assert_true(ff <= 3.0) END v9.CheckDefAndScriptSuccess(lines) enddef @@ -1456,10 +1428,8 @@ func Test_expr4_fails() call v9.CheckDefAndScriptFailure(["var x = v:none isnot v:null"], 'Cannot use "isnot" with special', 1) call v9.CheckDefAndScriptFailure(["var x = 123 is 123"], 'Cannot use "is" with number', 1) call v9.CheckDefAndScriptFailure(["var x = 123 isnot 123"], 'Cannot use "isnot" with number', 1) - if has('float') - call v9.CheckDefAndScriptFailure(["var x = 1.3 is 1.3"], 'Cannot use "is" with float', 1) - call v9.CheckDefAndScriptFailure(["var x = 1.3 isnot 1.3"], 'Cannot use "isnot" with float', 1) - endif + call v9.CheckDefAndScriptFailure(["var x = 1.3 is 1.3"], 'Cannot use "is" with float', 1) + call v9.CheckDefAndScriptFailure(["var x = 1.3 isnot 1.3"], 'Cannot use "isnot" with float', 1) call v9.CheckDefAndScriptFailure(["var x = 0za1 > 0z34"], 'Cannot compare blob with blob', 1) call v9.CheckDefAndScriptFailure(["var x = 0za1 >= 0z34"], 'Cannot compare blob with blob', 1) @@ -1518,9 +1488,7 @@ def Test_expr6() assert_equal('afalse', 'a' .. false) assert_equal('anull', 'a' .. v:null) assert_equal('av:none', 'a' .. v:none) - if has('float') - assert_equal('a0.123', 'a' .. 0.123) - endif + assert_equal('a0.123', 'a' .. 0.123) assert_equal(3, 1 + [2, 3, 4][0]) assert_equal(5, 2 + {key: 3}['key']) @@ -1719,31 +1687,27 @@ def Test_expr6_vim9script_channel() enddef def Test_expr6_float() - if !has('float') - MissingFeature 'float' - else - var lines =<< trim END - assert_equal(66.0, 60.0 + 6.0) - assert_equal(66.0, 60.0 + 6) - assert_equal(66.0, 60 + - 6.0) - assert_equal(5.1, g:afloat - + 5) - assert_equal(8.1, 8 + g:afloat) - assert_equal(10.1, g:anint + g:afloat) - assert_equal(10.1, g:afloat + g:anint) - - assert_equal(54.0, 60.0 - 6.0) - assert_equal(54.0, 60.0 - - 6) - assert_equal(54.0, 60 - 6.0) - assert_equal(-4.9, g:afloat - 5) - assert_equal(7.9, 8 - g:afloat) - assert_equal(9.9, g:anint - g:afloat) - assert_equal(-9.9, g:afloat - g:anint) - END - v9.CheckDefAndScriptSuccess(lines) - endif + var lines =<< trim END + assert_equal(66.0, 60.0 + 6.0) + assert_equal(66.0, 60.0 + 6) + assert_equal(66.0, 60 + + 6.0) + assert_equal(5.1, g:afloat + + 5) + assert_equal(8.1, 8 + g:afloat) + assert_equal(10.1, g:anint + g:afloat) + assert_equal(10.1, g:afloat + g:anint) + + assert_equal(54.0, 60.0 - 6.0) + assert_equal(54.0, 60.0 + - 6) + assert_equal(54.0, 60 - 6.0) + assert_equal(-4.9, g:afloat - 5) + assert_equal(7.9, 8 - g:afloat) + assert_equal(9.9, g:anint - g:afloat) + assert_equal(-9.9, g:afloat - g:anint) + END + v9.CheckDefAndScriptSuccess(lines) enddef func Test_expr6_fails() @@ -1852,14 +1816,12 @@ def Test_expr7() var y = [3] assert_equal(5, x[0] + y[0]) assert_equal(6, x[0] * y[0]) - if has('float') - var xf = [2.0] - var yf = [3.0] - assert_equal(5.0, xf[0] - + yf[0]) - assert_equal(6.0, xf[0] - * yf[0]) - endif + var xf = [2.0] + var yf = [3.0] + assert_equal(5.0, xf[0] + + yf[0]) + assert_equal(6.0, xf[0] + * yf[0]) END v9.CheckDefAndScriptSuccess(lines) @@ -1874,13 +1836,11 @@ def Test_expr7() v9.CheckDefExecFailure(['echo 123 / g:zero'], 'E1154: Divide by zero') v9.CheckDefExecFailure(['echo 123 % g:zero'], 'E1154: Divide by zero') - if has('float') - v9.CheckDefExecAndScriptFailure([ - 'g:one = 1.0', - 'g:two = 2.0', - 'echo g:one % g:two', - ], 'E804', 3) - endif + v9.CheckDefExecAndScriptFailure([ + 'g:one = 1.0', + 'g:two = 2.0', + 'echo g:one % g:two', + ], 'E804', 3) lines =<< trim END var n = 0 @@ -1948,36 +1908,32 @@ def Test_expr7_vim9script() enddef def Test_expr7_float() - if !has('float') - MissingFeature 'float' - else - var lines =<< trim END - assert_equal(36.0, 6.0 * 6) - assert_equal(36.0, 6 * - 6.0) - assert_equal(36.0, 6.0 * 6.0) - assert_equal(1.0, g:afloat * g:anint) - - assert_equal(10.0, 60 / 6.0) - assert_equal(10.0, 60.0 / - 6) - assert_equal(10.0, 60.0 / 6.0) - assert_equal(0.01, g:afloat / g:anint) - - assert_equal(4.0, 6.0 * 4 / 6) - assert_equal(4.0, 6 * - 4.0 / - 6) - assert_equal(4.0, 6 * 4 / 6.0) - assert_equal(4.0, 6.0 * 4.0 / 6) - assert_equal(4.0, 6 * 4.0 / 6.0) - assert_equal(4.0, 6.0 * 4 / 6.0) - assert_equal(4.0, 6.0 * 4.0 / 6.0) - - assert_equal(4.0, 6.0 * 4.0 / 6.0) - END - v9.CheckDefAndScriptSuccess(lines) - endif + var lines =<< trim END + assert_equal(36.0, 6.0 * 6) + assert_equal(36.0, 6 * + 6.0) + assert_equal(36.0, 6.0 * 6.0) + assert_equal(1.0, g:afloat * g:anint) + + assert_equal(10.0, 60 / 6.0) + assert_equal(10.0, 60.0 / + 6) + assert_equal(10.0, 60.0 / 6.0) + assert_equal(0.01, g:afloat / g:anint) + + assert_equal(4.0, 6.0 * 4 / 6) + assert_equal(4.0, 6 * + 4.0 / + 6) + assert_equal(4.0, 6 * 4 / 6.0) + assert_equal(4.0, 6.0 * 4.0 / 6) + assert_equal(4.0, 6 * 4.0 / 6.0) + assert_equal(4.0, 6.0 * 4 / 6.0) + assert_equal(4.0, 6.0 * 4.0 / 6.0) + + assert_equal(4.0, 6.0 * 4.0 / 6.0) + END + v9.CheckDefAndScriptSuccess(lines) enddef func Test_expr7_fails() @@ -2013,9 +1969,7 @@ func Test_expr7_fails() call v9.CheckDefAndScriptFailure(["var x = {one: 1} % {two: 2}"], ['E1035:', 'E728:'], 1) call v9.CheckDefAndScriptFailure(["var x = 0xff[1]"], ['E1107:', 'E1062:'], 1) - if has('float') - call v9.CheckDefAndScriptFailure(["var x = 0.7[1]"], ['E1107:', 'E806:'], 1) - endif + call v9.CheckDefAndScriptFailure(["var x = 0.7[1]"], ['E1107:', 'E806:'], 1) for op in ['*', '/', '%'] let lines = ['var x = 1', op .. '2', '# comment'] @@ -2025,16 +1979,14 @@ func Test_expr7_fails() endfunc func Test_expr7_float_fails() - CheckFeature float call v9.CheckDefAndScriptFailure(["var x = 1.0 % 2"], ['E1035:', 'E804:'], 1) endfunc " define here to use old style parsing -if has('float') - let g:float_zero = 0.0 - let g:float_neg = -9.8 - let g:float_big = 9.9e99 -endif +let g:float_zero = 0.0 +let g:float_neg = -9.8 +let g:float_big = 9.9e99 + let g:blob_empty = 0z let g:blob_one = 0z01 let g:blob_long = 0z0102.0304 @@ -2099,17 +2051,13 @@ enddef def Test_expr9_float() # float constant - if !has('float') - MissingFeature 'float' - else - var lines =<< trim END - assert_equal(g:float_zero, .0) - assert_equal(g:float_zero, 0.0) - assert_equal(g:float_neg, -9.8) - assert_equal(g:float_big, 9.9e99) - END - v9.CheckDefAndScriptSuccess(lines) - endif + var lines =<< trim END + assert_equal(g:float_zero, .0) + assert_equal(g:float_zero, 0.0) + assert_equal(g:float_neg, -9.8) + assert_equal(g:float_big, 9.9e99) + END + v9.CheckDefAndScriptSuccess(lines) enddef def Test_expr9_blob() @@ -2797,11 +2745,9 @@ def Test_expr9_dict() assert_equal('numberexpr', dkeys[12]) assert_equal('number', dkeys[34]) assert_equal('bool', dkeys[true]) - if has('float') - dkeys = {[1.2]: 'floatexpr', [3.4]: 'float'} - assert_equal('floatexpr', dkeys[1.2]) - assert_equal('float', dkeys[3.4]) - endif + dkeys = {[1.2]: 'floatexpr', [3.4]: 'float'} + assert_equal('floatexpr', dkeys[1.2]) + assert_equal('float', dkeys[3.4]) # automatic conversion from number to string var n = 123 diff --git a/src/testdir/test_vimscript.vim b/src/testdir/test_vimscript.vim --- a/src/testdir/test_vimscript.vim +++ b/src/testdir/test_vimscript.vim @@ -6490,9 +6490,7 @@ func Test_type() call assert_equal(2, type(function("tr", [8]))) call assert_equal(3, type([])) call assert_equal(4, type({})) - if has('float') - call assert_equal(5, type(0.0)) - endif + call assert_equal(5, type(0.0)) call assert_equal(6, type(v:false)) call assert_equal(6, type(v:true)) call assert_equal(7, type(v:none)) @@ -6505,9 +6503,7 @@ func Test_type() call assert_equal(v:t_func, type(function("tr", [8]))) call assert_equal(v:t_list, type([])) call assert_equal(v:t_dict, type({})) - if has('float') - call assert_equal(v:t_float, type(0.0)) - endif + call assert_equal(v:t_float, type(0.0)) call assert_equal(v:t_bool, type(v:false)) call assert_equal(v:t_bool, type(v:true)) call assert_equal(v:t_none, type(v:none)) @@ -6551,11 +6547,9 @@ func Test_type() call assert_true(v:none == 0) call assert_false(v:none == 1) call assert_false(v:none != 0) - if has('float') - call assert_true(v:null == 0.0) - call assert_false(v:null == 0.1) - call assert_false(v:null != 0.0) - endif + call assert_true(v:null == 0.0) + call assert_false(v:null == 0.1) + call assert_false(v:null != 0.0) call assert_true(v:false is v:false) call assert_true(v:true is v:true) @@ -6670,16 +6664,14 @@ func Test_echo_and_string() \ "'foo bar'"], l) " Float - if has('float') - let a = -1.2e0 - redir => result - echo a - echo string(a) - redir END - let l = split(result, "\n") - call assert_equal(["-1.2", - \ "-1.2"], l) - endif + let a = -1.2e0 + redir => result + echo a + echo string(a) + redir END + let l = split(result, "\n") + call assert_equal(["-1.2", + \ "-1.2"], l) " Funcref redir => result @@ -6816,10 +6808,8 @@ func Test_num64() call assert_equal(-9223372036854775807, -1 / 0) call assert_equal(-9223372036854775807 - 1, 0 / 0) - if has('float') - call assert_equal( 0x7FFFffffFFFFffff, float2nr( 1.0e150)) - call assert_equal(-0x7FFFffffFFFFffff, float2nr(-1.0e150)) - endif + call assert_equal( 0x7FFFffffFFFFffff, float2nr( 1.0e150)) + call assert_equal(-0x7FFFffffFFFFffff, float2nr(-1.0e150)) let rng = range(0xFFFFffff, 0x100000001) call assert_equal([0xFFFFffff, 0x100000000, 0x100000001], rng) @@ -6921,10 +6911,8 @@ func Test_bitwise_functions() call assert_equal(0, and(127, 128)) call assert_fails("call and([], 1)", 'E745:') call assert_fails("call and({}, 1)", 'E728:') - if has('float') - call assert_fails("call and(1.0, 1)", 'E805:') - call assert_fails("call and(1, 1.0)", 'E805:') - endif + call assert_fails("call and(1.0, 1)", 'E805:') + call assert_fails("call and(1, 1.0)", 'E805:') call assert_fails("call and(1, [])", 'E745:') call assert_fails("call and(1, {})", 'E728:') " or @@ -6934,10 +6922,8 @@ func Test_bitwise_functions() call assert_equal(123, or(0, 123)) call assert_fails("call or([], 1)", 'E745:') call assert_fails("call or({}, 1)", 'E728:') - if has('float') - call assert_fails("call or(1.0, 1)", 'E805:') - call assert_fails("call or(1, 1.0)", 'E805:') - endif + call assert_fails("call or(1.0, 1)", 'E805:') + call assert_fails("call or(1, 1.0)", 'E805:') call assert_fails("call or(1, [])", 'E745:') call assert_fails("call or(1, {})", 'E728:') " xor @@ -6945,10 +6931,8 @@ func Test_bitwise_functions() call assert_equal(111, xor(127, 16)) eval 127->xor(16)->assert_equal(111) call assert_equal(255, xor(127, 128)) - if has('float') - call assert_fails("call xor(1.0, 1)", 'E805:') - call assert_fails("call xor(1, 1.0)", 'E805:') - endif + call assert_fails("call xor(1.0, 1)", 'E805:') + call assert_fails("call xor(1, 1.0)", 'E805:') call assert_fails("call xor([], 1)", 'E745:') call assert_fails("call xor({}, 1)", 'E728:') call assert_fails("call xor(1, [])", 'E745:') @@ -6958,9 +6942,7 @@ func Test_bitwise_functions() eval 127->invert()->and(65535)->assert_equal(65408) call assert_equal(65519, and(invert(16), 65535)) call assert_equal(65407, and(invert(128), 65535)) - if has('float') - call assert_fails("call invert(1.0)", 'E805:') - endif + call assert_fails("call invert(1.0)", 'E805:') call assert_fails("call invert([])", 'E745:') call assert_fails("call invert({})", 'E728:') endfunc @@ -7039,38 +7021,36 @@ func Test_compound_assignment_operators( let x += 1 call assert_equal(1, x) - if has('float') - " Test for float - let x -= 1.5 - call assert_equal(-0.5, x) - let x = 0.5 - let x += 4.5 - call assert_equal(5.0, x) - let x -= 1.5 - call assert_equal(3.5, x) - let x *= 3.0 - call assert_equal(10.5, x) - let x /= 2.5 - call assert_equal(4.2, x) - call assert_fails('let x %= 0.5', 'E734:') - call assert_fails('let x .= "f"', 'E734:') - let x = !3.14 - call assert_equal(0.0, x) - - " integer and float operations - let x = 1 - let x *= 2.1 - call assert_equal(2.1, x) - let x = 1 - let x /= 0.25 - call assert_equal(4.0, x) - let x = 1 - call assert_fails('let x %= 0.25', 'E734:') - let x = 1 - call assert_fails('let x .= 0.25', 'E734:') - let x = 1.0 - call assert_fails('let x += [1.1]', 'E734:') - endif + " Test for float + let x -= 1.5 + call assert_equal(-0.5, x) + let x = 0.5 + let x += 4.5 + call assert_equal(5.0, x) + let x -= 1.5 + call assert_equal(3.5, x) + let x *= 3.0 + call assert_equal(10.5, x) + let x /= 2.5 + call assert_equal(4.2, x) + call assert_fails('let x %= 0.5', 'E734:') + call assert_fails('let x .= "f"', 'E734:') + let x = !3.14 + call assert_equal(0.0, x) + + " integer and float operations + let x = 1 + let x *= 2.1 + call assert_equal(2.1, x) + let x = 1 + let x /= 0.25 + call assert_equal(4.0, x) + let x = 1 + call assert_fails('let x %= 0.25', 'E734:') + let x = 1 + call assert_fails('let x .= 0.25', 'E734:') + let x = 1.0 + call assert_fails('let x += [1.1]', 'E734:') " Test for environment variable let $FOO = 1 @@ -7142,9 +7122,7 @@ func Test_refcount() call assert_equal(0, test_refcount({})) call assert_equal(0, test_refcount(0zff)) call assert_equal(0, test_refcount({-> line('.')})) - if has('float') - call assert_equal(-1, test_refcount(0.1)) - endif + call assert_equal(-1, test_refcount(0.1)) if has('job') call assert_equal(0, test_refcount(job_start([&shell, &shellcmdflag, 'echo .']))) endif @@ -7156,10 +7134,8 @@ func Test_refcount() call assert_equal(-1, test_refcount(x)) let x = v:true call assert_equal(-1, test_refcount(x)) - if has('float') - let x = 0.1 - call assert_equal(-1, test_refcount(x)) - endif + let x = 0.1 + call assert_equal(-1, test_refcount(x)) " Check refcount let x = [] @@ -7377,16 +7353,14 @@ endfunc " Test for errors in converting to float from various types {{{1 func Test_float_conversion_errors() - if has('float') - call assert_fails('let x = 4.0 % 2.0', 'E804:') - call assert_fails('echo 1.1[0]', 'E806:') - call assert_fails('echo sort([function("min"), 1], "f")', 'E891:') - call assert_fails('echo 3.2 == "vim"', 'E892:') - call assert_fails('echo sort([[], 1], "f")', 'E893:') - call assert_fails('echo sort([{}, 1], "f")', 'E894:') - call assert_fails('echo 3.2 == v:true', 'E362:') - call assert_fails('echo 3.2 == v:none', 'E907:') - endif + call assert_fails('let x = 4.0 % 2.0', 'E804:') + call assert_fails('echo 1.1[0]', 'E806:') + call assert_fails('echo sort([function("min"), 1], "f")', 'E891:') + call assert_fails('echo 3.2 == "vim"', 'E892:') + call assert_fails('echo sort([[], 1], "f")', 'E893:') + call assert_fails('echo sort([{}, 1], "f")', 'E894:') + call assert_fails('echo 3.2 == v:true', 'E362:') + call assert_fails('echo 3.2 == v:none', 'E907:') endfunc " invalid function names {{{1 diff --git a/src/testing.c b/src/testing.c --- a/src/testing.c +++ b/src/testing.c @@ -787,7 +787,6 @@ assert_inrange(typval_T *argvars) char msg[200]; char_u numbuf[NUMBUFLEN]; -#ifdef FEAT_FLOAT if (argvars[0].v_type == VAR_FLOAT || argvars[1].v_type == VAR_FLOAT || argvars[2].v_type == VAR_FLOAT) @@ -816,7 +815,6 @@ assert_inrange(typval_T *argvars) } } else -#endif { varnumber_T lower = tv_get_number_chk(&argvars[0], &error); varnumber_T upper = tv_get_number_chk(&argvars[1], &error); diff --git a/src/time.c b/src/time.c --- a/src/time.c +++ b/src/time.c @@ -221,20 +221,19 @@ f_reltime(typval_T *argvars UNUSED, typv # endif } -# ifdef FEAT_FLOAT /* * "reltimefloat()" function */ void f_reltimefloat(typval_T *argvars UNUSED, typval_T *rettv) { -# ifdef FEAT_RELTIME +# ifdef FEAT_RELTIME proftime_T tm; -# endif +# endif rettv->v_type = VAR_FLOAT; rettv->vval.v_float = 0; -# ifdef FEAT_RELTIME +# ifdef FEAT_RELTIME if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL) return; @@ -242,9 +241,8 @@ f_reltimefloat(typval_T *argvars UNUSED, rettv->vval.v_float = profile_float(&tm); else if (in_vim9script()) emsg(_(e_invalid_argument)); -# endif +# endif } -# endif /* * "reltimestr()" function diff --git a/src/typval.c b/src/typval.c --- a/src/typval.c +++ b/src/typval.c @@ -136,10 +136,8 @@ clear_tv(typval_T *varp) varp->vval.v_number = 0; break; case VAR_FLOAT: -#ifdef FEAT_FLOAT varp->vval.v_float = 0.0; break; -#endif case VAR_JOB: #ifdef FEAT_JOB_CHANNEL job_unref(varp->vval.v_job); @@ -190,10 +188,8 @@ tv_get_bool_or_number_chk(typval_T *varp } return varp->vval.v_number; case VAR_FLOAT: -#ifdef FEAT_FLOAT emsg(_(e_using_float_as_number)); break; -#endif case VAR_FUNC: case VAR_PARTIAL: emsg(_(e_using_funcref_as_number)); @@ -296,7 +292,6 @@ tv_get_bool_chk(typval_T *varp, int *den return tv_get_bool_or_number_chk(varp, denote, TRUE); } -#if defined(FEAT_FLOAT) || defined(PROTO) static float_T tv_get_float_chk(typval_T *varp, int *error) { @@ -357,7 +352,6 @@ tv_get_float(typval_T *varp) { return tv_get_float_chk(varp, NULL); } -#endif /* * Give an error and return FAIL unless "args[idx]" is unknown @@ -1007,7 +1001,6 @@ tv_get_string_buf_chk_strict(typval_T *v emsg(_(e_using_dictionary_as_string)); break; case VAR_FLOAT: -#ifdef FEAT_FLOAT if (strict) { emsg(_(e_using_float_as_string)); @@ -1015,7 +1008,6 @@ tv_get_string_buf_chk_strict(typval_T *v } vim_snprintf((char *)buf, NUMBUFLEN, "%g", varp->vval.v_float); return buf; -#endif case VAR_STRING: if (varp->vval.v_string != NULL) return varp->vval.v_string; @@ -1136,10 +1128,8 @@ copy_tv(typval_T *from, typval_T *to) to->vval.v_number = from->vval.v_number; break; case VAR_FLOAT: -#ifdef FEAT_FLOAT to->vval.v_float = from->vval.v_float; break; -#endif case VAR_JOB: #ifdef FEAT_JOB_CHANNEL to->vval.v_job = from->vval.v_job; @@ -1289,7 +1279,6 @@ typval_compare( n1 = res; } -#ifdef FEAT_FLOAT // If one of the two variables is a float, compare as a float. // When using "=~" or "!~", always compare as string. else if ((tv1->v_type == VAR_FLOAT || tv2->v_type == VAR_FLOAT) @@ -1322,7 +1311,6 @@ typval_compare( default: break; // avoid gcc warning } } -#endif // If one of the two variables is a number, compare as a number. // When using "=~" or "!~", always compare as string. @@ -1489,11 +1477,9 @@ typval_compare_null(typval_T *tv1, typva case VAR_NUMBER: if (!in_vim9script()) return tv->vval.v_number == 0; break; -#ifdef FEAT_FLOAT case VAR_FLOAT: if (!in_vim9script()) return tv->vval.v_float == 0.0; break; -#endif default: break; } } @@ -1870,9 +1856,7 @@ tv_equal( return ((ic ? MB_STRICMP(s1, s2) : STRCMP(s1, s2)) == 0); case VAR_FLOAT: -#ifdef FEAT_FLOAT return tv1->vval.v_float == tv2->vval.v_float; -#endif case VAR_JOB: #ifdef FEAT_JOB_CHANNEL return tv1->vval.v_job == tv2->vval.v_job; @@ -2005,7 +1989,6 @@ eval_number( { int len; int skip_quotes = !in_old_script(4); -#ifdef FEAT_FLOAT char_u *p; int get_float = FALSE; @@ -2062,7 +2045,6 @@ eval_number( } } else -#endif if (**arg == '0' && ((*arg)[1] == 'z' || (*arg)[1] == 'Z')) { char_u *bp; diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -244,11 +244,7 @@ static char *(features[]) = #else "-find_in_path", #endif -#ifdef FEAT_FLOAT "+float", -#else - "-float", -#endif #ifdef FEAT_FOLDING "+folding", #else @@ -704,6 +700,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 491, +/**/ 490, /**/ 489, diff --git a/src/vim9.h b/src/vim9.h --- a/src/vim9.h +++ b/src/vim9.h @@ -469,9 +469,7 @@ struct isn_S { varnumber_T number; blob_T *blob; vartype_T vartype; -#ifdef FEAT_FLOAT float_T fnumber; -#endif channel_T *channel; job_T *job; partial_T *partial; diff --git a/src/vim9compile.c b/src/vim9compile.c --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -2384,9 +2384,7 @@ compile_assignment(char_u *arg, exarg_T r = generate_PUSHBOOL(cctx, VVAL_FALSE); break; case VAR_FLOAT: -#ifdef FEAT_FLOAT r = generate_PUSHF(cctx, 0.0); -#endif break; case VAR_STRING: r = generate_PUSHS(cctx, NULL); @@ -2455,11 +2453,9 @@ compile_assignment(char_u *arg, exarg_T expected = lhs.lhs_member_type; stacktype = get_type_on_stack(cctx, 0); if ( -#ifdef FEAT_FLOAT // If variable is float operation with number is OK. !(expected == &t_float && (stacktype == &t_number || stacktype == &t_number_bool)) && -#endif need_type(stacktype, expected, -1, 0, cctx, FALSE, FALSE) == FAIL) goto theend; diff --git a/src/vim9execute.c b/src/vim9execute.c --- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -3872,12 +3872,10 @@ exec_instructions(ectx_T *ectx) tv->v_type = VAR_SPECIAL; tv->vval.v_number = iptr->isn_arg.number; break; -#ifdef FEAT_FLOAT case ISN_PUSHF: tv->v_type = VAR_FLOAT; tv->vval.v_float = iptr->isn_arg.fnumber; break; -#endif case ISN_PUSHBLOB: blob_copy(iptr->isn_arg.blob, tv); break; @@ -4569,7 +4567,6 @@ exec_instructions(ectx_T *ectx) // Computation with two float arguments case ISN_OPFLOAT: case ISN_COMPAREFLOAT: -#ifdef FEAT_FLOAT { typval_T *tv1 = STACK_TV_BOT(-2); typval_T *tv2 = STACK_TV_BOT(-1); @@ -4602,7 +4599,6 @@ exec_instructions(ectx_T *ectx) else tv1->vval.v_float = res; } -#endif break; case ISN_COMPARELIST: @@ -4744,9 +4740,7 @@ exec_instructions(ectx_T *ectx) typval_T *tv1 = STACK_TV_BOT(-2); typval_T *tv2 = STACK_TV_BOT(-1); varnumber_T n1, n2; -#ifdef FEAT_FLOAT float_T f1 = 0, f2 = 0; -#endif int error = FALSE; if (iptr->isn_arg.op.op_type == EXPR_ADD) @@ -4767,42 +4761,33 @@ exec_instructions(ectx_T *ectx) break; } } -#ifdef FEAT_FLOAT if (tv1->v_type == VAR_FLOAT) { f1 = tv1->vval.v_float; n1 = 0; } else -#endif { SOURCING_LNUM = iptr->isn_lnum; n1 = tv_get_number_chk(tv1, &error); if (error) goto on_error; -#ifdef FEAT_FLOAT if (tv2->v_type == VAR_FLOAT) f1 = n1; -#endif } -#ifdef FEAT_FLOAT if (tv2->v_type == VAR_FLOAT) { f2 = tv2->vval.v_float; n2 = 0; } else -#endif { n2 = tv_get_number_chk(tv2, &error); if (error) goto on_error; -#ifdef FEAT_FLOAT if (tv1->v_type == VAR_FLOAT) f2 = n2; -#endif } -#ifdef FEAT_FLOAT // if there is a float on either side the result is a float if (tv1->v_type == VAR_FLOAT || tv2->v_type == VAR_FLOAT) { @@ -4823,7 +4808,6 @@ exec_instructions(ectx_T *ectx) --ectx->ec_stack.ga_len; } else -#endif { int failed = FALSE; @@ -5110,11 +5094,9 @@ exec_instructions(ectx_T *ectx) case ISN_NEGATENR: tv = STACK_TV_BOT(-1); // CHECKTYPE should have checked the variable type -#ifdef FEAT_FLOAT if (tv->v_type == VAR_FLOAT) tv->vval.v_float = -tv->vval.v_float; else -#endif tv->vval.v_number = -tv->vval.v_number; break; @@ -6279,9 +6261,7 @@ list_instructions(char *pfx, isn_T *inst get_var_special_name(iptr->isn_arg.number)); break; case ISN_PUSHF: -#ifdef FEAT_FLOAT smsg("%s%4d PUSHF %g", pfx, current, iptr->isn_arg.fnumber); -#endif break; case ISN_PUSHS: smsg("%s%4d PUSHS \"%s\"", pfx, current, iptr->isn_arg.string); @@ -6896,11 +6876,7 @@ tv2bool(typval_T *tv) case VAR_NUMBER: return tv->vval.v_number != 0; case VAR_FLOAT: -#ifdef FEAT_FLOAT return tv->vval.v_float != 0.0; -#else - break; -#endif case VAR_PARTIAL: return tv->vval.v_partial != NULL; case VAR_FUNC: diff --git a/src/vim9expr.c b/src/vim9expr.c --- a/src/vim9expr.c +++ b/src/vim9expr.c @@ -1488,14 +1488,12 @@ apply_leader(typval_T *rettv, int numeri if (*p == '-' || *p == '+') { // only '-' has an effect, for '+' we only check the type -#ifdef FEAT_FLOAT if (rettv->v_type == VAR_FLOAT) { if (*p == '-') rettv->vval.v_float = -rettv->vval.v_float; } else -#endif { varnumber_T val; int error = FALSE; diff --git a/src/vim9instr.c b/src/vim9instr.c --- a/src/vim9instr.c +++ b/src/vim9instr.c @@ -208,9 +208,7 @@ generate_add_instr( vartype == VAR_NUMBER ? ISN_OPNR : vartype == VAR_LIST ? ISN_ADDLIST : vartype == VAR_BLOB ? ISN_ADDBLOB -#ifdef FEAT_FLOAT : vartype == VAR_FLOAT ? ISN_OPFLOAT -#endif : ISN_OPANY, 1); if (vartype != VAR_LIST && vartype != VAR_BLOB @@ -251,9 +249,7 @@ operator_type(type_T *type1, type_T *typ if (type1->tt_type == type2->tt_type && (type1->tt_type == VAR_NUMBER || type1->tt_type == VAR_LIST -#ifdef FEAT_FLOAT || type1->tt_type == VAR_FLOAT -#endif || type1->tt_type == VAR_BLOB)) return type1->tt_type; return VAR_ANY; @@ -293,10 +289,8 @@ generate_two_op(cctx_T *cctx, char_u *op return FAIL; if (vartype == VAR_NUMBER) isn = generate_instr_drop(cctx, ISN_OPNR, 1); -#ifdef FEAT_FLOAT else if (vartype == VAR_FLOAT) isn = generate_instr_drop(cctx, ISN_OPFLOAT, 1); -#endif else isn = generate_instr_drop(cctx, ISN_OPANY, 1); if (isn != NULL) @@ -326,12 +320,10 @@ generate_two_op(cctx_T *cctx, char_u *op { type_T *type = &t_any; -#ifdef FEAT_FLOAT // float+number and number+float results in float if ((type1->tt_type == VAR_NUMBER || type1->tt_type == VAR_FLOAT) - && (type2->tt_type == VAR_NUMBER || type2->tt_type == VAR_FLOAT)) + && (type2->tt_type == VAR_NUMBER || type2->tt_type == VAR_FLOAT)) type = &t_float; -#endif set_type_on_stack(cctx, type, 0); } @@ -580,11 +572,9 @@ generate_tv_PUSH(cctx_T *cctx, typval_T case VAR_NUMBER: generate_PUSHNR(cctx, tv->vval.v_number); break; -#ifdef FEAT_FLOAT case VAR_FLOAT: generate_PUSHF(cctx, tv->vval.v_float); break; -#endif case VAR_BLOB: generate_PUSHBLOB(cctx, tv->vval.v_blob); tv->vval.v_blob = NULL; @@ -688,7 +678,6 @@ generate_PUSHSPEC(cctx_T *cctx, varnumbe return OK; } -#if defined(FEAT_FLOAT) || defined(PROTO) /* * Generate an ISN_PUSHF instruction. */ @@ -704,7 +693,6 @@ generate_PUSHF(cctx_T *cctx, float_T fnu return OK; } -#endif /* * Generate an ISN_PUSHS instruction. diff --git a/src/vim9type.c b/src/vim9type.c --- a/src/vim9type.c +++ b/src/vim9type.c @@ -985,14 +985,8 @@ parse_type(char_u **arg, garray_T *type_ case 'f': if (len == 5 && STRNCMP(*arg, "float", len) == 0) { -#ifdef FEAT_FLOAT *arg += len; return &t_float; -#else - if (give_error) - emsg(_(e_this_vim_is_not_compiled_with_float_support)); - return NULL; -#endif } if (len == 4 && STRNCMP(*arg, "func", len) == 0) { diff --git a/src/viminfo.c b/src/viminfo.c --- a/src/viminfo.c +++ b/src/viminfo.c @@ -1225,9 +1225,7 @@ read_viminfo_varlist(vir_T *virp, int wr switch (*tab) { case 'S': type = VAR_STRING; break; -#ifdef FEAT_FLOAT case 'F': type = VAR_FLOAT; break; -#endif case 'D': type = VAR_DICT; break; case 'L': type = VAR_LIST; break; case 'B': type = VAR_BLOB; break; @@ -1242,10 +1240,8 @@ read_viminfo_varlist(vir_T *virp, int wr || type == VAR_LIST || type == VAR_BLOB) tv.vval.v_string = viminfo_readstring(virp, (int)(tab - virp->vir_line + 1), TRUE); -#ifdef FEAT_FLOAT else if (type == VAR_FLOAT) (void)string2float(tab + 1, &tv.vval.v_float, FALSE); -#endif else { tv.vval.v_number = atol((char *)tab + 1);