Place the following code in a tiddler on tiddlywiki.com to see “The mathematics remainder operator is incorrect, it is a modulo operator”
- We also do not have the complement to the correct remainder operator the simple integer or int.
[Edited] The above .remainder operator needs work to cope with numbers that may not contain a period, ie whole numbers.
\function .int() [split[.]first[]]
\function .remainder() [split[.]last[]addprefix[.]]
\function .modulo(a) [divide<b>.remainder[]multiply<b>round[]]
\procedure analysis(a b)
;For a=<<a>>, b=<<b>>
# a divide b {{{ [<a>divide<b>] }}}
## Ceil {{{ [<a>divide<b>ceil[]] }}}
## .Int {{{ [<a>divide<b>.int[]] }}}
## .remainder {{{ [<a>divide<b>.remainder[]] }}}
# a remainder b {{{ [<a>remainder<b>] }}}
## a modulo b {{{ [<a>.modulo<b>] }}}
\end
<<analysis 100 3>>
<<analysis 100 6>>
- Further see my custom operators with a leading
.
for comparison.
Questions
- Is my assertion correct?
- what if anything can we do to fix this?
- How do we maintain backward compatibility with an error?
- Shall we make/fix the int/remainder operators?