Added documentation and tests for new inf, -inf and nan symbols.
h3rald h3rald@h3rald.com
Fri, 27 Oct 2017 20:17:37 +0200
4 files changed,
15 insertions(+),
4 deletions(-)
M
min.vim
→
min.vim
@@ -11,7 +11,7 @@
setl iskeyword=@,36-39,+,-,/,*,.,:,~,!,48-57,60-65,94-95,192-255 setl iskeyword+=^ -syntax keyword minDefaultSymbol ! != $ & ' * + # - % ^ -> . .. / : < <= == => =~ > >= @ ROOT aes all? and any? append apply args ask atime bind bool boolean? call call! capitalize case cd chmod choose clear-stack cleave column-print concat confirm cons cp cpu crypto ctime datetime ddel debug decode define defined? delete dget dhas? dkeys dictionary? dip dir? dirname div dpick dprint dprint! dset dsort dup dvalues encode env? error eval even? exists? exit expect fappend fatal find file? filename filter first flatten float float? foreach fperms fread from-json format-error fs fsize fstats ftype fwrite get gets get-env get-stack hardlink harvest hidden? id if import in? indent indexof info insert int integer? interpolate interval io join keep last length linrec load load-symbol logic loglevel loglevel? lowercase ls ls-r map map-reduce match md5 mkdir mod module module-symbols module-sigils mtime mv newline nip not notice now num number? odd? opts os over partition password pick pop popd pred prepend print print! prompt publish puts puts! put-env q quotation? quote quote-bind quote-define random raise reduce regex reject remove remove-symbol repeat replace rest reverse rm rmdir run save-symbol scope scope? seal search seq set set-stack sha1 sha224 sha256 sha384 sha512 shorten sigils sip size sleep slice sort source split spread stack startup stored-symbols str string string? strip succ sum swap swons symbols symlink symlink? sys system take tap tap! tformat time timeinfo times timestamp titleize to-json to-timestamp try dequote uppercase unzip version warn when which while with xor zip +syntax keyword minDefaultSymbol ! != $ & ' * + # - % ^ -> . .. / : < <= == => =~ > >= @ -inf ROOT aes all? and any? append apply args ask atime bind bool boolean? call call! capitalize case cd chmod choose clear-stack cleave column-print concat confirm cons cp cpu crypto ctime datetime ddel debug decode define defined? delete dget dhas? dkeys dictionary? dip dir? dirname div dpick dprint dprint! dset dsort dup dvalues encode env? error eval even? exists? exit expect fappend fatal find file? filename filter first flatten float float? foreach fperms fread from-json format-error fs fsize fstats ftype fwrite get gets get-env get-stack hardlink harvest hidden? id if import in? indent indexof inf info insert int integer? interpolate interval io join keep last length linrec load load-symbol logic loglevel loglevel? lowercase ls ls-r map map-reduce match md5 mkdir mod module module-symbols module-sigils mtime mv nan newline nip not notice now num number? odd? opts os over partition password pick pop popd pred prepend print print! prompt publish puts puts! put-env q quotation? quote quote-bind quote-define random raise reduce regex reject remove remove-symbol repeat replace rest reverse rm rmdir run save-symbol scope scope? seal search seq set set-stack sha1 sha224 sha256 sha384 sha512 shorten sigils sip size sleep slice sort source split spread stack startup stored-symbols str string string? strip succ sum swap swons symbols symlink symlink? sys system take tap tap! tformat time timeinfo times timestamp titleize to-json to-timestamp try dequote uppercase unzip version warn when which while with xor zip syntax match minDefaultSigil ;\<[:@'~!?$%&$=<>#^*#+/]; contained
M
site/contents/_includes/_reference-num.md
→
site/contents/_includes/_reference-num.md
@@ -7,6 +7,9 @@
{#op||-||{{n1}} {{n2}}||{{n3}}|| Subtracts {{n2}} from {{n1}}. #} +{#op||-inf||{{null}}||{{n}}|| +Returns negative infinity. #} + {#op||\*||{{n1}} {{n2}}||{{n3}}|| Multiplies {{n1}} by {{n2}}. #}@@ -19,8 +22,14 @@
{#op||div||{{i1}} {{i2}}||{{i3}}|| Divides {{i1}} by {{i2}} (integer division). #} +{#op||inf||{{null}}||{{n}}|| +Returns infinity. #} + {#op||mod||{{i1}} {{i2}}||{{i3}}|| Returns the integer module of {{i1}} divided by {{i2}}. #} + +{#op||nan||{{null}}||nan|| +Returns **NaN** (not a number). #} {#op||odd?||{{i}}||{{b}}|| Returns {{t}} if {{i}} is odd, {{f}} otherwise. #}
M
site/contents/_includes/_reference.md
→
site/contents/_includes/_reference.md
@@ -82,9 +82,6 @@ : true (boolean type).
{{f}} : false (boolean type) -#### Floating point -Floating point in computers is always problematic. Min has three constants <code>nan</code>, <code>inf</code>, and <code>ninf</code> to deal with some of the edge cases and it implements a more forgiving equality check for floating point values to avoid rounding errors. This check also allows <code>nan</code> to be compared with any other <code>nan</code> and return true. - ### Suffixes The following suffixes can be placed at the end of a value or type to indicate ordering or quantities.
M
tests/logic.min
→
tests/logic.min
@@ -132,5 +132,10 @@ (true quotation? false ==) assert
(false quotation? false ==) assert (("a" 2 c) quotation?) assert + (7 0 / inf ==) assert + (-7 0 / -inf ==) assert + (0 0 / nan ==) assert + (10 3 / 3.33333 ==) assert + report clear-stack