To: vim_dev@googlegroups.com Subject: Patch 9.0.0491 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0491 Problem: No good reason to build without the float feature. Solution: Remove configure check for float and "#ifdef FEAT_FLOAT". Files: runtime/doc/builtin.txt, runtime/doc/eval.txt, runtime/doc/mlang.txt, runtime/doc/various.txt, src/feature.h, src/configure.ac, src/auto/configure, src/config.h.in, src/os_vms_conf.h, src/dict.c, src/eval.c, src/evalfunc.c, src/ex_cmds.c, src/float.c, src/gui_gtk_x11.c, src/gui_x11.c, src/if_lua.c, src/if_mzsch.c, src/if_ruby.c, src/json.c, src/list.c, src/locale.c, src/message_test.c, src/os_mac_conv.c, src/profiler.c, src/session.c, src/strings.c, src/syntax.c, src/testing.c, src/time.c, src/typval.c, src/version.c, src/vim9compile.c, src/vim9execute.c, src/vim9expr.c, src/vim9instr.c, src/vim9type.c, src/viminfo.c, src/errors.h, src/if_py_both.h, src/macros.h, src/structs.h, src/vim9.h, src/testdir/runtest.vim, src/testdir/test_assert.vim, src/testdir/test_blob.vim, src/testdir/test_cscope.vim, src/testdir/test_eval_stuff.vim, src/testdir/test_execute_func.vim, src/testdir/test_expr.vim, src/testdir/test_float_func.vim, src/testdir/test_functions.vim, src/testdir/test_glob2regpat.vim, src/testdir/test_json.vim, src/testdir/test_listdict.vim, src/testdir/test_lua.vim, src/testdir/test_messages.vim, src/testdir/test_method.vim src/testdir/test_perl.vim, src/testdir/test_python2.vim, src/testdir/test_python3.vim, src/testdir/test_random.vim, src/testdir/test_reltime.vim, src/testdir/test_ruby.vim, src/testdir/test_sort.vim, src/testdir/test_substitute.vim, src/testdir/test_terminal.vim, src/testdir/test_true_false.vim, src/testdir/test_user_func.vim, src/testdir/test_vim9_assign.vim, src/testdir/test_vim9_builtin.vim, src/testdir/test_vim9_disassemble.vim, src/testdir/test_vim9_expr.vim, src/testdir/test_vimscript.vim *** ../vim-9.0.0490/runtime/doc/builtin.txt 2022-09-15 21:45:57.481522076 +0100 --- runtime/doc/builtin.txt 2022-09-17 21:00:36.960920054 +0100 *************** *** 753,760 **** 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 --- 753,758 ---- *************** *** 770,777 **** 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 --- 768,773 ---- *************** *** 904,911 **** 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| --- 900,905 ---- *************** *** 925,932 **** Can also be used as a |method|: > Compute()->atan() - < - {only available when compiled with the |+float| feature} atan2({expr1}, {expr2}) *atan2()* --- 919,924 ---- *************** *** 943,950 **** Can also be used as a |method|: > Compute()->atan2(1) - < - {only available when compiled with the |+float| feature} autocmd_add({acmds}) *autocmd_add()* --- 935,940 ---- *************** *** 1428,1435 **** 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| --- 1418,1423 ---- *************** *** 1674,1680 **** typed text only, or the last completion after no item is selected when using the or keys) ! inserted Inserted string. [NOT IMPLEMENT YET] *complete_info_mode* mode values are: --- 1662,1668 ---- typed text only, or the last completion after no item is selected when using the or keys) ! inserted Inserted string. [NOT IMPLEMENTED YET] *complete_info_mode* mode values are: *************** *** 1801,1808 **** Can also be used as a |method|: > Compute()->cos() - < - {only available when compiled with the |+float| feature} cosh({expr}) *cosh()* --- 1789,1794 ---- *************** *** 1818,1825 **** Can also be used as a |method|: > Compute()->cosh() - < - {only available when compiled with the |+float| feature} count({comp}, {expr} [, {ic} [, {start}]]) *count()* --- 1804,1809 ---- *************** *** 2403,2410 **** Can also be used as a |method|: > Compute()->exp() - < - {only available when compiled with the |+float| feature} expand({string} [, {nosuf} [, {list}]]) *expand()* --- 2389,2394 ---- *************** *** 2805,2812 **** Can also be used as a |method|: > Compute()->float2nr() - < - {only available when compiled with the |+float| feature} floor({expr}) *floor()* --- 2789,2794 ---- *************** *** 2824,2831 **** Can also be used as a |method|: > Compute()->floor() - < - {only available when compiled with the |+float| feature} fmod({expr1}, {expr2}) *fmod()* --- 2806,2811 ---- *************** *** 2846,2853 **** Can also be used as a |method|: > Compute()->fmod(1.22) - < - {only available when compiled with |+float| feature} fnameescape({string}) *fnameescape()* --- 2826,2831 ---- *************** *** 5040,5047 **** 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 --- 5026,5031 ---- *************** *** 5070,5077 **** 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 --- 5054,5059 ---- *************** *** 5500,5507 **** Can also be used as a |method|: > Compute()->log() - < - {only available when compiled with the |+float| feature} log10({expr}) *log10()* --- 5482,5487 ---- *************** *** 5516,5523 **** 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 --- 5496,5501 ---- *************** *** 5525,5532 **** 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. Dictionaries and lists obtained by vim.eval() are returned as-is. Other objects are returned as zero without any errors. --- 5503,5509 ---- 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. Dictionaries and lists obtained by vim.eval() are returned as-is. Other objects are returned as zero without any errors. *************** *** 6473,6480 **** 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} --- 6450,6455 ---- *************** *** 7356,7363 **** 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 --- 7331,7336 ---- *************** *** 7499,7506 **** starts in column zero and then matches before the cursor are skipped. When the 'c' flag is present in 'cpo' the next search starts after the match. Without the 'c' flag the next ! search starts one column further. This matters for ! overlapping matches. When searching backwards and the 'z' flag is given then the search starts in column zero, thus no match in the current line will be found (unless wrapping around the end of the --- 7472,7481 ---- starts in column zero and then matches before the cursor are skipped. When the 'c' flag is present in 'cpo' the next search starts after the match. Without the 'c' flag the next ! search starts one column after the start of the match. This ! matters for overlapping matches. See |cpo-c|. You can also ! insert "\ze" to change where the match ends, see |/\ze|. ! When searching backwards and the 'z' flag is given then the search starts in column zero, thus no match in the current line will be found (unless wrapping around the end of the *************** *** 7606,7612 **** " to 1) let result = searchcount() < ! The function is useful to add the count to |statusline|: > function! LastSearchCount() abort let result = searchcount(#{recompute: 0}) if empty(result) --- 7581,7587 ---- " to 1) let result = searchcount() < ! The function is useful to add the count to 'statusline': > function! LastSearchCount() abort let result = searchcount(#{recompute: 0}) if empty(result) *************** *** 8524,8531 **** Can also be used as a |method|: > Compute()->sin() - < - {only available when compiled with the |+float| feature} sinh({expr}) *sinh()* --- 8499,8504 ---- *************** *** 8541,8548 **** Can also be used as a |method|: > Compute()->sinh() - < - {only available when compiled with the |+float| feature} slice({expr}, {start} [, {end}]) *slice()* --- 8514,8519 ---- *************** *** 8809,8816 **** Can also be used as a |method|: > Compute()->sqrt() - < - {only available when compiled with the |+float| feature} srand([{expr}]) *srand()* --- 8780,8785 ---- *************** *** 8884,8891 **** 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 --- 8853,8858 ---- *************** *** 9631,9638 **** Can also be used as a |method|: > Compute()->tan() - < - {only available when compiled with the |+float| feature} tanh({expr}) *tanh()* --- 9598,9603 ---- *************** *** 9648,9655 **** Can also be used as a |method|: > Compute()->tanh() - < - {only available when compiled with the |+float| feature} tempname() *tempname()* *temp-file-name* --- 9613,9618 ---- *************** *** 9885,9892 **** 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 --- 9848,9853 ---- *** ../vim-9.0.0490/runtime/doc/eval.txt 2022-09-03 21:35:50.180158220 +0100 --- runtime/doc/eval.txt 2022-09-17 20:56:05.429498151 +0100 *************** *** 54,60 **** 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). --- 54,59 ---- *************** *** 1440,1446 **** {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 --- 1440,1445 ---- *** ../vim-9.0.0490/runtime/doc/mlang.txt 2022-06-28 11:21:06.000000000 +0100 --- runtime/doc/mlang.txt 2022-09-17 20:56:27.321451536 +0100 *************** *** 82,90 **** 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. This will make a difference for items that depend on the language (some messages, time and date format). Not fully supported on all systems --- 82,90 ---- characters. This sets $LC_COLLATE. Without an argument all are set, and additionally $LANG is set. ! 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 *** ../vim-9.0.0490/runtime/doc/various.txt 2022-08-26 17:52:47.886406161 +0100 --- runtime/doc/various.txt 2022-09-17 20:53:15.345860294 +0100 *************** *** 381,387 **** N *+folding* |folding| *+footer* |gui-footer| *+fork* Unix only: |fork| shell commands ! *+float* Floating point support N *+gettext* message translations |multi-lang| - *+GUI_Athena* Unix only: Athena |GUI| *+GUI_neXtaw* Unix only: neXtaw |GUI| --- 381,387 ---- N *+folding* |folding| *+footer* |gui-footer| *+fork* Unix only: |fork| shell commands ! 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| *** ../vim-9.0.0490/src/feature.h 2022-09-04 12:29:22.144893115 +0100 --- src/feature.h 2022-09-17 19:58:35.348804664 +0100 *************** *** 121,126 **** --- 121,127 ---- * +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,263 **** /* * +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 --- 252,260 ---- *** ../vim-9.0.0490/src/configure.ac 2022-07-30 11:00:46.549396706 +0100 --- src/configure.ac 2022-09-17 20:00:19.056596188 +0100 *************** *** 3952,3983 **** 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. 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()]) --- 3952,3959 ---- AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET), AC_MSG_RESULT(no)) ! dnl Floating point support may require the "m" library AC_CHECK_LIB(m, strtod) dnl isinf() and isnan() need to include header files and may need -lm. AC_MSG_CHECKING([for isinf()]) *** ../vim-9.0.0490/src/auto/configure 2022-07-30 11:00:46.549396706 +0100 --- src/auto/configure 2022-09-17 20:58:58.885128892 +0100 *************** *** 13379,13426 **** 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; } --- 13379,13384 ---- *** ../vim-9.0.0490/src/config.h.in 2022-06-05 21:57:06.000000000 +0100 --- src/config.h.in 2022-09-17 19:57:58.692877738 +0100 *************** *** 157,163 **** #undef HAVE_FCHDIR #undef HAVE_FCHOWN #undef HAVE_FCHMOD - #undef HAVE_FLOAT_FUNCS #undef HAVE_FSEEKO #undef HAVE_FSYNC #undef HAVE_FTRUNCATE --- 157,162 ---- *** ../vim-9.0.0490/src/os_vms_conf.h 2022-06-05 21:57:20.000000000 +0100 --- src/os_vms_conf.h 2022-09-17 19:58:42.188790993 +0100 *************** *** 110,116 **** #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 --- 110,115 ---- *** ../vim-9.0.0490/src/dict.c 2022-09-07 19:40:13.838414823 +0100 --- src/dict.c 2022-09-17 20:01:10.012492907 +0100 *************** *** 984,996 **** } 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) { --- 984,994 ---- *** ../vim-9.0.0490/src/eval.c 2022-09-17 16:27:36.142603905 +0100 --- src/eval.c 2022-09-17 20:03:20.932225503 +0100 *************** *** 525,533 **** { garray_T ga; char_u *retval; - #ifdef FEAT_FLOAT char_u numbuf[NUMBUFLEN]; - #endif if (convert && tv->v_type == VAR_LIST) { --- 525,531 ---- *************** *** 541,553 **** 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; --- 539,549 ---- *************** *** 1683,1689 **** { // 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; --- 1679,1684 ---- *************** *** 1702,1708 **** tv1->vval.v_float = f; } else - #endif { switch (*op) { --- 1697,1702 ---- *************** *** 1734,1740 **** return failed ? FAIL : OK; case VAR_FLOAT: - #ifdef FEAT_FLOAT { float_T f; --- 1728,1733 ---- *************** *** 1755,1761 **** case '/': tv1->vval.v_float /= f; break; } } - #endif return OK; } } --- 1748,1753 ---- *************** *** 3238,3246 **** } 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; --- 3230,3236 ---- *************** *** 3293,3306 **** || 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 ? --- 3283,3294 ---- *************** *** 3327,3334 **** { int error = FALSE; varnumber_T n1, n2; ! #ifdef FEAT_FLOAT ! float_T f1 = 0, f2 = 0; if (rettv->v_type == VAR_FLOAT) { --- 3315,3321 ---- { int error = FALSE; varnumber_T n1, n2; ! float_T f1 = 0, f2 = 0; if (rettv->v_type == VAR_FLOAT) { *************** *** 3336,3342 **** n1 = 0; } else - #endif { n1 = tv_get_number_chk(rettv, &error); if (error) --- 3323,3328 ---- *************** *** 3349,3367 **** 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) --- 3335,3349 ---- *************** *** 3370,3383 **** 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) { --- 3352,3362 ---- *************** *** 3389,3395 **** rettv->vval.v_float = f1; } else - #endif { if (op == '+') n1 = n1 + n2; --- 3368,3373 ---- *************** *** 3423,3431 **** evalarg_T *evalarg, int want_string) // after "." operator { - #ifdef FEAT_FLOAT int use_float = FALSE; - #endif /* * Get the first expression. --- 3401,3407 ---- *************** *** 3444,3452 **** char_u *p; int op; varnumber_T n1, n2; - #ifdef FEAT_FLOAT float_T f1, f2; - #endif int error; // "*=", "/=" and "%=" are assignments --- 3420,3426 ---- *************** *** 3469,3482 **** *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; --- 3443,3453 ---- *************** *** 3484,3490 **** n1 = 0; } else - #endif n1 = tv_get_number_chk(rettv, &error); clear_tv(rettv); if (error) --- 3455,3460 ---- *************** *** 3508,3514 **** if (evaluate) { - #ifdef FEAT_FLOAT if (var2.v_type == VAR_FLOAT) { if (!use_float) --- 3478,3483 ---- *************** *** 3520,3549 **** 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 // VMS crashes on divide by zero, work around it if (f2 == 0.0) { --- 3489,3514 ---- n2 = 0; } else { n2 = tv_get_number_chk(&var2, &error); clear_tv(&var2); if (error) return FAIL; if (use_float) f2 = n2; } /* * Compute the result. * When either side is a float the result is a float. */ if (use_float) { if (op == '*') f1 = f1 * f2; else if (op == '/') { ! #ifdef VMS // VMS crashes on divide by zero, work around it if (f2 == 0.0) { *************** *** 3556,3566 **** } else f1 = f1 / f2; ! # 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 } else { --- 3521,3531 ---- } else f1 = f1 / f2; ! #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 } else { *************** *** 3571,3577 **** rettv->vval.v_float = f1; } else - #endif { int failed = FALSE; --- 3536,3541 ---- *************** *** 3858,3868 **** return FAIL; end_leader = *arg; ! if (**arg == '.' && (!isdigit(*(*arg + 1)) ! #ifdef FEAT_FLOAT ! || in_old_script(2) ! #endif ! )) { semsg(_(e_invalid_expression_str), *arg); ++*arg; --- 3822,3828 ---- return FAIL; end_leader = *arg; ! if (**arg == '.' && (!isdigit(*(*arg + 1)) || in_old_script(2))) { semsg(_(e_invalid_expression_str), *arg); ++*arg; *************** *** 4129,4141 **** 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; --- 4089,4099 ---- *************** *** 4161,4167 **** ++end_leader; break; } - #ifdef FEAT_FLOAT if (rettv->v_type == VAR_FLOAT) { if (vim9script) --- 4119,4124 ---- *************** *** 4173,4179 **** f = !f; } else - #endif { val = !val; type = VAR_BOOL; --- 4130,4135 ---- *************** *** 4181,4205 **** } 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) --- 4137,4157 ---- *************** *** 4500,4506 **** { int error = FALSE; - #ifdef FEAT_FLOAT // allow for indexing with float if (vim9script && rettv->v_type == VAR_DICT && var1.v_type == VAR_FLOAT) --- 4452,4457 ---- *************** *** 4508,4514 **** 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 --- 4459,4465 ---- var1.vval.v_string = typval_tostring(&var1, TRUE); var1.v_type = VAR_STRING; } ! if (vim9script && rettv->v_type == VAR_LIST) tv_get_number_chk(&var1, &error); else *************** *** 4599,4609 **** 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: --- 4550,4558 ---- *************** *** 5696,5707 **** 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: --- 5645,5654 ---- *** ../vim-9.0.0490/src/evalfunc.c 2022-09-15 22:03:53.040239602 +0100 --- src/evalfunc.c 2022-09-17 20:06:54.823783612 +0100 *************** *** 1512,1523 **** #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) # define MATH_FUNC(name) name #else # define MATH_FUNC(name) NULL --- 1512,1518 ---- #define FEARG_3 3 // base is the third argument #define FEARG_4 4 // base is the fourth argument ! #if defined(HAVE_MATH_H) # define MATH_FUNC(name) name #else # define MATH_FUNC(name) NULL *************** *** 1556,1564 **** static funcentry_T global_functions[] = { {"abs", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_any, FLOAT_FUNC(f_abs)}, {"acos", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, FLOAT_FUNC(f_acos)}, {"add", 2, 2, FEARG_1, arg2_listblob_item, ret_first_arg, f_add}, {"and", 2, 2, FEARG_1, arg2_number, --- 1551,1559 ---- static funcentry_T global_functions[] = { {"abs", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_any, f_abs}, {"acos", 1, 1, FEARG_1, arg1_float_or_nr, ! 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,1582 **** {"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)}, {"assert_beeps", 1, 1, FEARG_1, arg1_string, ret_number_bool, f_assert_beeps}, {"assert_equal", 2, 3, FEARG_2, NULL, --- 1571,1577 ---- {"argv", 0, 2, 0, arg2_number, ret_argv, f_argv}, {"asin", 1, 1, FEARG_1, arg1_float_or_nr, ! 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,1612 **** {"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)}, {"atan2", 2, 2, FEARG_1, arg2_float_or_nr, ! ret_float, FLOAT_FUNC(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, --- 1599,1607 ---- {"assert_true", 1, 2, FEARG_1, NULL, ret_number_bool, f_assert_true}, {"atan", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, f_atan}, {"atan2", 2, 2, FEARG_1, arg2_float_or_nr, ! 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,1682 **** {"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)}, {"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, --- 1671,1677 ---- {"call", 2, 3, FEARG_1, arg3_any_list_dict, ret_any, f_call}, {"ceil", 1, 1, FEARG_1, arg1_float_or_nr, ! 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,1752 **** {"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)}, {"cosh", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, FLOAT_FUNC(f_cosh)}, {"count", 2, 4, FEARG_1, arg24_count, ret_number, f_count}, {"cscope_connection",0,3, 0, arg3_number_string_string, --- 1739,1747 ---- {"copy", 1, 1, FEARG_1, NULL, ret_copy, f_copy}, {"cos", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, f_cos}, {"cosh", 1, 1, FEARG_1, arg1_float_or_nr, ! 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,1810 **** {"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)}, {"expand", 1, 3, FEARG_1, arg3_string_bool_bool, ret_any, f_expand}, {"expandcmd", 1, 2, FEARG_1, arg2_string_dict, --- 1799,1805 ---- {"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, f_exp}, {"expand", 1, 3, FEARG_1, arg3_string_bool_bool, ret_any, f_expand}, {"expandcmd", 1, 2, FEARG_1, arg2_string_dict, *************** *** 1832,1842 **** {"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)}, {"floor", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, FLOAT_FUNC(f_floor)}, {"fmod", 2, 2, FEARG_1, arg2_float_or_nr, ! ret_float, FLOAT_FUNC(f_fmod)}, {"fnameescape", 1, 1, FEARG_1, arg1_string, ret_string, f_fnameescape}, {"fnamemodify", 2, 2, FEARG_1, arg2_string, --- 1827,1837 ---- {"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, f_float2nr}, {"floor", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, f_floor}, {"fmod", 2, 2, FEARG_1, arg2_float_or_nr, ! ret_float, f_fmod}, {"fnameescape", 1, 1, FEARG_1, arg1_string, ret_string, f_fnameescape}, {"fnamemodify", 2, 2, FEARG_1, arg2_string, *************** *** 2088,2096 **** {"localtime", 0, 0, 0, NULL, ret_number, f_localtime}, {"log", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, FLOAT_FUNC(f_log)}, {"log10", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, FLOAT_FUNC(f_log10)}, {"luaeval", 1, 2, FEARG_1, arg2_string_any, ret_any, #ifdef FEAT_LUA --- 2083,2091 ---- {"localtime", 0, 0, 0, NULL, ret_number, f_localtime}, {"log", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, f_log}, {"log10", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, f_log10}, {"luaeval", 1, 2, FEARG_1, arg2_string_any, ret_any, #ifdef FEAT_LUA *************** *** 2216,2222 **** {"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)}, {"prevnonblank", 1, 1, FEARG_1, arg1_lnum, ret_number, f_prevnonblank}, {"printf", 1, 19, FEARG_2, arg119_printf, --- 2211,2217 ---- {"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, f_pow}, {"prevnonblank", 1, 1, FEARG_1, arg1_lnum, ret_number, f_prevnonblank}, {"printf", 1, 19, FEARG_2, arg119_printf, *************** *** 2300,2306 **** {"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)}, {"reltimestr", 1, 1, FEARG_1, arg1_list_number, ret_string, f_reltimestr}, {"remote_expr", 2, 4, FEARG_1, arg24_remote_expr, --- 2295,2301 ---- {"reltime", 0, 2, FEARG_1, arg2_list_number, ret_list_any, f_reltime}, {"reltimefloat", 1, 1, FEARG_1, arg1_list_number, ! 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,2332 **** {"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)}, {"rubyeval", 1, 1, FEARG_1, arg1_string, ret_any, #ifdef FEAT_RUBY --- 2321,2327 ---- {"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, f_round}, {"rubyeval", 1, 1, FEARG_1, arg1_string, ret_any, #ifdef FEAT_RUBY *************** *** 2438,2446 **** {"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)}, {"sinh", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, FLOAT_FUNC(f_sinh)}, {"slice", 2, 3, FEARG_1, arg23_slice, ret_slice, f_slice}, {"sort", 1, 3, FEARG_1, arg13_sortuniq, --- 2433,2441 ---- {"simplify", 1, 1, FEARG_1, arg1_string, ret_string, f_simplify}, {"sin", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, f_sin}, {"sinh", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, f_sinh}, {"slice", 2, 3, FEARG_1, arg23_slice, ret_slice, f_slice}, {"sort", 1, 3, FEARG_1, arg13_sortuniq, *************** *** 2462,2474 **** {"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)}, {"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)}, {"str2list", 1, 2, FEARG_1, arg2_string_bool, ret_list_number, f_str2list}, {"str2nr", 1, 3, FEARG_1, arg3_string_number_bool, --- 2457,2469 ---- {"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, 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, 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,2554 **** {"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)}, {"tanh", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, FLOAT_FUNC(f_tanh)}, {"tempname", 0, 0, 0, NULL, ret_string, f_tempname}, {"term_dumpdiff", 2, 3, FEARG_1, arg3_string_string_dict, --- 2541,2549 ---- {"taglist", 1, 2, FEARG_1, arg2_string, ret_list_dict_any, f_taglist}, {"tan", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, f_tan}, {"tanh", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, f_tanh}, {"tempname", 0, 0, 0, NULL, ret_string, f_tempname}, {"term_dumpdiff", 2, 3, FEARG_1, arg3_string_string_dict, *************** *** 2680,2686 **** {"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)}, {"type", 1, 1, FEARG_1, NULL, ret_number, f_type}, {"typename", 1, 1, FEARG_1, NULL, --- 2675,2681 ---- {"trim", 1, 3, FEARG_1, arg3_string_string_number, ret_string, f_trim}, {"trunc", 1, 1, FEARG_1, arg1_float_or_nr, ! ret_float, f_trunc}, {"type", 1, 1, FEARG_1, NULL, ret_number, f_type}, {"typename", 1, 1, FEARG_1, NULL, *************** *** 3670,3679 **** 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; --- 3665,3672 ---- *************** *** 5644,5656 **** 0 #endif }, ! {"float", ! #ifdef FEAT_FLOAT ! 1 ! #else ! 0 ! #endif ! }, {"folding", #ifdef FEAT_FOLDING 1 --- 5637,5643 ---- 0 #endif }, ! {"float", 1}, {"folding", #ifdef FEAT_FOLDING 1 *** ../vim-9.0.0490/src/ex_cmds.c 2022-09-14 22:30:56.111676046 +0100 --- src/ex_cmds.c 2022-09-17 20:07:29.779710945 +0100 *************** *** 14,22 **** #include "vim.h" #include "version.h" ! #ifdef FEAT_FLOAT ! # include ! #endif 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); --- 14,20 ---- #include "vim.h" #include "version.h" ! #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,283 **** 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 --- 273,279 ---- *************** *** 296,304 **** 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; --- 292,298 ---- *************** *** 334,344 **** 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 --- 328,336 ---- *************** *** 399,407 **** 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) { --- 391,397 ---- *************** *** 418,430 **** 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; --- 408,418 ---- *************** *** 521,531 **** if (regmatch.regprog != NULL) end_col = 0; ! if (sort_nr ! #ifdef FEAT_FLOAT ! || sort_flt ! #endif ! ) { // Make sure vim_str2nr doesn't read any digits past the end // of the match, by temporarily terminating the string there --- 509,515 ---- if (regmatch.regprog != NULL) end_col = 0; ! 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,564 **** NULL, 0, FALSE); } } - #ifdef FEAT_FLOAT else { s = skipwhite(p); --- 542,547 ---- *************** *** 572,578 **** nrs[lnum - eap->line1].st_u.value_flt = strtod((char *)s, NULL); } - #endif *s2 = c; } else --- 555,560 ---- *** ../vim-9.0.0490/src/float.c 2022-09-03 10:52:18.395075356 +0100 --- src/float.c 2022-09-17 20:07:48.527671924 +0100 *************** *** 14,20 **** #include "vim.h" ! #if (defined(FEAT_EVAL) && defined(FEAT_FLOAT)) || defined(PROTO) #ifdef VMS # include --- 14,20 ---- #include "vim.h" ! #if defined(FEAT_EVAL) || defined(PROTO) #ifdef VMS # include *** ../vim-9.0.0490/src/gui_gtk_x11.c 2022-09-13 11:25:50.506322391 +0100 --- src/gui_gtk_x11.c 2022-09-17 20:07:59.815648424 +0100 *************** *** 3598,3604 **** { gnome_program_init(VIMPACKAGE, VIM_VERSION_SHORT, LIBGNOMEUI_MODULE, gui_argc, gui_argv, NULL); ! # if defined(FEAT_FLOAT) && defined(LC_NUMERIC) { char *p = setlocale(LC_NUMERIC, NULL); --- 3598,3604 ---- { gnome_program_init(VIMPACKAGE, VIM_VERSION_SHORT, LIBGNOMEUI_MODULE, gui_argc, gui_argv, NULL); ! # if defined(LC_NUMERIC) { char *p = setlocale(LC_NUMERIC, NULL); *** ../vim-9.0.0490/src/gui_x11.c 2022-08-31 12:01:49.849434433 +0100 --- src/gui_x11.c 2022-09-17 20:08:07.467632475 +0100 *************** *** 1184,1190 **** cmdline_options, XtNumber(cmdline_options), CARDINAL &gui_argc, gui_argv); ! # if defined(FEAT_FLOAT) && 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 --- 1184,1190 ---- cmdline_options, XtNumber(cmdline_options), CARDINAL &gui_argc, gui_argv); ! # 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 *** ../vim-9.0.0490/src/if_lua.c 2022-08-14 14:16:07.991582244 +0100 --- src/if_lua.c 2022-09-17 20:08:22.279601605 +0100 *************** *** 559,569 **** 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; --- 559,567 ---- *************** *** 619,625 **** 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); --- 617,622 ---- *************** *** 635,644 **** 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: { --- 632,637 ---- *** ../vim-9.0.0490/src/if_mzsch.c 2022-08-14 14:16:07.991582244 +0100 --- src/if_mzsch.c 2022-09-17 20:08:31.003583399 +0100 *************** *** 3009,3021 **** 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; --- 3009,3019 ---- *************** *** 3208,3220 **** 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; --- 3206,3216 ---- *** ../vim-9.0.0490/src/if_ruby.c 2022-08-14 14:16:07.991582244 +0100 --- src/if_ruby.c 2022-09-17 20:08:39.283566123 +0100 *************** *** 1221,1232 **** { 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; --- 1221,1230 ---- *************** *** 1932,1943 **** 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 --- 1930,1939 ---- *** ../vim-9.0.0490/src/json.c 2022-04-05 15:02:26.000000000 +0100 --- src/json.c 2022-09-17 20:09:47.919422751 +0100 *************** *** 409,416 **** break; case VAR_FLOAT: ! #ifdef FEAT_FLOAT ! # if defined(HAVE_MATH_H) if (isnan(val->vval.v_float)) ga_concat(gap, (char_u *)"NaN"); else if (isinf(val->vval.v_float)) --- 409,415 ---- break; case VAR_FLOAT: ! #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,434 **** ga_concat(gap, (char_u *)"Infinity"); } else ! # 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: --- 420,432 ---- ga_concat(gap, (char_u *)"Infinity"); } else ! #endif { vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", val->vval.v_float); ga_concat(gap, numbuf); } break; case VAR_UNKNOWN: case VAR_ANY: case VAR_VOID: *************** *** 861,867 **** } } sp = skipdigits(sp); - #ifdef FEAT_FLOAT if (*sp == '.' || *sp == 'e' || *sp == 'E') { if (cur_item == NULL) --- 859,864 ---- *************** *** 878,884 **** } } else - #endif { varnumber_T nr; --- 875,880 ---- *************** *** 934,940 **** retval = OK; break; } - #ifdef FEAT_FLOAT if (STRNICMP((char *)p, "NaN", 3) == 0) { reader->js_used += 3; --- 930,935 ---- *************** *** 968,986 **** 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 < 3 && STRNICMP((char *)p, "NaN", len) == 0) ! #endif ! || (len < 4 && (STRNICMP((char *)p, "true", len) == 0 ! || STRNICMP((char *)p, "null", len) == 0))) retval = MAYBE; else --- 963,981 ---- retval = OK; break; } // check for truncated name len = (int)(reader->js_end - (reader->js_buf + reader->js_used)); if ( (len < 5 && STRNICMP((char *)p, "false", 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) ! || (len < 4 ! && (STRNICMP((char *)p, "true", len) == 0 ! || STRNICMP((char *)p, "null", len) == 0))) retval = MAYBE; else *************** *** 998,1004 **** 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 --- 993,998 ---- *************** *** 1006,1012 **** retval = FAIL; goto theend; } - #endif top_item->jd_key = tv_get_string_buf_chk(cur_item, key_buf); if (top_item->jd_key == NULL) { --- 1000,1005 ---- *** ../vim-9.0.0490/src/list.c 2022-09-01 12:22:19.747659165 +0100 --- src/list.c 2022-09-17 20:10:03.451390266 +0100 *************** *** 1876,1884 **** 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; --- 1876,1882 ---- *************** *** 1915,1921 **** return v1 == v2 ? 0 : v1 > v2 ? 1 : -1; } - #ifdef FEAT_FLOAT if (sortinfo->item_compare_float) { float_T v1 = tv_get_float(tv1); --- 1913,1918 ---- *************** *** 1923,1929 **** 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 --- 1920,1925 ---- *************** *** 2160,2168 **** 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; --- 2156,2162 ---- *************** *** 2215,2227 **** 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; --- 2209,2219 ---- *** ../vim-9.0.0490/src/locale.c 2021-12-31 17:58:13.000000000 +0000 --- src/locale.c 2022-09-17 20:10:15.963364084 +0100 *************** *** 225,231 **** // Tell Gtk not to change our locale settings. gtk_disable_setlocale(); # endif ! # if defined(FEAT_FLOAT) && defined(LC_NUMERIC) // Make sure strtod() uses a decimal point, not a comma. setlocale(LC_NUMERIC, "C"); # endif --- 225,231 ---- // Tell Gtk not to change our locale settings. gtk_disable_setlocale(); # endif ! # if defined(LC_NUMERIC) // Make sure strtod() uses a decimal point, not a comma. setlocale(LC_NUMERIC, "C"); # endif *************** *** 333,339 **** # endif { loc = setlocale(what, (char *)name); ! # if defined(FEAT_FLOAT) && defined(LC_NUMERIC) // Make sure strtod() uses a decimal point, not a comma. setlocale(LC_NUMERIC, "C"); # endif --- 333,339 ---- # endif { loc = setlocale(what, (char *)name); ! # if defined(LC_NUMERIC) // Make sure strtod() uses a decimal point, not a comma. setlocale(LC_NUMERIC, "C"); # endif *** ../vim-9.0.0490/src/message_test.c 2022-04-15 13:32:58.000000000 +0100 --- src/message_test.c 2022-09-17 20:10:21.955351538 +0100 *************** *** 211,217 **** 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); --- 211,216 ---- *************** *** 241,247 **** 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); --- 240,245 ---- *** ../vim-9.0.0490/src/os_mac_conv.c 2021-12-27 17:12:21.000000000 +0000 --- src/os_mac_conv.c 2022-09-17 20:10:32.327329842 +0100 *************** *** 585,591 **** # ifdef HAVE_LOCALE_H setlocale(LC_ALL, ""); # endif ! # if defined(FEAT_FLOAT) && defined(LC_NUMERIC) // Make sure strtod() uses a decimal point, not a comma. setlocale(LC_NUMERIC, "C"); # endif --- 585,591 ---- # ifdef HAVE_LOCALE_H setlocale(LC_ALL, ""); # endif ! # if defined(LC_NUMERIC) // Make sure strtod() uses a decimal point, not a comma. setlocale(LC_NUMERIC, "C"); # endif *** ../vim-9.0.0490/src/profiler.c 2022-09-06 18:57:04.927749453 +0100 --- src/profiler.c 2022-09-17 20:10:55.339281613 +0100 *************** *** 90,112 **** 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 LARGE_INTEGER fr; QueryPerformanceFrequency(&fr); return (float_T)tm->QuadPart / (float_T)fr.QuadPart; ! # else return (float_T)tm->tv_sec + (float_T)tm->tv_usec / 1000000.0; - # endif - } # endif /* * Put the time "msec" past now in "tm". --- 90,110 ---- return buf; } /* * Return a float that represents the time in "tm". */ float_T profile_float(proftime_T *tm) { ! # ifdef MSWIN LARGE_INTEGER fr; QueryPerformanceFrequency(&fr); return (float_T)tm->QuadPart / (float_T)fr.QuadPart; ! # else return (float_T)tm->tv_sec + (float_T)tm->tv_usec / 1000000.0; # endif + } /* * Put the time "msec" past now in "tm". *************** *** 173,179 **** # endif // FEAT_PROFILE || FEAT_RELTIME ! #if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_FLOAT) && defined(FEAT_PROFILE) # if defined(HAVE_MATH_H) # include # endif --- 171,177 ---- # endif // FEAT_PROFILE || FEAT_RELTIME ! #if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_PROFILE) # if defined(HAVE_MATH_H) # include # endif *** ../vim-9.0.0490/src/session.c 2022-08-25 15:11:11.404084538 +0100 --- src/session.c 2022-09-17 20:11:02.155267332 +0100 *************** *** 577,583 **** } 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) { --- 577,582 ---- *************** *** 594,600 **** || put_eol(fd) == FAIL) return FAIL; } - #endif } } return OK; --- 593,598 ---- *** ../vim-9.0.0490/src/strings.c 2022-09-02 15:15:11.063569185 +0100 --- src/strings.c 2022-09-17 20:11:41.647184527 +0100 *************** *** 1895,1901 **** return s; } - # ifdef FEAT_FLOAT /* * Get float argument from "idxp" entry in "tvs". First entry is 1. */ --- 1895,1900 ---- *************** *** 1919,1929 **** } return f; } - # endif #endif - #ifdef FEAT_FLOAT /* * Return the representation of infinity for printf() function: * "-inf", "inf", "+inf", " inf", "-INF", "INF", "+INF" or " INF". --- 1918,1926 ---- *************** *** 1945,1951 **** idx += 4; return table[idx]; } - #endif /* * This code was included to provide a portable vsnprintf() and snprintf(). --- 1942,1947 ---- *************** *** 2079,2091 **** 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. // 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 --- 2075,2083 ---- char length_modifier = '\0'; // temporary buffer for simple numeric->string conversion ! # define TMP_LEN 350 // On my system 1e308 is the biggest number possible. // That sounds reasonable to use as the maximum // printable. char tmp[TMP_LEN]; // string address in case of string argument *************** *** 2637,2643 **** break; } - # ifdef FEAT_FLOAT case 'f': case 'F': case 'e': --- 2629,2634 ---- *************** *** 2653,2661 **** int remove_trailing_zeroes = FALSE; f = ! # if defined(FEAT_EVAL) tvs != NULL ? tv_float(tvs, &arg_idx) : ! # endif va_arg(ap, double); abs_f = f < 0 ? -f : f; --- 2644,2652 ---- int remove_trailing_zeroes = FALSE; f = ! # if defined(FEAT_EVAL) tvs != NULL ? tv_float(tvs, &arg_idx) : ! # endif va_arg(ap, double); abs_f = f < 0 ? -f : f; *************** *** 2672,2682 **** } if ((fmt_spec == 'f' || fmt_spec == 'F') && ! # ifdef VAX abs_f > 1.0e38 ! # else abs_f > 1.0e307 ! # endif ) { // Avoid a buffer overflow --- 2663,2673 ---- } if ((fmt_spec == 'f' || fmt_spec == 'F') && ! # ifdef VAX abs_f > 1.0e38 ! # else abs_f > 1.0e307 ! # endif ) { // Avoid a buffer overflow *************** *** 2801,2807 **** str_arg = tmp; break; } - # endif default: // unrecognized conversion specifier, keep format string --- 2792,2797 ---- *** ../vim-9.0.0490/src/syntax.c 2022-08-26 22:36:32.480565634 +0100 --- src/syntax.c 2022-09-17 20:11:59.067147974 +0100 *************** *** 6694,6700 **** { int idx; synpat_T *spp; ! # if defined(FEAT_RELTIME) && defined(FEAT_FLOAT) proftime_T tm; # endif int len; --- 6694,6700 ---- { int idx; synpat_T *spp; ! # if defined(FEAT_RELTIME) proftime_T tm; # endif int len; *************** *** 6724,6730 **** 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) profile_divide(&spp->sp_time.total, spp->sp_time.count, &tm); p->average = tm; # endif --- 6724,6730 ---- p->match = spp->sp_time.match; total_count += spp->sp_time.count; p->slowest = spp->sp_time.slowest; ! # if defined(FEAT_RELTIME) profile_divide(&spp->sp_time.total, spp->sp_time.count, &tm); p->average = tm; # endif *************** *** 6758,6767 **** 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(" "); --- 6758,6765 ---- *** ../vim-9.0.0490/src/testing.c 2022-09-07 15:20:22.198038854 +0100 --- src/testing.c 2022-09-17 20:12:05.891133648 +0100 *************** *** 787,793 **** 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) --- 787,792 ---- *************** *** 816,822 **** } } else - #endif { varnumber_T lower = tv_get_number_chk(&argvars[0], &error); varnumber_T upper = tv_get_number_chk(&argvars[1], &error); --- 815,820 ---- *** ../vim-9.0.0490/src/time.c 2022-09-02 15:15:11.063569185 +0100 --- src/time.c 2022-09-17 20:12:16.939110460 +0100 *************** *** 221,240 **** # endif } - # ifdef FEAT_FLOAT /* * "reltimefloat()" function */ void f_reltimefloat(typval_T *argvars UNUSED, typval_T *rettv) { ! # ifdef FEAT_RELTIME proftime_T tm; ! # endif rettv->v_type = VAR_FLOAT; rettv->vval.v_float = 0; ! # ifdef FEAT_RELTIME if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL) return; --- 221,239 ---- # endif } /* * "reltimefloat()" function */ void f_reltimefloat(typval_T *argvars UNUSED, typval_T *rettv) { ! # ifdef FEAT_RELTIME proftime_T tm; ! # endif rettv->v_type = VAR_FLOAT; rettv->vval.v_float = 0; ! # ifdef FEAT_RELTIME if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL) return; *************** *** 242,250 **** rettv->vval.v_float = profile_float(&tm); else if (in_vim9script()) emsg(_(e_invalid_argument)); - # endif - } # endif /* * "reltimestr()" function --- 241,248 ---- rettv->vval.v_float = profile_float(&tm); else if (in_vim9script()) emsg(_(e_invalid_argument)); # endif + } /* * "reltimestr()" function *** ../vim-9.0.0490/src/typval.c 2022-09-12 14:09:26.550006991 +0100 --- src/typval.c 2022-09-17 20:12:57.727024781 +0100 *************** *** 136,145 **** 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); --- 136,143 ---- *************** *** 190,199 **** } 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)); --- 188,195 ---- *************** *** 296,302 **** 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) { --- 292,297 ---- *************** *** 357,363 **** { return tv_get_float_chk(varp, NULL); } - #endif /* * Give an error and return FAIL unless "args[idx]" is unknown --- 352,357 ---- *************** *** 1007,1013 **** emsg(_(e_using_dictionary_as_string)); break; case VAR_FLOAT: - #ifdef FEAT_FLOAT if (strict) { emsg(_(e_using_float_as_string)); --- 1001,1006 ---- *************** *** 1015,1021 **** } 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; --- 1008,1013 ---- *************** *** 1136,1145 **** 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; --- 1128,1135 ---- *************** *** 1289,1295 **** 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) --- 1279,1284 ---- *************** *** 1322,1328 **** 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. --- 1311,1316 ---- *************** *** 1489,1499 **** 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; } } --- 1477,1485 ---- *************** *** 1870,1878 **** 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; --- 1856,1862 ---- *************** *** 2005,2011 **** { int len; int skip_quotes = !in_old_script(4); - #ifdef FEAT_FLOAT char_u *p; int get_float = FALSE; --- 1989,1994 ---- *************** *** 2062,2068 **** } } else - #endif if (**arg == '0' && ((*arg)[1] == 'z' || (*arg)[1] == 'Z')) { char_u *bp; --- 2045,2050 ---- *** ../vim-9.0.0490/src/version.c 2022-09-17 19:43:19.258427029 +0100 --- src/version.c 2022-09-17 20:57:58.765256883 +0100 *************** *** 244,254 **** #else "-find_in_path", #endif - #ifdef FEAT_FLOAT "+float", - #else - "-float", - #endif #ifdef FEAT_FOLDING "+folding", #else --- 244,250 ---- *** ../vim-9.0.0490/src/vim9compile.c 2022-09-16 19:04:19.957886512 +0100 --- src/vim9compile.c 2022-09-17 20:13:33.282950030 +0100 *************** *** 2384,2392 **** 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); --- 2384,2390 ---- *************** *** 2455,2465 **** 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; --- 2453,2461 ---- *** ../vim-9.0.0490/src/vim9execute.c 2022-09-17 16:27:36.142603905 +0100 --- src/vim9execute.c 2022-09-17 20:14:15.554861065 +0100 *************** *** 3872,3883 **** 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; --- 3872,3881 ---- *************** *** 4569,4575 **** // 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); --- 4567,4572 ---- *************** *** 4602,4608 **** else tv1->vval.v_float = res; } - #endif break; case ISN_COMPARELIST: --- 4599,4604 ---- *************** *** 4744,4752 **** 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) --- 4740,4746 ---- *************** *** 4767,4808 **** 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) { --- 4761,4793 ---- *************** *** 4823,4829 **** --ectx->ec_stack.ga_len; } else - #endif { int failed = FALSE; --- 4808,4813 ---- *************** *** 5110,5120 **** 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; --- 5094,5102 ---- *************** *** 6279,6287 **** 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); --- 6261,6267 ---- *************** *** 6896,6906 **** 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: --- 6876,6882 ---- *** ../vim-9.0.0490/src/vim9expr.c 2022-09-16 19:04:19.957886512 +0100 --- src/vim9expr.c 2022-09-17 20:14:22.754845908 +0100 *************** *** 1488,1501 **** 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; --- 1488,1499 ---- *** ../vim-9.0.0490/src/vim9instr.c 2022-09-16 19:04:19.957886512 +0100 --- src/vim9instr.c 2022-09-17 20:14:51.498784629 +0100 *************** *** 208,216 **** 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 --- 208,214 ---- *************** *** 251,259 **** 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; --- 249,255 ---- *************** *** 293,302 **** 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) --- 289,296 ---- *************** *** 326,337 **** { 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)) type = &t_float; - #endif set_type_on_stack(cctx, type, 0); } --- 320,329 ---- { type_T *type = &t_any; // 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)) type = &t_float; set_type_on_stack(cctx, type, 0); } *************** *** 580,590 **** 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; --- 572,580 ---- *************** *** 688,694 **** return OK; } - #if defined(FEAT_FLOAT) || defined(PROTO) /* * Generate an ISN_PUSHF instruction. */ --- 678,683 ---- *************** *** 704,710 **** return OK; } - #endif /* * Generate an ISN_PUSHS instruction. --- 693,698 ---- *** ../vim-9.0.0490/src/vim9type.c 2022-09-16 12:28:29.342066929 +0100 --- src/vim9type.c 2022-09-17 20:15:02.430760965 +0100 *************** *** 985,998 **** 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) { --- 985,992 ---- *** ../vim-9.0.0490/src/viminfo.c 2022-09-04 12:47:15.414692249 +0100 --- src/viminfo.c 2022-09-17 20:15:09.130746470 +0100 *************** *** 1225,1233 **** 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; --- 1225,1231 ---- *************** *** 1242,1251 **** || 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); --- 1240,1247 ---- *** ../vim-9.0.0490/src/errors.h 2022-09-17 18:57:32.500190048 +0100 --- src/errors.h 2022-09-17 20:16:41.242547428 +0100 *************** *** 895,901 **** INIT(= N_("E360: Cannot execute shell with -f option")); #endif // E361 unused ! #if defined(FEAT_EVAL) && defined(FEAT_FLOAT) EXTERN char e_using_boolean_value_as_float[] INIT(= N_("E362: Using a boolean value as a Float")); #endif --- 895,901 ---- INIT(= N_("E360: Cannot execute shell with -f option")); #endif // E361 unused ! #if defined(FEAT_EVAL) EXTERN char e_using_boolean_value_as_float[] INIT(= N_("E362: Using a boolean value as a Float")); #endif *************** *** 2044,2060 **** // 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) EXTERN char e_number_or_float_required[] INIT(= N_("E808: Number or Float required")); #endif --- 2044,2056 ---- // xgettext:no-c-format INIT(= N_("E804: Cannot use '%' with Float")); #endif 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")); EXTERN char e_expected_float_argument_for_printf[] INIT(= N_("E807: Expected Float argument for printf()")); ! #if defined(FEAT_EVAL) EXTERN char e_number_or_float_required[] INIT(= N_("E808: Number or Float required")); #endif *************** *** 2290,2296 **** 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[] --- 2286,2291 ---- *************** *** 2299,2305 **** 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.")); --- 2294,2299 ---- *************** *** 2340,2349 **** 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")); --- 2334,2341 ---- *************** *** 2537,2546 **** 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[] --- 2529,2536 ---- *************** *** 2775,2784 **** 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 EXTERN char e_missing_argument_type_for_str[] INIT(= N_("E1077: Missing argument type for %s")); #endif --- 2765,2771 ---- INIT(= N_("E1074: No white space allowed after dot")); EXTERN char e_namespace_not_supported_str[] INIT(= N_("E1075: Namespace not supported: %s")); ! // E1076 was deleted EXTERN char e_missing_argument_type_for_str[] INIT(= N_("E1077: Missing argument type for %s")); #endif *** ../vim-9.0.0490/src/if_py_both.h 2022-08-14 14:16:07.991582244 +0100 --- src/if_py_both.h 2022-09-17 20:17:02.926500664 +0100 *************** *** 761,767 **** 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]; --- 761,766 ---- *************** *** 769,775 **** 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; --- 768,773 ---- *************** *** 6329,6341 **** } 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 --- 6327,6337 ---- *************** *** 6388,6396 **** 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: --- 6384,6390 ---- *** ../vim-9.0.0490/src/macros.h 2022-05-09 19:16:33.000000000 +0100 --- src/macros.h 2022-09-17 20:17:08.718488162 +0100 *************** *** 261,267 **** # define MESSAGE_QUEUE #endif ! #if defined(FEAT_EVAL) && defined(FEAT_FLOAT) # include # if defined(HAVE_MATH_H) // for isnan() and isinf() --- 261,267 ---- # define MESSAGE_QUEUE #endif ! #if defined(FEAT_EVAL) # include # if defined(HAVE_MATH_H) // for isnan() and isinf() *** ../vim-9.0.0490/src/structs.h 2022-09-17 15:44:48.365409503 +0100 --- src/structs.h 2022-09-17 20:17:14.830474984 +0100 *************** *** 1460,1468 **** 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!) --- 1460,1466 ---- *** ../vim-9.0.0490/src/vim9.h 2022-09-17 12:39:54.996464478 +0100 --- src/vim9.h 2022-09-17 20:17:19.714464456 +0100 *************** *** 469,477 **** 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; --- 469,475 ---- *** ../vim-9.0.0490/src/testdir/runtest.vim 2022-09-09 15:09:42.096814667 +0100 --- src/testdir/runtest.vim 2022-09-17 20:43:26.391114962 +0100 *************** *** 283,293 **** if has('reltime') let message ..= repeat(' ', 50 - len(message)) let time = reltime(func_start) ! if has('float') && reltimefloat(time) > 0.1 let message = s:t_bold .. message endif let message ..= ' in ' .. reltimestr(time) .. ' seconds' ! if has('float') && reltimefloat(time) > 0.1 let message ..= s:t_normal endif endif --- 283,293 ---- if has('reltime') let message ..= repeat(' ', 50 - len(message)) let time = reltime(func_start) ! if reltimefloat(time) > 0.1 let message = s:t_bold .. message endif let message ..= ' in ' .. reltimestr(time) .. ' seconds' ! if reltimefloat(time) > 0.1 let message ..= s:t_normal endif endif *** ../vim-9.0.0490/src/testdir/test_assert.vim 2022-09-07 15:20:22.198038854 +0100 --- src/testdir/test_assert.vim 2022-09-17 20:43:50.683063182 +0100 *************** *** 352,372 **** 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(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 endfunc func Test_assert_with_msg() --- 352,370 ---- call assert_fails('call assert_inrange(1, 1)', 'E119:') ! 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) endfunc func Test_assert_with_msg() *** ../vim-9.0.0490/src/testdir/test_blob.vim 2022-09-09 18:46:41.558660414 +0100 --- src/testdir/test_blob.vim 2022-09-17 20:44:05.231032182 +0100 *************** *** 669,677 **** endfunc func Test_blob_sort() ! if has('float') ! call v9.CheckLegacyAndVim9Failure(['call sort([1.0, 0z11], "f")'], 'E975:') ! endif call v9.CheckLegacyAndVim9Failure(['call sort([11, 0z11], "N")'], 'E974:') endfunc --- 669,675 ---- endfunc func Test_blob_sort() ! call v9.CheckLegacyAndVim9Failure(['call sort([1.0, 0z11], "f")'], 'E975:') call v9.CheckLegacyAndVim9Failure(['call sort([11, 0z11], "N")'], 'E974:') endfunc *** ../vim-9.0.0490/src/testdir/test_cscope.vim 2022-09-08 16:39:16.912140162 +0100 --- src/testdir/test_cscope.vim 2022-09-17 20:44:28.118983418 +0100 *************** *** 122,146 **** 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 endif " Test: leading whitespace is not removed for cscope find text --- 122,144 ---- call assert_fails('cs find', 'E560:') call assert_fails('cs find x', 'E560:') ! " 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 *** ../vim-9.0.0490/src/testdir/test_eval_stuff.vim 2022-09-09 13:27:40.403539790 +0100 --- src/testdir/test_eval_stuff.vim 2022-09-17 20:45:05.670903422 +0100 *************** *** 240,250 **** let a..=b call assert_equal('ab', a) ! if has('float') ! let a = 'A' ! let b = 1.234 ! call assert_equal('A1.234', a .. b) ! endif endfunc " Test fix for issue #4507 --- 240,248 ---- let a..=b call assert_equal('ab', a) ! let a = 'A' ! let b = 1.234 ! call assert_equal('A1.234', a .. b) endfunc " Test fix for issue #4507 *************** *** 266,275 **** call assert_fails('let a .= b', 'E985:') call assert_fails('let vers = 1.2.3', 'E488:') ! if has('float') ! let f = .5 ! call assert_equal(0.5, f) ! endif endfunc scriptversion 1 --- 264,271 ---- call assert_fails('let a .= b', 'E985:') call assert_fails('let vers = 1.2.3', 'E488:') ! let f = .5 ! call assert_equal(0.5, f) endfunc scriptversion 1 *************** *** 283,291 **** let vers = 1.2.3 call assert_equal('123', vers) ! if has('float') ! call assert_fails('let f = .5', 'E15:') ! endif endfunc scriptversion 3 --- 279,285 ---- let vers = 1.2.3 call assert_equal('123', vers) ! call assert_fails('let f = .5', 'E15:') endfunc scriptversion 3 *** ../vim-9.0.0490/src/testdir/test_execute_func.vim 2022-01-29 20:28:08.000000000 +0000 --- src/testdir/test_execute_func.vim 2022-09-17 20:45:13.222887330 +0100 *************** *** 38,48 **** 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 endfunc func Test_execute_list() --- 38,46 ---- call assert_equal("\nsomething", execute('echo "something"', 'silent')) call assert_equal("\nsomething", execute('echo "something"', 'silent!')) call assert_equal("", execute('burp', 'silent!')) ! 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() *** ../vim-9.0.0490/src/testdir/test_expr.vim 2022-08-30 19:48:17.206760205 +0100 --- src/testdir/test_expr.vim 2022-09-17 20:34:57.372200179 +0100 *************** *** 77,85 **** 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(456, v:false ?? 456) call assert_equal(456, 0 ?? 456) --- 77,83 ---- call assert_equal(0z00, 0z00 ?? 456) call assert_equal([1], [1] ?? 456) call assert_equal({'one': 1}, {'one': 1} ?? 456) ! call assert_equal(0.1, 0.1 ?? 456) call assert_equal(456, v:false ?? 456) call assert_equal(456, 0 ?? 456) *************** *** 87,95 **** 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 END call v9.CheckLegacyAndVim9Success(lines) endfunc --- 85,91 ---- call assert_equal(456, 0z ?? 456) call assert_equal(456, [] ?? 456) call assert_equal(456, {} ?? 456) ! call assert_equal(456, 0.0 ?? 456) END call v9.CheckLegacyAndVim9Success(lines) endfunc *************** *** 200,209 **** 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 = '' call assert_false(s:value == v:null) let s:value = 0z --- 196,203 ---- call assert_false(s:value == v:null) let s:value = 0 call assert_true(s:value == v:null) ! 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,582 **** 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)) ! ! #" 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 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)) ! ! #" 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 endfunc func Test_printf_errors() --- 461,574 ---- endfunc func Test_printf_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)) ! ! #" 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 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)) ! ! #" 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:') endfunc func Test_printf_errors() *************** *** 585,594 **** 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 endfunc func Test_printf_64bit() --- 577,584 ---- call v9.CheckLegacyAndVim9Failure(['echo printf("%d", 1, 2)'], 'E767:') call v9.CheckLegacyAndVim9Failure(['echo printf("%*d", 1)'], 'E766:') call v9.CheckLegacyAndVim9Failure(['echo printf("%s")'], 'E766:') ! call v9.CheckLegacyAndVim9Failure(['echo printf("%d", 1.2)'], 'E805:') ! call v9.CheckLegacyAndVim9Failure(['echo printf("%f")'], 'E766:') endfunc func Test_printf_64bit() *************** *** 607,615 **** call assert_equal("abcdefgi", printf('%s', "abcdefgi")) #" float ! if has('float') ! call assert_equal("1.23", printf('%s', 1.23)) ! endif #" list VAR lvalue = [1, 'two', ['three', 4]] --- 597,603 ---- call assert_equal("abcdefgi", printf('%s', "abcdefgi")) #" float ! call assert_equal("1.23", printf('%s', 1.23)) #" list VAR lvalue = [1, 'two', ['three', 4]] *************** *** 878,885 **** " 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) --- 866,871 ---- *** ../vim-9.0.0490/src/testdir/test_float_func.vim 2022-01-29 20:30:44.000000000 +0000 --- src/testdir/test_float_func.vim 2022-09-17 20:35:20.404151047 +0100 *************** *** 1,7 **** " test float functions source check.vim - CheckFeature float import './vim9.vim' as v9 func Test_abs() --- 1,6 ---- *** ../vim-9.0.0490/src/testdir/test_functions.vim 2022-09-12 13:35:06.514946763 +0100 --- src/testdir/test_functions.vim 2022-09-17 20:46:19.478746154 +0100 *************** *** 54,67 **** 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([])) call assert_equal(0, empty(['a'])) --- 54,65 ---- call assert_equal(0, empty(1)) call assert_equal(0, empty(-1)) ! 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,98 **** 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('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:') --- 88,94 ---- func Test_test_void() call assert_fails('echo 1 == test_void()', 'E1031:') ! 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,184 **** 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 set ambiwidth& endfunc --- 171,178 ---- call assert_fails('call strwidth({})', 'E731:') endfor ! 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,251 **** 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_fails('call str2nr(10, [])', 'E745:') endfunc --- 236,243 ---- call assert_fails('call str2nr([])', 'E730:') call assert_fails('call str2nr({->2})', 'E729:') ! 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,513 **** 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 endfunc func Test_pathshorten() --- 496,503 ---- call assert_fails('call simplify({->0})', 'E729:') call assert_fails('call simplify([])', 'E730:') call assert_fails('call simplify({})', 'E731:') ! 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() *** ../vim-9.0.0490/src/testdir/test_glob2regpat.vim 2022-01-29 20:32:11.000000000 +0000 --- src/testdir/test_glob2regpat.vim 2022-09-17 20:46:26.322731574 +0100 *************** *** 3,12 **** 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_fails('call glob2regpat("}")', 'E219:') call assert_fails('call glob2regpat("{")', 'E220:') endfunc --- 3,10 ---- import './vim9.vim' as v9 func Test_glob2regpat_invalid() ! 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 *** ../vim-9.0.0490/src/testdir/test_json.vim 2022-04-05 14:55:22.000000000 +0100 --- src/testdir/test_json.vim 2022-09-17 20:47:23.094610613 +0100 *************** *** 21,36 **** 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:jsonl1 = '[1,"a",3]' let s:varl1 = [1, "a", 3] --- 21,34 ---- let s:varmb = "s¢cĴgё" let s:jsonnr = '1234' let s:varnr = 1234 ! 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,93 **** " 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:jsonl1, json_encode(s:varl1)) call assert_equal(s:jsonl2, json_encode(s:varl2)) --- 80,89 ---- " no test for surrogate pair, json_encode() doesn't create them. call assert_equal(s:jsonnr, json_encode(s:varnr)) ! 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,141 **** 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:varl1, json_decode(s:jsonl1)) call assert_equal(s:varl2x, json_decode(s:jsonl2)) --- 129,135 ---- call assert_equal(s:varsp2, json_decode(s:jsonsp2)) call assert_equal(s:varnr, json_decode(s:jsonnr)) ! 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,197 **** 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("[foobar]")', "E491:") call assert_fails('call json_decode("[")', "E491:") --- 183,189 ---- 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:") ! 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,241 **** " 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:jsonl1, js_encode(s:varl1)) call assert_equal(s:jsonl2, js_encode(s:varl2)) --- 222,231 ---- " no test for surrogate pair, js_encode() doesn't create them. call assert_equal(s:jsonnr, js_encode(s:varnr)) ! 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,281 **** 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:varl1, js_decode(s:jsonl1)) call assert_equal(s:varl2x, js_decode(s:jsonl2)) --- 260,269 ---- call assert_equal(s:varsp2, js_decode(s:jsonsp2)) call assert_equal(s:varnr, js_decode(s:jsonnr)) ! 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)) *** ../vim-9.0.0490/src/testdir/test_listdict.vim 2022-09-07 19:40:13.842414811 +0100 --- src/testdir/test_listdict.vim 2022-09-17 20:47:57.414537509 +0100 *************** *** 966,985 **** 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))) ! ! 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 END call v9.CheckLegacyAndVim9Success(lines) --- 966,983 ---- 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))) ! 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, 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,1181 **** 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 " Test extend() with dictionaries. --- 1171,1177 ---- 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:') ! call assert_fails("call extend(l, [4, 5, 6], 1.2)", 'E805:') " Test extend() with dictionaries. *************** *** 1203,1211 **** 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_equal({'a': 'A', 'b': 'B'}, d) call assert_fails("call extend([1, 2], 1)", 'E712:') --- 1199,1205 ---- 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:') ! 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:') *** ../vim-9.0.0490/src/testdir/test_lua.vim 2022-06-17 19:19:05.000000000 +0100 --- src/testdir/test_lua.vim 2022-09-17 20:35:25.772139597 +0100 *************** *** 10,16 **** 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)}) --- 10,15 ---- *** ../vim-9.0.0490/src/testdir/test_messages.vim 2022-09-11 21:35:47.558255161 +0100 --- src/testdir/test_messages.vim 2022-09-17 20:48:06.766517580 +0100 *************** *** 74,82 **** 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_match("function('\\d*')", execute(':echomsg {-> 1234}')) endfunc --- 74,80 ---- 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}')) ! call assert_equal("\n1.23", execute(':echomsg 1.23')) call assert_match("function('\\d*')", execute(':echomsg {-> 1234}')) endfunc *************** *** 86,94 **** 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 eval ''->test_ignore_error() call assert_match("function('\\d*')", execute(':echoerr {-> 1234}')) call test_ignore_error('RESET') --- 84,90 ---- 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}')) ! 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') *** ../vim-9.0.0490/src/testdir/test_method.vim 2022-09-01 12:22:19.751659183 +0100 --- src/testdir/test_method.vim 2022-09-17 20:35:42.460103993 +0100 *************** *** 121,127 **** endfunc func Test_method_float() - CheckFeature float eval 1.234->string()->assert_equal('1.234') eval -1.234->string()->assert_equal('-1.234') endfunc --- 121,126 ---- *** ../vim-9.0.0490/src/testdir/test_perl.vim 2022-05-10 21:05:30.000000000 +0100 --- src/testdir/test_perl.vim 2022-09-17 20:48:33.314461021 +0100 *************** *** 163,173 **** 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 sandbox call assert_equal(2, perleval('2')) --- 163,169 ---- call assert_equal(0, perleval('0')) call assert_equal(2, perleval('2')) call assert_equal(-2, perleval('-2')) ! call assert_equal(2.5, perleval('2.5')) sandbox call assert_equal(2, perleval('2')) *** ../vim-9.0.0490/src/testdir/test_python2.vim 2022-09-02 21:55:45.507049444 +0100 --- src/testdir/test_python2.vim 2022-09-17 20:36:11.884041233 +0100 *************** *** 686,692 **** endfunc func Test_python_float() - CheckFeature float let l = [0.0] py l = vim.bindeval('l') py l.extend([0.0]) --- 686,691 ---- *************** *** 785,793 **** 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 " Evaluate an invalid values call AssertException(['let v = pyeval(''"\0"'')'], 'E859:') --- 784,790 ---- py v = vim.eval('test_null_function()') call assert_equal(v:none, pyeval('v')) ! call assert_equal(0.0, pyeval('0.0')) " Evaluate an invalid values call AssertException(['let v = pyeval(''"\0"'')'], 'E859:') *** ../vim-9.0.0490/src/testdir/test_python3.vim 2022-09-02 21:55:45.507049444 +0100 --- src/testdir/test_python3.vim 2022-09-17 20:36:42.447976059 +0100 *************** *** 286,301 **** " 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("\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}"))')) --- 286,299 ---- " Test vim.eval() with various types. func Test_python3_vim_val() call assert_equal("\n8", execute('py3 print(vim.eval("3+5"))')) ! 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,885 **** endfunc func Test_python3_float() - CheckFeature float let l = [0.0] py3 l = vim.bindeval('l') py3 l.extend([0.0]) --- 877,882 ---- *************** *** 982,990 **** 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 " Evaluate an invalid values call AssertException(['let v = py3eval(''"\0"'')'], 'E859:') --- 979,985 ---- py3 v = vim.eval('test_null_function()') call assert_equal(v:none, py3eval('v')) ! call assert_equal(0.0, py3eval('0.0')) " Evaluate an invalid values call AssertException(['let v = py3eval(''"\0"'')'], 'E859:') *** ../vim-9.0.0490/src/testdir/test_random.vim 2020-08-12 17:43:41.000000000 +0100 --- src/testdir/test_random.vim 2022-09-17 20:48:52.662419813 +0100 *************** *** 26,34 **** 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])', 'E745:') call assert_fails('echo rand("burp")', 'E475:') call assert_fails('echo rand([1, 2, 3])', 'E730:') --- 26,32 ---- call assert_equal(1001954530, rand()) call test_srand_seed() ! 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:') *** ../vim-9.0.0490/src/testdir/test_reltime.vim 2021-10-16 12:52:58.000000000 +0100 --- src/testdir/test_reltime.vim 2022-09-17 20:36:46.203968058 +0100 *************** *** 2,8 **** source check.vim CheckFeature reltime - CheckFeature float func Test_reltime() let g:test_is_flaky = 1 --- 2,7 ---- *** ../vim-9.0.0490/src/testdir/test_ruby.vim 2020-06-20 14:59:08.000000000 +0100 --- src/testdir/test_ruby.vim 2022-09-17 20:49:05.890391639 +0100 *************** *** 304,313 **** " 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('foo', rubyeval('Vim::evaluate("\"foo\"")')) call assert_equal('String', rubyeval('Vim::evaluate("\"foo\"").class')) --- 304,311 ---- " on versions of Ruby. call assert_match('^Integer\|Fixnum$', rubyeval('Vim::evaluate("123").class')) ! 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')) *** ../vim-9.0.0490/src/testdir/test_sort.vim 2021-12-27 21:32:26.000000000 +0000 --- src/testdir/test_sort.vim 2022-09-17 20:37:24.467886452 +0100 *************** *** 62,68 **** endfunc func Test_sort_float() - CheckFeature float call assert_equal([0.28, 3, 13.5], sort([13.5, 0.28, 3], 'f')) endfunc --- 62,67 ---- *************** *** 72,79 **** 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"], '')) --- 71,76 ---- *************** *** 1336,1369 **** \ ] 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 for t in tests enew! --- 1333,1364 ---- \ ] endif 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! *** ../vim-9.0.0490/src/testdir/test_substitute.vim 2022-09-16 16:06:29.066260406 +0100 --- src/testdir/test_substitute.vim 2022-09-17 20:37:29.055876668 +0100 *************** *** 464,471 **** 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 --- 464,469 ---- *** ../vim-9.0.0490/src/testdir/test_terminal.vim 2022-09-03 10:59:28.712487478 +0100 --- src/testdir/test_terminal.vim 2022-09-17 20:49:10.570381673 +0100 *************** *** 478,486 **** 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 delete('Xtext') endfunc --- 478,484 ---- call assert_fails("call term_start(cmd, {'term_rows': -1})", 'E475:') call assert_fails("call term_start(cmd, {'term_rows': 1001})", 'E475:') ! call assert_fails("call term_start(cmd, {'term_rows': 10.0})", 'E805:') call delete('Xtext') endfunc *** ../vim-9.0.0490/src/testdir/test_true_false.vim 2020-09-04 20:11:04.000000000 +0100 --- src/testdir/test_true_false.vim 2022-09-17 20:37:51.659828462 +0100 *************** *** 43,51 **** 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 endfunc function Try_arg_true_false(expr, false_val, true_val) --- 43,49 ---- call assert_fails('if [1]', 'E745:') call assert_fails('if {1: 1}', 'E728:') call assert_fails('if function("string")', 'E703:') ! call assert_fails('if 1.3")', 'E805:') endfunc function Try_arg_true_false(expr, false_val, true_val) *************** *** 117,123 **** 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) --- 115,120 ---- *** ../vim-9.0.0490/src/testdir/test_user_func.vim 2022-09-08 19:51:39.734308338 +0100 --- src/testdir/test_user_func.vim 2022-09-17 20:49:21.982357372 +0100 *************** *** 129,139 **** 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 let res = Args(1) call assert_equal(res.mandatory, 1) --- 129,137 ---- endfunc func Test_default_arg() ! 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) *** ../vim-9.0.0490/src/testdir/test_vim9_assign.vim 2022-09-11 15:14:00.551020049 +0100 --- src/testdir/test_vim9_assign.vim 2022-09-17 20:38:28.615749666 +0100 *************** *** 96,104 **** # calling job_start() is in test_vim9_fails.vim, it causes leak reports endif ! if has('float') ! var float1: float = 3.4 ! endif var Funky1: func var Funky2: func = function('len') var Party2: func = funcref('g:Test_syntax') --- 96,102 ---- # calling job_start() is in test_vim9_fails.vim, it causes leak reports endif ! var float1: float = 3.4 var Funky1: func var Funky2: func = function('len') var Party2: func = funcref('g:Test_syntax') *************** *** 147,163 **** &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 lines =<< trim END &ts = 6 --- 145,159 ---- &ts %= 4 assert_equal(2, &ts) ! 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,237 **** g:inc_counter += 1 assert_equal(2, g:inc_counter) ! if has('float') ! var f: float ! f += 1 ! assert_equal(1.0, f) ! endif $SOME_ENV_VAR ..= 'more' assert_equal('somemore', $SOME_ENV_VAR) --- 223,231 ---- g:inc_counter += 1 assert_equal(2, g:inc_counter) ! var f: float ! f += 1 ! assert_equal(1.0, f) $SOME_ENV_VAR ..= 'more' assert_equal('somemore', $SOME_ENV_VAR) *************** *** 250,269 **** 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 enddef let g:someNumber = 43 --- 244,259 ---- enddef def Test_float_and_number() ! 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,1323 **** var thenumber: number assert_equal(0, thenumber) ! if has('float') ! var thefloat: float ! assert_equal(0.0, thefloat) ! endif var thestring: string assert_equal('', thestring) --- 1304,1311 ---- var thenumber: number assert_equal(0, thenumber) ! var thefloat: float ! assert_equal(0.0, thefloat) var thestring: string assert_equal('', thestring) *** ../vim-9.0.0490/src/testdir/test_vim9_builtin.vim 2022-09-15 21:45:57.485522072 +0100 --- src/testdir/test_vim9_builtin.vim 2022-09-17 20:49:37.574324163 +0100 *************** *** 69,79 **** 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 enddef def Test_add() --- 69,77 ---- 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']) ! assert_equal(0, abs(0)) ! assert_equal(2.0, abs(-2.0)) ! assert_equal(3.0, abs(3.0)) enddef def Test_add() *************** *** 1283,1290 **** " 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))) --- 1281,1286 ---- *************** *** 4064,4078 **** 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 enddef def Test_str2list() --- 4060,4070 ---- enddef def Test_str2float() ! 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,4593 **** enddef def Test_typename() ! if has('float') ! assert_equal('func([unknown], [unknown]): float', typename(function('pow'))) ! endif assert_equal('func(...): unknown', test_null_partial()->typename()) assert_equal('list', test_null_list()->typename()) assert_equal('dict', test_null_dict()->typename()) --- 4577,4583 ---- enddef def Test_typename() ! 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()) *** ../vim-9.0.0490/src/testdir/test_vim9_disassemble.vim 2022-09-17 12:39:54.996464478 +0100 --- src/testdir/test_vim9_disassemble.vim 2022-09-17 20:50:46.978176340 +0100 *************** *** 309,317 **** var localbool = true var localspec = v:none var localblob = 0z1234 ! if has('float') ! var localfloat = 1.234 ! endif enddef def Test_disassemble_push() --- 309,315 ---- var localbool = true var localspec = v:none var localblob = 0z1234 ! var localfloat = 1.234 enddef def Test_disassemble_push() *************** *** 1742,1754 **** 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 enddef def Test_disassemble_computing() --- 1740,1750 ---- anyres = g:number / 7 anyres = g:number % 7 ! 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,1806 **** '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 enddef def s:AddListBlob() --- 1779,1800 ---- 'anyres = g:number % 7.*' .. '\d OPANY %.*', instr) ! 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,2196 **** ['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 var nr = 1 for case in cases --- 2172,2188 ---- ['77 isnot g:xx', 'COMPAREANY isnot'], ] var floatDecl = '' ! 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 *** ../vim-9.0.0490/src/testdir/test_vim9_expr.vim 2022-08-20 14:51:13.814510144 +0100 --- src/testdir/test_vim9_expr.vim 2022-09-17 20:42:43.711205925 +0100 *************** *** 18,26 **** assert_equal('one', 1 ? 'one' : 'two') ! if has('float') ! assert_equal('one', !!0.1 ? 'one' : 'two') ! endif assert_equal('one', !!'x' ? 'one' : 'two') assert_equal('one', !!'x' ? 'one' --- 18,24 ---- assert_equal('one', 1 ? 'one' : 'two') ! assert_equal('one', !!0.1 ? 'one' : 'two') assert_equal('one', !!'x' ? 'one' : 'two') assert_equal('one', !!'x' ? 'one' *************** *** 33,41 **** 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', !!'' ? 'one' : 'two') assert_equal('two', !!0z ? 'one' : 'two') assert_equal('two', !![] ? 'one' : 'two') --- 31,37 ---- assert_equal('two', false ? 'one' : 'two') assert_equal('two', 0 ? 'one' : 'two') ! assert_equal('two', !!0.0 ? 'one' : 'two') assert_equal('two', !!'' ? 'one' : 'two') assert_equal('two', !!0z ? 'one' : 'two') assert_equal('two', !![] ? 'one' : 'two') *************** *** 208,216 **** 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 " missing argument detected even when common type is used call v9.CheckDefAndScriptFailure([ --- 204,210 ---- call v9.CheckDefExecAndScriptFailure(["var x = true ? xxx : 'foo'"], ['E1001:', 'E121:'], 1) call v9.CheckDefExecAndScriptFailure(["var x = false ? 'foo' : xxx"], ['E1001:', 'E121:'], 1) ! call v9.CheckDefAndScriptFailure(["var x = 0.1 ? 'one' : 'two'"], 'E805:', 1) " missing argument detected even when common type is used call v9.CheckDefAndScriptFailure([ *************** *** 227,244 **** 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(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 END v9.CheckDefAndScriptSuccess(lines) --- 221,234 ---- assert_equal('yes', 'yes' ?? 456) assert_equal([1], [1] ?? 456) assert_equal({one: 1}, {one: 1} ?? 456) ! 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) ! assert_equal(456, 0.0 ?? 456) END v9.CheckDefAndScriptSuccess(lines) *************** *** 567,575 **** let anint = 10 let theone = 1 let thefour = 4 ! if has('float') ! let afloat = 0.1 ! endif let astring = 'asdf' let ablob = 0z01ab let alist = [2, 3, 4] --- 557,563 ---- let anint = 10 let theone = 1 let thefour = 4 ! let afloat = 0.1 let astring = 'asdf' let ablob = 0z01ab let alist = [2, 3, 4] *************** *** 605,624 **** 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 assert_equal(true, 'abc' == 'abc') assert_equal(false, 'xyz' == 'abc') --- 593,610 ---- assert_equal(true, g:anint == 10) assert_equal(false, 61 == g:anint) ! 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,725 **** 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 unlet g:notReached enddef --- 692,709 ---- v9.CheckScriptFailure(lines, 'E1030: Using a String as a Number: "3"') assert_true(g:notReached) ! 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,761 **** 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_true(test_null_blob() == v:null) assert_true(null_blob == null) --- 730,743 ---- assert_true(null != 123) assert_true(null != 0) ! 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,1096 **** 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 assert_equal(false, 'abc' != 'abc') assert_equal(true, 'xyz' != 'abc') --- 1059,1076 ---- assert_equal(false, g:anint != 10) assert_equal(true, 61 != g:anint) ! 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,1161 **** 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 END v9.CheckDefAndScriptSuccess(lines) enddef --- 1129,1139 ---- assert_false(nr2 > 2) assert_false(nr2 > 3) ! 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,1182 **** 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 END v9.CheckDefAndScriptSuccess(lines) enddef --- 1149,1158 ---- assert_true(nr2 >= 0) assert_true(nr2 >= 2) assert_false(nr2 >= 3) ! 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,1204 **** 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 END v9.CheckDefAndScriptSuccess(lines) enddef --- 1169,1178 ---- assert_false(nr2 < 0) assert_false(nr2 < 2) assert_true(nr2 < 3) ! 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,1229 **** 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 END v9.CheckDefAndScriptSuccess(lines) enddef --- 1191,1201 ---- assert_false(nr2 <= 1) assert_true(nr2 <= 2) assert_true(nr2 <= 3) ! 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,1465 **** 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 = 0za1 > 0z34"], 'Cannot compare blob with blob', 1) call v9.CheckDefAndScriptFailure(["var x = 0za1 >= 0z34"], 'Cannot compare blob with blob', 1) --- 1428,1435 ---- 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) ! 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,1526 **** 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(3, 1 + [2, 3, 4][0]) assert_equal(5, 2 + {key: 3}['key']) --- 1488,1494 ---- assert_equal('afalse', 'a' .. false) assert_equal('anull', 'a' .. v:null) assert_equal('av:none', 'a' .. v:none) ! assert_equal('a0.123', 'a' .. 0.123) assert_equal(3, 1 + [2, 3, 4][0]) assert_equal(5, 2 + {key: 3}['key']) *************** *** 1719,1749 **** 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 enddef func Test_expr6_fails() --- 1687,1713 ---- enddef def Test_expr6_float() ! 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,1865 **** 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 END v9.CheckDefAndScriptSuccess(lines) --- 1816,1827 ---- var y = [3] assert_equal(5, x[0] + y[0]) assert_equal(6, x[0] * y[0]) ! 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,1886 **** 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 lines =<< trim END var n = 0 --- 1836,1846 ---- v9.CheckDefExecFailure(['echo 123 / g:zero'], 'E1154: Divide by zero') v9.CheckDefExecFailure(['echo 123 % g:zero'], 'E1154: Divide by zero') ! v9.CheckDefExecAndScriptFailure([ ! 'g:one = 1.0', ! 'g:two = 2.0', ! 'echo g:one % g:two', ! ], 'E804', 3) lines =<< trim END var n = 0 *************** *** 1948,1983 **** 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 enddef func Test_expr7_fails() --- 1908,1939 ---- enddef def Test_expr7_float() ! 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,2021 **** 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 for op in ['*', '/', '%'] let lines = ['var x = 1', op .. '2', '# comment'] --- 1969,1975 ---- call v9.CheckDefAndScriptFailure(["var x = {one: 1} % {two: 2}"], ['E1035:', 'E728:'], 1) call v9.CheckDefAndScriptFailure(["var x = 0xff[1]"], ['E1107:', 'E1062:'], 1) ! call v9.CheckDefAndScriptFailure(["var x = 0.7[1]"], ['E1107:', 'E806:'], 1) for op in ['*', '/', '%'] let lines = ['var x = 1', op .. '2', '# comment'] *************** *** 2025,2040 **** 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:blob_empty = 0z let g:blob_one = 0z01 let g:blob_long = 0z0102.0304 --- 1979,1992 ---- endfunc func Test_expr7_float_fails() call v9.CheckDefAndScriptFailure(["var x = 1.0 % 2"], ['E1035:', 'E804:'], 1) endfunc " define here to use old style parsing ! 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,2115 **** 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 enddef def Test_expr9_blob() --- 2051,2063 ---- def Test_expr9_float() # float constant ! 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,2807 **** 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 # automatic conversion from number to string var n = 123 --- 2745,2753 ---- assert_equal('numberexpr', dkeys[12]) assert_equal('number', dkeys[34]) assert_equal('bool', dkeys[true]) ! 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 *** ../vim-9.0.0490/src/testdir/test_vimscript.vim 2022-06-27 20:12:47.000000000 +0100 --- src/testdir/test_vimscript.vim 2022-09-17 20:52:31.273954178 +0100 *************** *** 6490,6498 **** 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(6, type(v:false)) call assert_equal(6, type(v:true)) call assert_equal(7, type(v:none)) --- 6490,6496 ---- call assert_equal(2, type(function("tr", [8]))) call assert_equal(3, type([])) call assert_equal(4, type({})) ! 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,6513 **** 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_bool, type(v:false)) call assert_equal(v:t_bool, type(v:true)) call assert_equal(v:t_none, type(v:none)) --- 6503,6509 ---- call assert_equal(v:t_func, type(function("tr", [8]))) call assert_equal(v:t_list, type([])) call assert_equal(v:t_dict, type({})) ! 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,6561 **** 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:false is v:false) call assert_true(v:true is v:true) --- 6547,6555 ---- call assert_true(v:none == 0) call assert_false(v:none == 1) call assert_false(v:none != 0) ! 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,6685 **** \ "'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 " Funcref redir => result --- 6664,6677 ---- \ "'foo bar'"], l) " 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) " Funcref redir => result *************** *** 6816,6825 **** 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 let rng = range(0xFFFFffff, 0x100000001) call assert_equal([0xFFFFffff, 0x100000000, 0x100000001], rng) --- 6808,6815 ---- call assert_equal(-9223372036854775807, -1 / 0) call assert_equal(-9223372036854775807 - 1, 0 / 0) ! 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,6930 **** 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, [])", 'E745:') call assert_fails("call and(1, {})", 'E728:') " or --- 6911,6918 ---- call assert_equal(0, and(127, 128)) call assert_fails("call and([], 1)", 'E745:') call assert_fails("call and({}, 1)", 'E728:') ! 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,6943 **** 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, [])", 'E745:') call assert_fails("call or(1, {})", 'E728:') " xor --- 6922,6929 ---- call assert_equal(123, or(0, 123)) call assert_fails("call or([], 1)", 'E745:') call assert_fails("call or({}, 1)", 'E728:') ! 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,6954 **** 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)", 'E745:') call assert_fails("call xor({}, 1)", 'E728:') call assert_fails("call xor(1, [])", 'E745:') --- 6931,6938 ---- call assert_equal(111, xor(127, 16)) eval 127->xor(16)->assert_equal(111) call assert_equal(255, xor(127, 128)) ! 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,6966 **** 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([])", 'E745:') call assert_fails("call invert({})", 'E728:') endfunc --- 6942,6948 ---- eval 127->invert()->and(65535)->assert_equal(65408) call assert_equal(65519, and(invert(16), 65535)) call assert_equal(65407, and(invert(128), 65535)) ! call assert_fails("call invert(1.0)", 'E805:') call assert_fails("call invert([])", 'E745:') call assert_fails("call invert({})", 'E728:') endfunc *************** *** 7039,7076 **** 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 environment variable let $FOO = 1 --- 7021,7056 ---- let x += 1 call assert_equal(1, x) ! " 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,7150 **** 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 if has('job') call assert_equal(0, test_refcount(job_start([&shell, &shellcmdflag, 'echo .']))) endif --- 7122,7128 ---- call assert_equal(0, test_refcount({})) call assert_equal(0, test_refcount(0zff)) call assert_equal(0, test_refcount({-> line('.')})) ! call assert_equal(-1, test_refcount(0.1)) if has('job') call assert_equal(0, test_refcount(job_start([&shell, &shellcmdflag, 'echo .']))) endif *************** *** 7156,7165 **** 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 " Check refcount let x = [] --- 7134,7141 ---- call assert_equal(-1, test_refcount(x)) let x = v:true call assert_equal(-1, test_refcount(x)) ! let x = 0.1 ! call assert_equal(-1, test_refcount(x)) " Check refcount let x = [] *************** *** 7377,7392 **** " 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 endfunc " invalid function names {{{1 --- 7353,7366 ---- " Test for errors in converting to float from various types {{{1 func Test_float_conversion_errors() ! 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 *** ../vim-9.0.0490/src/version.c 2022-09-17 19:43:19.258427029 +0100 --- src/version.c 2022-09-17 20:57:58.765256883 +0100 *************** *** 705,706 **** --- 701,704 ---- { /* Add new patch number below this line */ + /**/ + 491, /**/ -- From "know your smileys": +<(:-) The Pope /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///