summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-05-21 16:33:48 +0200
committerBram Moolenaar <Bram@vim.org>2010-05-21 16:33:48 +0200
commitdb7c686ea58323f8e8550dea287eac7ea4964a55 (patch)
tree0b0ff55ed0526a4209c349f833b611b23adad48e /runtime
parentb382ad13ca50ee57d94150a3be50586d19db4204 (diff)
downloadvim-db7c686ea58323f8e8550dea287eac7ea4964a55.zip
Add extra floating point functions.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt140
-rw-r--r--runtime/doc/tags17
-rw-r--r--runtime/doc/todo.txt9
-rw-r--r--runtime/doc/version7.txt3
-rw-r--r--runtime/syntax/cabal.vim1
-rw-r--r--runtime/syntax/obj.vim1
6 files changed, 168 insertions, 3 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 3abf52a98..b189f9b35 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1660,6 +1660,7 @@ See |function-list| for a list grouped by what the function is used for.
USAGE RESULT DESCRIPTION ~
abs( {expr}) Float or Number absolute value of {expr}
+acos( {expr}) Float arc cosine of {expr}
add( {list}, {item}) List append {item} to |List| {list}
append( {lnum}, {string}) Number append {string} below line {lnum}
append( {lnum}, {list}) Number append lines {list} below line {lnum}
@@ -1667,7 +1668,9 @@ argc() Number number of files in the argument list
argidx() Number current index in the argument list
argv( {nr}) String {nr} entry of the argument list
argv( ) List the argument list
+asin( {expr}) Float arc sine of {expr}
atan( {expr}) Float arc tangent of {expr}
+atan2( {expr}, {expr}) Float arc tangent of {expr1} / {expr2}
browse( {save}, {title}, {initdir}, {default})
String put up a file requester
browsedir( {title}, {initdir}) String put up a directory requester
@@ -1694,6 +1697,7 @@ confirm( {msg} [, {choices} [, {default} [, {type}]]])
Number number of choice picked by user
copy( {expr}) any make a shallow copy of {expr}
cos( {expr}) Float cosine of {expr}
+cosh( {expr}) Float hyperbolic cosine of {expr}
count( {list}, {expr} [, {start} [, {ic}]])
Number count how many {expr} are in {list}
cscope_connection( [{num} , {dbpath} [, {prepend}]])
@@ -1714,6 +1718,7 @@ executable( {expr}) Number 1 if executable {expr} exists
exists( {expr}) Number TRUE if {expr} exists
extend( {expr1}, {expr2} [, {expr3}])
List/Dict insert items of {expr2} into {expr1}
+exp( {expr}) Float exponential of {expr}
expand( {expr} [, {flag}]) String expand special keywords in {expr}
feedkeys( {string} [, {mode}]) Number add key sequence to typeahead buffer
filereadable( {file}) Number TRUE if {file} is a readable file
@@ -1726,6 +1731,7 @@ findfile( {name}[, {path}[, {count}]])
String find file {name} in {path}
float2nr( {expr}) Number convert Float {expr} to a Number
floor( {expr}) Float round {expr} down
+fmod( {expr1}, {expr2}) Float remainder of {expr1} / {expr2}
fnameescape( {fname}) String escape special characters in {fname}
fnamemodify( {fname}, {mods}) String modify file name
foldclosed( {lnum}) Number first line of fold at {lnum} if closed
@@ -1805,6 +1811,7 @@ line( {expr}) Number line nr of cursor, last line or mark
line2byte( {lnum}) Number byte count of line {lnum}
lispindent( {lnum}) Number Lisp indent for line {lnum}
localtime() Number current time
+log( {expr}) Float natural logarithm (base e) of {expr}
log10( {expr}) Float logarithm of Float {expr} to base 10
map( {expr}, {string}) List/Dict change each item in {expr} to {expr}
maparg( {name}[, {mode} [, {abbr}]])
@@ -1887,6 +1894,7 @@ shellescape( {string} [, {special}])
command argument
simplify( {filename}) String simplify filename as much as possible
sin( {expr}) Float sine of {expr}
+sinh( {expr}) Float hyperbolic sine of {expr}
sort( {list} [, {func}]) List sort {list}, using {func} to compare
soundfold( {word}) String sound-fold {word}
spellbadword() String badly spelled word at cursor
@@ -1923,6 +1931,8 @@ tabpagewinnr( {tabarg}[, {arg}])
taglist( {expr}) List list of tags matching {expr}
tagfiles() List tags files used
tempname() String name for a temporary file
+tan( {expr}) Float tangent of {expr}
+tanh( {expr}) Float hyperbolic tangent of {expr}
tolower( {expr}) String the String {expr} switched to lowercase
toupper( {expr}) String the String {expr} switched to uppercase
tr( {src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr}
@@ -1958,6 +1968,20 @@ abs({expr}) *abs()*
< 4
{only available when compiled with the |+float| feature}
+
+acos({expr}) *acos()*
+ Return the arc cosine of {expr} measured in radians, as a
+ |Float|in the range of [0, pi].
+ {expr} must evaluate to a|Float|or a|Number|in the range
+ [-1, 1].
+ Examples: >
+ :echo acos(0)
+< 1.570796 >
+ :echo acos(-0.5)
+< 2.094395
+ {only available when compiled with|+float|}
+
+
add({list}, {expr}) *add()*
Append the item {expr} to |List| {list}. Returns the
resulting |List|. Examples: >
@@ -2000,6 +2024,19 @@ argv([{nr}]) The result is the {nr}th file in the argument list of the
< Without the {nr} argument a |List| with the whole |arglist| is
returned.
+asin({expr}) *asin()*
+ Return the arc sine of {expr} measured in radians, as a|Float|
+ in the range of [-pi/2, pi/2].
+ {expr} must evaluate to a|Float|or a|Number|in the range
+ [-1, 1].
+ Examples: >
+ :echo asin(0.8)
+< 0.927295 >
+ :echo asin(-0.5)
+< -0.523599
+ {only available when compiled with|+float|}
+
+
atan({expr}) *atan()*
Return the principal value of the arc tangent of {expr}, in
the range [-pi/2, +pi/2] radians, as a |Float|.
@@ -2011,6 +2048,19 @@ atan({expr}) *atan()*
< -1.326405
{only available when compiled with the |+float| feature}
+
+atan2({expr1}, {expr2}) *atan2()*
+ Return the arc tangent of {expr1} / {expr2}, measured in
+ radians, as a|Float|in the range [-pi, pi].
+ {expr1} and {expr2} must evaluate to a|Float|or a|Number|.
+ Examples: >
+ :echo atan2(-1, 1)
+< -0.785398 >
+ :echo atan2(1, -1)
+< 2.356194
+ {only available when compiled with|+float|}
+
+
*browse()*
browse({save}, {title}, {initdir}, {default})
Put up a file requester. This only works when "has("browse")"
@@ -2355,6 +2405,18 @@ cos({expr}) *cos()*
< -0.646043
{only available when compiled with the |+float| feature}
+
+cosh({expr}) *cosh()*
+ Return the hyperbolic cosine of {expr} as a|Float|in the range
+ [1, inf].
+ {expr} must evaluate to a|Float|or a|Number|.
+ Examples: >
+ :echo cosh(0.5)
+< 1.127626 >
+ :echo cosh(-0.5)
+< -1.127626
+ {only available when compiled with|+float|}
+
count({comp}, {expr} [, {ic} [, {start}]]) *count()*
Return the number of times an item with value {expr} appears
@@ -2615,6 +2677,18 @@ exists({expr}) The result is a Number, which is non-zero if {expr} is
< This doesn't check for existence of the "bufcount" variable,
but gets the value of "bufcount", and checks if that exists.
+exp({expr}) *exp()*
+ Return the exponential of {expr} as a|Float|in the range
+ [0, inf].
+ {expr} must evaluate to a|Float|or a|Number|.
+ Examples: >
+ :echo exp(2)
+< 7.389056 >
+ :echo exp(-1)
+< 0.367879
+ {only available when compiled with|+float|}
+
+
expand({expr} [, {flag}]) *expand()*
Expand wildcards and the following special keywords in {expr}.
The result is a String.
@@ -2847,6 +2921,23 @@ floor({expr}) *floor()*
< 4.0
{only available when compiled with the |+float| feature}
+
+fmod({expr1}, {expr2}) *fmod()*
+ Return the remainder of {expr1} / {expr2}, even if the
+ division is not representable. Returns {expr1} - i * {expr2}
+ for some integer i such that if {expr2} is non-zero, the
+ result has the same sign as {expr1} and magnitude less than
+ the magnitude of {expr2}. If {expr2} is zero, the value
+ returned is zero. The value returned is a|Float|.
+ {expr1} and {expr2} must evaluate to a|Float|or a|Number|.
+ Examples: >
+ :echo fmod(12.33, 1.22)
+< 0.13 >
+ :echo fmod(-12.33, 1.22)
+< -0.13
+ {only available when compiled with|+float|}
+
+
fnameescape({string}) *fnameescape()*
Escape {string} for use as file name command argument. All
characters that have a special meaning, such as '%' and '|'
@@ -3802,6 +3893,18 @@ localtime() *localtime()*
1970. See also |strftime()| and |getftime()|.
+log({expr}) *log()*
+ Return the natural logarithm (base e) of {expr} as a|Float|.
+ {expr} must evaluate to a|Float|or a|Number|in the range
+ (0, inf].
+ Examples: >
+ :echo log(10)
+< 2.302585 >
+ :echo log(exp(5))
+< 5.0
+ {only available when compiled with|+float|}
+
+
log10({expr}) *log10()*
Return the logarithm of Float {expr} to base 10 as a |Float|.
{expr} must evaluate to a |Float| or a |Number|.
@@ -5076,6 +5179,18 @@ sin({expr}) *sin()*
{only available when compiled with the |+float| feature}
+sinh({expr}) *sinh()*
+ Return the hyperbolic sine of {expr} as a|Float|in the range
+ [-inf, inf].
+ {expr} must evaluate to a|Float|or a|Number|.
+ Examples: >
+ :echo sinh(0.5)
+< 0.521095 >
+ :echo sinh(-0.9)
+< -1.026517
+ {only available when compiled with|+float|}
+
+
sort({list} [, {func}]) *sort()* *E702*
Sort the items in {list} in-place. Returns {list}. If you
want a list to remain unmodified make a copy first: >
@@ -5555,6 +5670,31 @@ tempname() *tempname()* *temp-file-name*
For MS-Windows forward slashes are used when the 'shellslash'
option is set or when 'shellcmdflag' starts with '-'.
+
+tan({expr}) *tan()*
+ Return the tangent of {expr}, measured in radians, as a|Float|
+ in the range [-inf, inf].
+ {expr} must evaluate to a|Float|or a|Number|.
+ Examples: >
+ :echo tan(10)
+< 0.648361 >
+ :echo tan(-4.01)
+< -1.181502
+ {only available when compiled with|+float|}
+
+
+tanh({expr}) *tanh()*
+ Return the hyperbolic tangent of {expr} as a|Float|in the
+ range [-1, 1].
+ {expr} must evaluate to a|Float|or a|Number|.
+ Examples: >
+ :echo tanh(0.5)
+< 0.462117 >
+ :echo tanh(-1)
+< -0.761594
+ {only available when compiled with|+float|}
+
+
tolower({expr}) *tolower()*
The result is a copy of the String given, with all uppercase
characters turned into lowercase (just like applying |gu| to
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 9898f19ec..6b448e13b 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -4142,6 +4142,8 @@ E817 editing.txt /*E817*
E818 editing.txt /*E818*
E819 editing.txt /*E819*
E82 message.txt /*E82*
+E820 editing.txt /*E820*
+E821 options.txt /*E821*
E83 message.txt /*E83*
E84 windows.txt /*E84*
E85 options.txt /*E85*
@@ -4547,6 +4549,7 @@ abandon editing.txt /*abandon*
abbreviations map.txt /*abbreviations*
abel.vim syntax.txt /*abel.vim*
abs() eval.txt /*abs()*
+acos() eval.txt /*acos()*
active-buffer windows.txt /*active-buffer*
ada#Create_Tags() ft_ada.txt /*ada#Create_Tags()*
ada#Jump_Tag() ft_ada.txt /*ada#Jump_Tag()*
@@ -4611,11 +4614,13 @@ arglist-quit usr_07.txt /*arglist-quit*
argument-list editing.txt /*argument-list*
argv() eval.txt /*argv()*
as motion.txt /*as*
+asin() eval.txt /*asin()*
asm.vim syntax.txt /*asm.vim*
asm68k syntax.txt /*asm68k*
asmh8300.vim syntax.txt /*asmh8300.vim*
at motion.txt /*at*
atan() eval.txt /*atan()*
+atan2() eval.txt /*atan2()*
athena-intellimouse gui.txt /*athena-intellimouse*
attr-list syntax.txt /*attr-list*
author intro.txt /*author*
@@ -4938,6 +4943,7 @@ copy-move change.txt /*copy-move*
copying uganda.txt /*copying*
copyright uganda.txt /*copyright*
cos() eval.txt /*cos()*
+cosh() eval.txt /*cosh()*
count intro.txt /*count*
count() eval.txt /*count()*
count-bytes tips.txt /*count-bytes*
@@ -5258,6 +5264,7 @@ executable() eval.txt /*executable()*
execute-menus gui.txt /*execute-menus*
exim starting.txt /*exim*
exists() eval.txt /*exists()*
+exp() eval.txt /*exp()*
expand() eval.txt /*expand()*
expand-env options.txt /*expand-env*
expand-environment-var options.txt /*expand-environment-var*
@@ -5388,6 +5395,7 @@ float2nr() eval.txt /*float2nr()*
floating-point-format eval.txt /*floating-point-format*
floating-point-precision eval.txt /*floating-point-precision*
floor() eval.txt /*floor()*
+fmod() eval.txt /*fmod()*
fname_diff-variable eval.txt /*fname_diff-variable*
fname_in-variable eval.txt /*fname_in-variable*
fname_new-variable eval.txt /*fname_new-variable*
@@ -6338,6 +6346,7 @@ locale-name mbyte.txt /*locale-name*
localtime() eval.txt /*localtime()*
location-list quickfix.txt /*location-list*
location-list-window quickfix.txt /*location-list-window*
+log() eval.txt /*log()*
log10() eval.txt /*log10()*
long-lines version5.txt /*long-lines*
lowercase change.txt /*lowercase*
@@ -7255,6 +7264,7 @@ simplify() eval.txt /*simplify()*
simulated-command vi_diff.txt /*simulated-command*
sin() eval.txt /*sin()*
single-repeat repeat.txt /*single-repeat*
+sinh() eval.txt /*sinh()*
skeleton autocmd.txt /*skeleton*
slice eval.txt /*slice*
slow-fast-terminal term.txt /*slow-fast-terminal*
@@ -7688,6 +7698,8 @@ tags-file-format tagsrch.txt /*tags-file-format*
tags-option tagsrch.txt /*tags-option*
tagsrch.txt tagsrch.txt /*tagsrch.txt*
tagstack tagsrch.txt /*tagstack*
+tan() eval.txt /*tan()*
+tanh() eval.txt /*tanh()*
tar pi_tar.txt /*tar*
tar-contents pi_tar.txt /*tar-contents*
tar-copyright pi_tar.txt /*tar-copyright*
@@ -8059,6 +8071,7 @@ version-6.1 version6.txt /*version-6.1*
version-6.2 version6.txt /*version-6.2*
version-6.3 version6.txt /*version-6.3*
version-6.4 version6.txt /*version-6.4*
+version-7.0 version7.txt /*version-7.0*
version-7.1 version7.txt /*version-7.1*
version-7.2 version7.txt /*version-7.2*
version-7.3 version7.txt /*version-7.3*
@@ -8066,6 +8079,10 @@ version-variable eval.txt /*version-variable*
version4.txt version4.txt /*version4.txt*
version5.txt version5.txt /*version5.txt*
version6.txt version6.txt /*version6.txt*
+version7.0 version7.txt /*version7.0*
+version7.1 version7.txt /*version7.1*
+version7.2 version7.txt /*version7.2*
+version7.3 version7.txt /*version7.3*
version7.txt version7.txt /*version7.txt*
vi intro.txt /*vi*
vi-differences vi_diff.txt /*vi-differences*
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 2a0ce6574..b24749a7f 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -30,8 +30,6 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs*
-------------------- Known bugs and current work -----------------------
-Include cabal and obj syntax files. (Vincent Berthoux, 2010 May 16)
-
Cursor positioning wrong with 0x200e character. (John Becket, 2010 May 6)
E315 when trying to change a file in FileChangedRO autocommand event.
@@ -1087,10 +1085,15 @@ Patches to include:
- gettabvar() and settabvar() functions. (Yegappan Lakshmanan, 2010 May 14)
- Patch to support netbeans in Unix console Vim. (Xavier de Gaye, 2009 Apr
26) Now with Mercurial repository (2010 Jan 2)
+- More float functions. (Bill McCarthy)
+ ~/tmp/eval.diff
+ http://groups.google.com/group/vim_dev/browse_thread/thread/de192817983abb54
+- Include conceal patch?
+ http://vince.negri.googlepages.com/
+ http://vim.wikia.com/wiki/Patch_to_conceal_parts_of_lines
- Patch for Lisp support with ECL (Mikael Jansson, 2008 Oct 25)
- Minor patches from Dominique Pelle, 2010 May 15
- Gvimext patch to support wide file names. (Szabolcs Horvat 2008 Sep 10)
-- More float functions.
- Patch to support netbeans for Mac. (Kazuki Sakamoto, 2009 Jun 25)
- Patch to support clipboard for Mac terminal. (Jjgod Jiang, 2009 Aug 1)
- Patch to support :browse for more commands. (Lech Lorens, 2009 Jul 18)
diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt
index ea466cee9..4ba7aeea7 100644
--- a/runtime/doc/version7.txt
+++ b/runtime/doc/version7.txt
@@ -7184,6 +7184,9 @@ Mostly by Moshin Ahmed.
Support GDK_SUPER_MASK for GTK on Mac. (Stephan Schulz)
+More floating point functions: acos(), asin(), atan2(), cosh(), exp(), fmod(),
+log(), sinh(), tan(), tanh(). (Bill McCarthy)
+
Fixed *fixed-7.3*
-----
diff --git a/runtime/syntax/cabal.vim b/runtime/syntax/cabal.vim
index 2a92aa835..4130bac89 100644
--- a/runtime/syntax/cabal.vim
+++ b/runtime/syntax/cabal.vim
@@ -2,6 +2,7 @@
" Language: Haskell Cabal Build file
" Maintainer: Vincent Berthoux <twinside@gmail.com>
" File Types: .cabal
+" Last Change: 2010 May 18
" v1.3: Updated to the last version of cabal
" Added more highlighting for cabal function, true/false
" and version number. Also added missing comment highlighting.
diff --git a/runtime/syntax/obj.vim b/runtime/syntax/obj.vim
index 3e2b438f1..66cd6c2bd 100644
--- a/runtime/syntax/obj.vim
+++ b/runtime/syntax/obj.vim
@@ -2,6 +2,7 @@
" Language: 3D wavefront's obj file
" Maintainer: Vincent Berthoux <twinside@gmail.com>
" File Types: .obj (used in 3D)
+" Last Change: 2010 May 18
"
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded