summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/eval.txt113
-rw-r--r--src/evalfunc.c50
-rw-r--r--src/testdir/test_float_func.vim27
-rw-r--r--src/version.c2
4 files changed, 163 insertions, 29 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 96feb7daa..be1ea8503 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1119,7 +1119,6 @@ in any order. E.g., these are all possible:
expr8->(expr1, ...)[expr1]
Evaluation is always from left to right.
-
expr8[expr1] item of String or |List| *expr-[]* *E111*
*E909* *subscript*
If expr8 is a Number or String this results in a String that contains the
@@ -1231,6 +1230,13 @@ next method: >
Example of using a lambda: >
GetPercentage->{x -> x * 100}()->printf('%d%%')
<
+When using -> the |expr7| operators will be applied first, thus: >
+ -1.234->string()
+Is equivalent to: >
+ (-1.234)->string()
+And NOT: >
+ -(1.234->string())
+<
*E274*
"->name(" must not contain white space. There can be white space before the
"->" and after the "(", thus you can split the lines like this: >
@@ -2888,7 +2894,11 @@ abs({expr}) *abs()*
< 5.456 >
echo abs(-4)
< 4
- {only available when compiled with the |+float| feature}
+
+ Can also be used as a |method|: >
+ Compute()->abs()
+
+< {only available when compiled with the |+float| feature}
acos({expr}) *acos()*
@@ -2901,7 +2911,11 @@ acos({expr}) *acos()*
< 1.570796 >
:echo acos(-0.5)
< 2.094395
- {only available when compiled with the |+float| feature}
+
+ Can also be used as a |method|: >
+ Compute()->acos()
+
+< {only available when compiled with the |+float| feature}
add({object}, {expr}) *add()*
@@ -2913,6 +2927,7 @@ add({object}, {expr}) *add()*
item. Use |extend()| to concatenate |Lists|.
When {object} is a |Blob| then {expr} must be a number.
Use |insert()| to add an item at another position.
+
Can also be used as a |method|: >
mylist->add(val1)->add(val2)
@@ -3014,6 +3029,10 @@ asin({expr}) *asin()*
< 0.927295 >
:echo asin(-0.5)
< -0.523599
+
+ Can also be used as a |method|: >
+ Compute()->asin()
+<
{only available when compiled with the |+float| feature}
@@ -3026,6 +3045,10 @@ atan({expr}) *atan()*
< 1.560797 >
:echo atan(-4.01)
< -1.326405
+
+ Can also be used as a |method|: >
+ Compute()->atan()
+<
{only available when compiled with the |+float| feature}
@@ -3038,6 +3061,10 @@ atan2({expr1}, {expr2}) *atan2()*
< -0.785398 >
:echo atan2(1, -1)
< 2.356194
+
+ Can also be used as a |method|: >
+ Compute()->atan(1)
+<
{only available when compiled with the |+float| feature}
balloon_gettext() *balloon_gettext()*
@@ -3296,6 +3323,10 @@ ceil({expr}) *ceil()*
< -5.0 >
echo ceil(4.0)
< 4.0
+
+ Can also be used as a |method|: >
+ Compute()->ceil()
+<
{only available when compiled with the |+float| feature}
@@ -3572,6 +3603,10 @@ cos({expr}) *cos()*
< 0.862319 >
:echo cos(-4.01)
< -0.646043
+
+ Can also be used as a |method|: >
+ Compute()->cos()
+<
{only available when compiled with the |+float| feature}
@@ -3584,6 +3619,10 @@ cosh({expr}) *cosh()*
< 1.127626 >
:echo cosh(-0.5)
< -1.127626
+
+ Can also be used as a |method|: >
+ Compute()->cosh()
+<
{only available when compiled with the |+float| feature}
@@ -3969,6 +4008,10 @@ exp({expr}) *exp()*
< 7.389056 >
:echo exp(-1)
< 0.367879
+
+ Can also be used as a |method|: >
+ Compute()->exp()
+<
{only available when compiled with the |+float| feature}
@@ -4267,6 +4310,10 @@ float2nr({expr}) *float2nr()*
< -2147483647 (or -9223372036854775807) >
echo float2nr(1.0e-100)
< 0
+
+ Can also be used as a |method|: >
+ Compute()->float2nr()
+<
{only available when compiled with the |+float| feature}
@@ -4281,6 +4328,10 @@ floor({expr}) *floor()*
< -6.0 >
echo floor(4.0)
< 4.0
+
+ Can also be used as a |method|: >
+ Compute()->floor()
+<
{only available when compiled with the |+float| feature}
@@ -4297,6 +4348,10 @@ fmod({expr1}, {expr2}) *fmod()*
< 0.13 >
:echo fmod(-12.33, 1.22)
< -0.13
+
+ Can also be used as a |method|: >
+ Compute()->fmod(1.22)
+<
{only available when compiled with |+float| feature}
@@ -5794,6 +5849,9 @@ isinf({expr}) *isinf()*
:echo isinf(-1.0 / 0.0)
< -1
+ Can also be used as a |method|: >
+ Compute()->isinf()
+<
{only available when compiled with the |+float| feature}
islocked({expr}) *islocked()* *E786*
@@ -5814,6 +5872,9 @@ isnan({expr}) *isnan()*
echo isnan(0.0 / 0.0)
< 1
+ Can also be used as a |method|: >
+ Compute()->isnan()
+<
{only available when compiled with the |+float| feature}
items({dict}) *items()*
@@ -6164,6 +6225,10 @@ log({expr}) *log()*
< 2.302585 >
:echo log(exp(5))
< 5.0
+
+ Can also be used as a |method|: >
+ Compute()->log()
+<
{only available when compiled with the |+float| feature}
@@ -6175,6 +6240,10 @@ log10({expr}) *log10()*
< 3.0 >
:echo log10(0.01)
< -2.0
+
+ Can also be used as a |method|: >
+ Compute()->log10()
+<
{only available when compiled with the |+float| feature}
luaeval({expr} [, {expr}]) *luaeval()*
@@ -6734,6 +6803,10 @@ pow({x}, {y}) *pow()*
< 65536.0 >
:echo pow(32, 0.20)
< 2.0
+
+ Can also be used as a |method|: >
+ Compute()->pow(3)
+<
{only available when compiled with the |+float| feature}
prevnonblank({lnum}) *prevnonblank()*
@@ -7358,6 +7431,10 @@ round({expr}) *round()*
< 5.0 >
echo round(-4.5)
< -5.0
+
+ Can also be used as a |method|: >
+ Compute()->round()
+<
{only available when compiled with the |+float| feature}
rubyeval({expr}) *rubyeval()*
@@ -8147,6 +8224,10 @@ sin({expr}) *sin()*
< -0.506366 >
:echo sin(-4.01)
< 0.763301
+
+ Can also be used as a |method|: >
+ Compute()->sin()
+<
{only available when compiled with the |+float| feature}
@@ -8159,6 +8240,10 @@ sinh({expr}) *sinh()*
< 0.521095 >
:echo sinh(-0.9)
< -1.026517
+
+ Can also be used as a |method|: >
+ Compute()->sinh()
+<
{only available when compiled with the |+float| feature}
@@ -8365,6 +8450,10 @@ sqrt({expr}) *sqrt()*
:echo sqrt(-4.01)
< nan
"nan" may be different, it depends on system libraries.
+
+ Can also be used as a |method|: >
+ Compute()->sqrt()
+<
{only available when compiled with the |+float| feature}
@@ -8381,7 +8470,11 @@ str2float({expr}) *str2float()*
12.0. You can strip out thousands separators with
|substitute()|: >
let f = str2float(substitute(text, ',', '', 'g'))
-< {only available when compiled with the |+float| feature}
+<
+ Can also be used as a |method|: >
+ let f = text->substitute(',', '', 'g')->str2float()
+<
+ {only available when compiled with the |+float| feature}
str2list({expr} [, {utf8}]) *str2list()*
Return a list containing the number values which represent
@@ -8978,6 +9071,10 @@ tan({expr}) *tan()*
< 0.648361 >
:echo tan(-4.01)
< -1.181502
+
+ Can also be used as a |method|: >
+ Compute()->tan()
+<
{only available when compiled with the |+float| feature}
@@ -8990,6 +9087,10 @@ tanh({expr}) *tanh()*
< 0.462117 >
:echo tanh(-1)
< -0.761594
+
+ Can also be used as a |method|: >
+ Compute()->tanh()
+<
{only available when compiled with the |+float| feature}
@@ -9143,6 +9244,10 @@ trunc({expr}) *trunc()*
< -5.0 >
echo trunc(4.0)
< 4.0
+
+ Can also be used as a |method|: >
+ Compute()->trunc()
+<
{only available when compiled with the |+float| feature}
*type()*
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 89430937f..fde51c4bc 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -418,8 +418,8 @@ typedef struct
static funcentry_T global_functions[] =
{
#ifdef FEAT_FLOAT
- {"abs", 1, 1, 0, f_abs},
- {"acos", 1, 1, 0, f_acos}, // WJMc
+ {"abs", 1, 1, FEARG_1, f_abs},
+ {"acos", 1, 1, FEARG_1, f_acos}, // WJMc
#endif
{"add", 2, 2, FEARG_1, f_add},
{"and", 2, 2, 0, f_and},
@@ -430,7 +430,7 @@ static funcentry_T global_functions[] =
{"arglistid", 0, 2, 0, f_arglistid},
{"argv", 0, 2, 0, f_argv},
#ifdef FEAT_FLOAT
- {"asin", 1, 1, 0, f_asin}, // WJMc
+ {"asin", 1, 1, FEARG_1, f_asin}, // WJMc
#endif
{"assert_beeps", 1, 2, FEARG_1, f_assert_beeps},
{"assert_equal", 2, 3, FEARG_2, f_assert_equal},
@@ -445,8 +445,8 @@ static funcentry_T global_functions[] =
{"assert_report", 1, 1, 0, f_assert_report},
{"assert_true", 1, 2, FEARG_1, f_assert_true},
#ifdef FEAT_FLOAT
- {"atan", 1, 1, 0, f_atan},
- {"atan2", 2, 2, 0, f_atan2},
+ {"atan", 1, 1, FEARG_1, f_atan},
+ {"atan2", 2, 2, FEARG_1, f_atan2},
#endif
#ifdef FEAT_BEVAL
{"balloon_gettext", 0, 0, 0, f_balloon_gettext},
@@ -474,7 +474,7 @@ static funcentry_T global_functions[] =
{"byteidxcomp", 2, 2, 0, f_byteidxcomp},
{"call", 2, 3, 0, f_call},
#ifdef FEAT_FLOAT
- {"ceil", 1, 1, 0, f_ceil},
+ {"ceil", 1, 1, FEARG_1, f_ceil},
#endif
#ifdef FEAT_JOB_CHANNEL
{"ch_canread", 1, 1, 0, f_ch_canread},
@@ -511,8 +511,8 @@ static funcentry_T global_functions[] =
{"confirm", 1, 4, 0, f_confirm},
{"copy", 1, 1, FEARG_1, f_copy},
#ifdef FEAT_FLOAT
- {"cos", 1, 1, 0, f_cos},
- {"cosh", 1, 1, 0, f_cosh},
+ {"cos", 1, 1, FEARG_1, f_cos},
+ {"cosh", 1, 1, FEARG_1, f_cosh},
#endif
{"count", 2, 4, FEARG_1, f_count},
{"cscope_connection",0,3, 0, f_cscope_connection},
@@ -536,7 +536,7 @@ static funcentry_T global_functions[] =
{"exepath", 1, 1, 0, f_exepath},
{"exists", 1, 1, 0, f_exists},
#ifdef FEAT_FLOAT
- {"exp", 1, 1, 0, f_exp},
+ {"exp", 1, 1, FEARG_1, f_exp},
#endif
{"expand", 1, 3, 0, f_expand},
{"expandcmd", 1, 1, 0, f_expandcmd},
@@ -549,9 +549,9 @@ static funcentry_T global_functions[] =
{"finddir", 1, 3, 0, f_finddir},
{"findfile", 1, 3, 0, f_findfile},
#ifdef FEAT_FLOAT
- {"float2nr", 1, 1, 0, f_float2nr},
- {"floor", 1, 1, 0, f_floor},
- {"fmod", 2, 2, 0, f_fmod},
+ {"float2nr", 1, 1, FEARG_1, f_float2nr},
+ {"floor", 1, 1, FEARG_1, f_floor},
+ {"fmod", 2, 2, FEARG_1, f_fmod},
#endif
{"fnameescape", 1, 1, 0, f_fnameescape},
{"fnamemodify", 2, 2, 0, f_fnamemodify},
@@ -634,11 +634,11 @@ static funcentry_T global_functions[] =
{"invert", 1, 1, 0, f_invert},
{"isdirectory", 1, 1, 0, f_isdirectory},
#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H)
- {"isinf", 1, 1, 0, f_isinf},
+ {"isinf", 1, 1, FEARG_1, f_isinf},
#endif
{"islocked", 1, 1, 0, f_islocked},
#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H)
- {"isnan", 1, 1, 0, f_isnan},
+ {"isnan", 1, 1, FEARG_1, f_isnan},
#endif
{"items", 1, 1, FEARG_1, f_items},
#ifdef FEAT_JOB_CHANNEL
@@ -668,8 +668,8 @@ static funcentry_T global_functions[] =
{"listener_remove", 1, 1, 0, f_listener_remove},
{"localtime", 0, 0, 0, f_localtime},
#ifdef FEAT_FLOAT
- {"log", 1, 1, 0, f_log},
- {"log10", 1, 1, 0, f_log10},
+ {"log", 1, 1, FEARG_1, f_log},
+ {"log10", 1, 1, FEARG_1, f_log10},
#endif
#ifdef FEAT_LUA
{"luaeval", 1, 2, 0, f_luaeval},
@@ -722,7 +722,7 @@ static funcentry_T global_functions[] =
{"popup_show", 1, 1, 0, f_popup_show},
#endif
#ifdef FEAT_FLOAT
- {"pow", 2, 2, 0, f_pow},
+ {"pow", 2, 2, FEARG_1, f_pow},
#endif
{"prevnonblank", 1, 1, 0, f_prevnonblank},
{"printf", 1, 19, FEARG_2, f_printf},
@@ -775,7 +775,7 @@ static funcentry_T global_functions[] =
{"resolve", 1, 1, 0, f_resolve},
{"reverse", 1, 1, FEARG_1, f_reverse},
#ifdef FEAT_FLOAT
- {"round", 1, 1, 0, f_round},
+ {"round", 1, 1, FEARG_1, f_round},
#endif
#ifdef FEAT_RUBY
{"rubyeval", 1, 1, 0, f_rubyeval},
@@ -828,8 +828,8 @@ static funcentry_T global_functions[] =
#endif
{"simplify", 1, 1, 0, f_simplify},
#ifdef FEAT_FLOAT
- {"sin", 1, 1, 0, f_sin},
- {"sinh", 1, 1, 0, f_sinh},
+ {"sin", 1, 1, FEARG_1, f_sin},
+ {"sinh", 1, 1, FEARG_1, f_sinh},
#endif
{"sort", 1, 3, FEARG_1, f_sort},
#ifdef FEAT_SOUND
@@ -843,8 +843,8 @@ static funcentry_T global_functions[] =
{"spellsuggest", 1, 3, 0, f_spellsuggest},
{"split", 1, 3, FEARG_1, f_split},
#ifdef FEAT_FLOAT
- {"sqrt", 1, 1, 0, f_sqrt},
- {"str2float", 1, 1, 0, f_str2float},
+ {"sqrt", 1, 1, FEARG_1, f_sqrt},
+ {"str2float", 1, 1, FEARG_1, f_str2float},
#endif
{"str2list", 1, 2, FEARG_1, f_str2list},
{"str2nr", 1, 2, 0, f_str2nr},
@@ -879,8 +879,8 @@ static funcentry_T global_functions[] =
{"tagfiles", 0, 0, 0, f_tagfiles},
{"taglist", 1, 2, 0, f_taglist},
#ifdef FEAT_FLOAT
- {"tan", 1, 1, 0, f_tan},
- {"tanh", 1, 1, 0, f_tanh},
+ {"tan", 1, 1, FEARG_1, f_tan},
+ {"tanh", 1, 1, FEARG_1, f_tanh},
#endif
{"tempname", 0, 0, 0, f_tempname},
#ifdef FEAT_TERMINAL
@@ -952,7 +952,7 @@ static funcentry_T global_functions[] =
{"tr", 3, 3, 0, f_tr},
{"trim", 1, 2, 0, f_trim},
#ifdef FEAT_FLOAT
- {"trunc", 1, 1, 0, f_trunc},
+ {"trunc", 1, 1, FEARG_1, f_trunc},
#endif
{"type", 1, 1, FEARG_1, f_type},
{"undofile", 1, 1, 0, f_undofile},
diff --git a/src/testdir/test_float_func.vim b/src/testdir/test_float_func.vim
index f407f40eb..17b5cdac9 100644
--- a/src/testdir/test_float_func.vim
+++ b/src/testdir/test_float_func.vim
@@ -6,6 +6,8 @@ CheckFeature float
func Test_abs()
call assert_equal('1.23', string(abs(1.23)))
call assert_equal('1.23', string(abs(-1.23)))
+ eval -1.23->abs()->string()->assert_equal('1.23')
+
call assert_equal('0.0', string(abs(0.0)))
call assert_equal('0.0', string(abs(1.0/(1.0/0.0))))
call assert_equal('0.0', string(abs(-1.0/(1.0/0.0))))
@@ -22,6 +24,7 @@ endfunc
func Test_sqrt()
call assert_equal('0.0', string(sqrt(0.0)))
call assert_equal('1.414214', string(sqrt(2.0)))
+ eval 2.0->sqrt()->string()->assert_equal('1.414214')
call assert_equal('inf', string(sqrt(1.0/0.0)))
call assert_equal('nan', string(sqrt(-1.0)))
call assert_equal('nan', string(sqrt(0.0/0.0)))
@@ -31,6 +34,7 @@ endfunc
func Test_log()
call assert_equal('0.0', string(log(1.0)))
call assert_equal('-0.693147', string(log(0.5)))
+ eval 0.5->log()->string()->assert_equal('-0.693147')
call assert_equal('-inf', string(log(0.0)))
call assert_equal('nan', string(log(-1.0)))
call assert_equal('inf', string(log(1.0/0.0)))
@@ -42,6 +46,7 @@ func Test_log10()
call assert_equal('0.0', string(log10(1.0)))
call assert_equal('2.0', string(log10(100.0)))
call assert_equal('2.079181', string(log10(120.0)))
+ eval 120.0->log10()->string()->assert_equal('2.079181')
call assert_equal('-inf', string(log10(0.0)))
call assert_equal('nan', string(log10(-1.0)))
call assert_equal('inf', string(log10(1.0/0.0)))
@@ -53,6 +58,7 @@ func Test_exp()
call assert_equal('1.0', string(exp(0.0)))
call assert_equal('7.389056', string(exp(2.0)))
call assert_equal('0.367879', string(exp(-1.0)))
+ eval -1.0->exp()->string()->assert_equal('0.367879')
call assert_equal('inf', string(exp(1.0/0.0)))
call assert_equal('0.0', string(exp(-1.0/0.0)))
call assert_equal('nan', string(exp(0.0/0.0)))
@@ -63,6 +69,7 @@ func Test_sin()
call assert_equal('0.0', string(sin(0.0)))
call assert_equal('0.841471', string(sin(1.0)))
call assert_equal('-0.479426', string(sin(-0.5)))
+ eval -0.5->sin()->string()->assert_equal('-0.479426')
call assert_equal('nan', string(sin(0.0/0.0)))
call assert_equal('nan', string(sin(1.0/0.0)))
call assert_equal('0.0', string(sin(1.0/(1.0/0.0))))
@@ -73,6 +80,8 @@ endfunc
func Test_asin()
call assert_equal('0.0', string(asin(0.0)))
call assert_equal('1.570796', string(asin(1.0)))
+ eval 1.0->asin()->string()->assert_equal('1.570796')
+
call assert_equal('-0.523599', string(asin(-0.5)))
call assert_equal('nan', string(asin(1.1)))
call assert_equal('nan', string(asin(1.0/0.0)))
@@ -84,6 +93,7 @@ func Test_sinh()
call assert_equal('0.0', string(sinh(0.0)))
call assert_equal('0.521095', string(sinh(0.5)))
call assert_equal('-1.026517', string(sinh(-0.9)))
+ eval -0.9->sinh()->string()->assert_equal('-1.026517')
call assert_equal('inf', string(sinh(1.0/0.0)))
call assert_equal('-inf', string(sinh(-1.0/0.0)))
call assert_equal('nan', string(sinh(0.0/0.0)))
@@ -94,6 +104,7 @@ func Test_cos()
call assert_equal('1.0', string(cos(0.0)))
call assert_equal('0.540302', string(cos(1.0)))
call assert_equal('0.877583', string(cos(-0.5)))
+ eval -0.5->cos()->string()->assert_equal('0.877583')
call assert_equal('nan', string(cos(0.0/0.0)))
call assert_equal('nan', string(cos(1.0/0.0)))
call assert_fails('call cos("")', 'E808:')
@@ -103,6 +114,7 @@ func Test_acos()
call assert_equal('1.570796', string(acos(0.0)))
call assert_equal('0.0', string(acos(1.0)))
call assert_equal('3.141593', string(acos(-1.0)))
+ eval -1.0->acos()->string()->assert_equal('3.141593')
call assert_equal('2.094395', string(acos(-0.5)))
call assert_equal('nan', string(acos(1.1)))
call assert_equal('nan', string(acos(1.0/0.0)))
@@ -113,6 +125,7 @@ endfunc
func Test_cosh()
call assert_equal('1.0', string(cosh(0.0)))
call assert_equal('1.127626', string(cosh(0.5)))
+ eval 0.5->cosh()->string()->assert_equal('1.127626')
call assert_equal('inf', string(cosh(1.0/0.0)))
call assert_equal('inf', string(cosh(-1.0/0.0)))
call assert_equal('nan', string(cosh(0.0/0.0)))
@@ -123,6 +136,7 @@ func Test_tan()
call assert_equal('0.0', string(tan(0.0)))
call assert_equal('0.546302', string(tan(0.5)))
call assert_equal('-0.546302', string(tan(-0.5)))
+ eval -0.5->tan()->string()->assert_equal('-0.546302')
call assert_equal('nan', string(tan(1.0/0.0)))
call assert_equal('nan', string(cos(0.0/0.0)))
call assert_equal('0.0', string(tan(1.0/(1.0/0.0))))
@@ -134,6 +148,7 @@ func Test_atan()
call assert_equal('0.0', string(atan(0.0)))
call assert_equal('0.463648', string(atan(0.5)))
call assert_equal('-0.785398', string(atan(-1.0)))
+ eval -1.0->atan()->string()->assert_equal('-0.785398')
call assert_equal('1.570796', string(atan(1.0/0.0)))
call assert_equal('-1.570796', string(atan(-1.0/0.0)))
call assert_equal('nan', string(atan(0.0/0.0)))
@@ -144,6 +159,7 @@ func Test_atan2()
call assert_equal('-2.356194', string(atan2(-1, -1)))
call assert_equal('2.356194', string(atan2(1, -1)))
call assert_equal('0.0', string(atan2(1.0, 1.0/0.0)))
+ eval 1.0->atan2(1.0/0.0)->string()->assert_equal('0.0')
call assert_equal('1.570796', string(atan2(1.0/0.0, 1.0)))
call assert_equal('nan', string(atan2(0.0/0.0, 1.0)))
call assert_fails('call atan2("", -1)', 'E808:')
@@ -154,6 +170,7 @@ func Test_tanh()
call assert_equal('0.0', string(tanh(0.0)))
call assert_equal('0.462117', string(tanh(0.5)))
call assert_equal('-0.761594', string(tanh(-1.0)))
+ eval -1.0->tanh()->string()->assert_equal('-0.761594')
call assert_equal('1.0', string(tanh(1.0/0.0)))
call assert_equal('-1.0', string(tanh(-1.0/0.0)))
call assert_equal('nan', string(tanh(0.0/0.0)))
@@ -164,6 +181,7 @@ func Test_fmod()
call assert_equal('0.13', string(fmod(12.33, 1.22)))
call assert_equal('-0.13', string(fmod(-12.33, 1.22)))
call assert_equal('nan', string(fmod(1.0/0.0, 1.0)))
+ eval (1.0/0.0)->fmod(1.0)->string()->assert_equal('nan')
" On Windows we get "nan" instead of 1.0, accept both.
let res = string(fmod(1.0, 1.0/0.0))
if res != 'nan'
@@ -177,6 +195,7 @@ endfunc
func Test_pow()
call assert_equal('1.0', string(pow(0.0, 0.0)))
call assert_equal('8.0', string(pow(2.0, 3.0)))
+ eval 2.0->pow(3.0)->string()->assert_equal('8.0')
call assert_equal('nan', string(pow(2.0, 0.0/0.0)))
call assert_equal('nan', string(pow(0.0/0.0, 3.0)))
call assert_equal('nan', string(pow(0.0/0.0, 3.0)))
@@ -192,6 +211,7 @@ func Test_str2float()
call assert_equal('1.0', string(str2float(' 1.0 ')))
call assert_equal('1.23', string(str2float('1.23')))
call assert_equal('1.23', string(str2float('1.23abc')))
+ eval '1.23abc'->str2float()->string()->assert_equal('1.23')
call assert_equal('1.0e40', string(str2float('1e40')))
call assert_equal('-1.23', string(str2float('-1.23')))
call assert_equal('1.23', string(str2float(' + 1.23 ')))
@@ -228,6 +248,7 @@ func Test_float2nr()
call assert_equal(1, float2nr(1.234))
call assert_equal(123, float2nr(1.234e2))
call assert_equal(12, float2nr(123.4e-1))
+ eval 123.4e-1->float2nr()->assert_equal(12)
let max_number = 1/0
let min_number = -max_number
call assert_equal(max_number/2+1, float2nr(pow(2, 62)))
@@ -242,6 +263,7 @@ func Test_floor()
call assert_equal('2.0', string(floor(2.0)))
call assert_equal('2.0', string(floor(2.11)))
call assert_equal('2.0', string(floor(2.99)))
+ eval 2.99->floor()->string()->assert_equal('2.0')
call assert_equal('-3.0', string(floor(-2.11)))
call assert_equal('-3.0', string(floor(-2.99)))
call assert_equal('nan', string(floor(0.0/0.0)))
@@ -255,6 +277,7 @@ func Test_ceil()
call assert_equal('3.0', string(ceil(2.11)))
call assert_equal('3.0', string(ceil(2.99)))
call assert_equal('-2.0', string(ceil(-2.11)))
+ eval -2.11->ceil()->string()->assert_equal('-2.0')
call assert_equal('-2.0', string(ceil(-2.99)))
call assert_equal('nan', string(ceil(0.0/0.0)))
call assert_equal('inf', string(ceil(1.0/0.0)))
@@ -266,6 +289,7 @@ func Test_round()
call assert_equal('2.0', string(round(2.1)))
call assert_equal('3.0', string(round(2.5)))
call assert_equal('3.0', string(round(2.9)))
+ eval 2.9->round()->string()->assert_equal('3.0')
call assert_equal('-2.0', string(round(-2.1)))
call assert_equal('-3.0', string(round(-2.5)))
call assert_equal('-3.0', string(round(-2.9)))
@@ -279,6 +303,7 @@ func Test_trunc()
call assert_equal('2.0', string(trunc(2.1)))
call assert_equal('2.0', string(trunc(2.5)))
call assert_equal('2.0', string(trunc(2.9)))
+ eval 2.9->trunc()->string()->assert_equal('2.0')
call assert_equal('-2.0', string(trunc(-2.1)))
call assert_equal('-2.0', string(trunc(-2.5)))
call assert_equal('-2.0', string(trunc(-2.9)))
@@ -291,6 +316,7 @@ endfunc
func Test_isinf()
call assert_equal(1, isinf(1.0/0.0))
call assert_equal(-1, isinf(-1.0/0.0))
+ eval (-1.0/0.0)->isinf()->assert_equal(-1)
call assert_false(isinf(1.0))
call assert_false(isinf(0.0/0.0))
call assert_false(isinf('a'))
@@ -302,6 +328,7 @@ func Test_isnan()
call assert_true(isnan(0.0/0.0))
call assert_false(isnan(1.0))
call assert_false(isnan(1.0/0.0))
+ eval (1.0/0.0)->isnan()->assert_false()
call assert_false(isnan(-1.0/0.0))
call assert_false(isnan('a'))
call assert_false(isnan([]))
diff --git a/src/version.c b/src/version.c
index 7242368f9..8005f1f4d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -770,6 +770,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1879,
+/**/
1878,
/**/
1877,