mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 03:57:21 +00:00
Add untrunc operator, the mirror of trunc (#3994)
This commit is contained in:
parent
58cb300a0a
commit
62829dc9d3
@ -43,6 +43,10 @@ exports.trunc = makeNumericBinaryOperator(
|
||||
function(a) {return Math.trunc(a)}
|
||||
);
|
||||
|
||||
exports.untrunc = makeNumericBinaryOperator(
|
||||
function(a) {return Math.ceil(Math.abs(a)) * Math.sign(a)}
|
||||
);
|
||||
|
||||
exports.sign = makeNumericBinaryOperator(
|
||||
function(a) {return Math.sign(a)}
|
||||
);
|
||||
|
@ -9,7 +9,7 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
!! Major Improvements
|
||||
|
||||
Added several new [[Mathematics Operators]] for working with numbers: [[negate|negate Operator]], [[abs|abs Operator]], [[ceil|ceil Operator]], [[floor|floor Operator]], [[round|round Operator]], [[trunc|trunc Operator]], [[sign|sign Operator]], [[add|add Operator]], [[subtract|subtract Operator]], [[multiply|multiply Operator]], [[divide|divide Operator]], [[remainder|remainder Operator]], [[max|max Operator]], [[min|min Operator]], [[fixed|fixed Operator]], [[precision|precision Operator]], [[exponential|exponential Operator]], [[sum|sum Operator]], [[product|product Operator]], [[maxall|maxall Operator]] and [[minall|minall Operator]].
|
||||
Added several new [[Mathematics Operators]] for working with numbers: [[negate|negate Operator]], [[abs|abs Operator]], [[ceil|ceil Operator]], [[floor|floor Operator]], [[round|round Operator]], [[trunc|trunc Operator]], [[untrunc|untrunc Operator]], [[sign|sign Operator]], [[add|add Operator]], [[subtract|subtract Operator]], [[multiply|multiply Operator]], [[divide|divide Operator]], [[remainder|remainder Operator]], [[max|max Operator]], [[min|min Operator]], [[fixed|fixed Operator]], [[precision|precision Operator]], [[exponential|exponential Operator]], [[sum|sum Operator]], [[product|product Operator]], [[maxall|maxall Operator]] and [[minall|minall Operator]].
|
||||
|
||||
Added several new string operators: [[length|length Operator]], [[uppercase|uppercase Operator]], [[lowercase|lowercase Operator]], [[trim|trim Operator]], [[split|split Operator]], [[splitregexp|split Operator]] and [[join|join Operator]].
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
created: 20190617162921280
|
||||
modified: 20190617162921280
|
||||
tags: [[untrunc Operator]] [[Operator Examples]]
|
||||
title: untrunc Operator (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.operator-example 1 "[[1.6]untrunc[]]">>
|
||||
<<.operator-example 2 "[[-1.6]untrunc[]]">>
|
||||
<<.operator-example 3 "=-1.2 =-2.4 =3.6 =4.8 =5.1 +[untrunc[]]">>
|
@ -10,4 +10,6 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.1.20">> See [[Mathematics Operators]] for an overview.
|
||||
|
||||
<<.tip " The trunc operator rounds towards zero. To round away from zero, use [[untrunc|untrunc Operator]].">>
|
||||
|
||||
<<.operator-examples "trunc">>
|
||||
|
15
editions/tw5.com/tiddlers/filters/untrunc Operator.tid
Normal file
15
editions/tw5.com/tiddlers/filters/untrunc Operator.tid
Normal file
@ -0,0 +1,15 @@
|
||||
caption: untrunc
|
||||
created: 20190617163327756
|
||||
modified: 20190617163327756
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: rounds each of the input numbers to the next integer with largest absolute value, that is, away from zero
|
||||
op-purpose: rounds a list of numbers to the next integer with largest absolute value, that is, away from zero
|
||||
tags: [[Unary Mathematics Operators]] [[Filter Operators]] [[Mathematics Operators]]
|
||||
title: untrunc Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.1.20">> See [[Mathematics Operators]] for an overview.
|
||||
|
||||
<<.tip " This is the inverse operation of [[trunc|trunc Operator]]: trunc rounds to zero, but untrunc rounds away from zero.">>
|
||||
|
||||
<<.operator-examples "untrunc">>
|
Loading…
Reference in New Issue
Block a user