Talk:Dc (computer program): Difference between revisions

Content deleted Content added
Assessment: Software: class=C, importance=Low; +Computing: class=C, importance=Low, early-comp=y, early-comp-importance=Low, software=y, software-importance=Low; +Linux: class=C, importance=Low (assisted)
m Fixed Lint errors on this page (obsolete/unclosed tags)
 
(5 intermediate revisions by 4 users not shown)
Line 1:
{{WikiProject Linuxbanner shell|class=C |importance1=Low}}
{{lowercase title}}
{{WikiProject Software |class=C |importance=Low}}
{{WikiProject Computing |class=C |importance=Low |early-comp=y |early-comp-importance=Low |software=y |software-importance=Low}}
{{WikiProject Linux|importance=Low}}
}}{{lowercase title}}
 
==Untitled==
{{WikiProject Computing |class=C |importance=Low |early-comp=y |early-comp-importance=Low |software=y |software-importance=Low}}
{{WikiProject Linux |class=C |importance=Low}}
I have been unable to find any libraries of functions for 'dc' (e.g., log, sin, etc). If someone finds some, please add external links.
 
Wouldn't it be better to use an example that actually works? Because when I type <br/>
<tt>{{mono|1=12 3 4 ^ + _11 / v 22 -</tt>}}<br/>
I get<br/>
<tt>{{mono|1=dc: square root of negative number</tt>}}<br />
 
You miss-typed the example, the correct one is <br />
{{mono|1= 12 _3 4 ^ + 11 / v 22 -}}<br/>
After command {{mono|1=p}} you get<br />
{{mono|1=-20}} [[User:Annie Yousar|Annie Yousar]] ([[User talk:Annie Yousar|talk]]) 14:14, 15 March 2025 (UTC)
 
== Explanation ==
Can someone explain how the following works?<br />
<tt>{{mono|1=[q]sa[ln0=aln80~Psnlbx]16isb572CCB9AE9DB03273snlbxq</tt>}}
 
: It encodes the email address in the hex constant <tt>{{mono|1=n=0x572CCB9AE9DB03273</tt>}} and operates on it with the macro <tt>{{mono|1=b</tt>}} defined as <tt>{{mono|1=[ln0=aln80~Psnlbx]</tt>}}. This recursively calls itself until <tt>{{mono|1=n</tt>}} is equal to zero. -- [[User:Autopilot|Autopilot]] ([[User talk:Autopilot|talk]]) 22:44, 15 May 2010 (UTC)
 
: Just did a small optimization (in code length) to it: <tt>{{mono|1=[q]sa[d0=a80~anlbx]16isb572CCB9AE9DB03273lbxq</tt>}}. Could anyone help writing another dc code to generate that hexadecimal number? I think it will be a good idea to add them, in pair, as an example of string handling in dc which is not yet covered by other examples. [[User:Billyauhk|Billyauhk]] ([[User talk:Billyauhk|talk]]) 08:08, 26 July 2011 (UTC)
 
: : Sorry but I forgotten that we cannot construct a string in dc...but I have just figured out the way to construct the constant: <tt>{{mono|1=(echo -n "0123456789" | xxd -p -u -c 1; echo 0) | dc -"16i0[80?d0!=x*+]dsxx10op"</tt>}} (for Bash...and using GNU dc where != is accepted). For the string "Wikipedia", the constant is: <tt>{{mono|1=30E9C997869D7A6B80</tt>}} [[User:Billyauhk|Billyauhk]] ([[User talk:Billyauhk|talk]]) 10:51, 26 July 2011 (UTC)
::Billyaukh missed the "e" in dc -e "16i0[80?d0!=x*+]dsxx10op" [[User:Annie Yousar|Annie Yousar]] ([[User talk:Annie Yousar|talk]]) 11:46, 2 February 2025 (UTC)
 
== Original implementation language? ==
Line 65 ⟶ 73:
 
Cheers.—[[User:InternetArchiveBot|'''<span style="color:darkgrey;font-family:monospace">InternetArchiveBot</span>''']] <span style="color:green;font-family:Rockwell">([[User talk:InternetArchiveBot|Report bug]])</span> 22:52, 8 December 2016 (UTC)
 
== Name of the default register? ==
 
(named) Register = Stack of Arrays
 
So I can access a named register's TOS array via ":" and ";". This is fine. But I've an idea for something to code which massively would benefit if I could access the default register in the same way. So does it have a hidden name?
 
I'll read the source, if my impatience wins over my patience ... [[Special:Contributions/2003:DD:6F34:8975:F4A0:F975:5A7:A98E|2003:DD:6F34:8975:F4A0:F975:5A7:A98E]] ([[User talk:2003:DD:6F34:8975:F4A0:F975:5A7:A98E|talk]]) 12:33, 16 February 2025 (UTC)