Arithmetic/Integer: Difference between revisions
Content added Content deleted
(SNUSP) |
|||
Line 520: | Line 520: | ||
print ("~a = " ^ Int.toString (~a) ^ "\n") (* unary negation, unusual notation compared to other languages *) |
print ("~a = " ^ Int.toString (~a) ^ "\n") (* unary negation, unusual notation compared to other languages *) |
||
end</lang> |
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}}== |
=={{header|Tcl}}== |