Arithmetic/Integer: Difference between revisions

SNUSP
(SNUSP)
Line 520:
print ("~a = " ^ Int.toString (~a) ^ "\n") (* unary negation, unusual notation compared to other languages *)
end</lang>
 
=={{header|SNUSP}}==
As a BF derivative, SNUSP only has increment and decrement as native operations. Here are routines for other basic arithmetic upon single digit numbers and results.
<lang SNUSP>
$\
,
@
\=@@@-@-----# atoi
>
,
@
\=@@@-@-----#
<
@ # 4 copies
\=!/?!/->>+>>+>>+>>+<<<<<<<<?\#
> | #\?<<<<<<<<+>>+>>+>>+>>-/
@ |
\==/
\>>>>\
/>>>>/
@
\==!/===?\# add
< \>+<-/
@
\=@@@+@+++++# itoa
.
<
@
\==!/===?\# subtract
< \>-<-/
@
\=@@@+@+++++#
.
!
/\
?- multiply
\/ #/?<<+>+>-==\ /==-<+<+>>?\# /==-<<+>>?\#
< \->+>+<<!/?/# #\?\!>>+<+<-/ #\?\!>>+<<-/
@ /==|=========|=====\ /-\ |
\======<?!/>@/<-?!\>>>@/<<<-?\=>!\?/>!/@/<#
< \=======|==========/ /-\ |
@ \done======>>>!\?/<=/
\=@@@+@+++++#
.
!
/\
?- zero
\/
< divmod
@ /-\
\?\<!\?/#!===+<<<\ /-\
| \<==@\>@\>>!/?!/=<?\>!\?/<<#
| | | #\->->+</
| \=!\=?!/->>+<<?\#
@ #\?<<+>>-/
\=@@@+@+++++#
.
<
@
\=@@@+@+++++#
.
#
</lang>
 
=={{header|Tcl}}==
Anonymous user