Talk:Dc (computer program): Difference between revisions

Content deleted Content added
No edit summary
m Fixed Lint errors on this page (obsolete/unclosed tags)
 
(23 intermediate revisions by 18 users not shown)
Line 1:
{{WikiProject banner shell|class=C|1=
{{WikiProject Software|importance=Low}}
{{WikiProject Computing|importance=Low |early-comp=y |early-comp-importance=Low |software=y |software-importance=Low}}
{{WikiProject Linux|importance=Low}}
}}{{lowercase title}}
 
==Untitled==
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}}<br /tt>
 
You miss-typed the example, the correct one is <br />
Why don't you want to modify? Anonymouse, 14 Apr 2009
{{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 />
{{mono|1=[q]sa[ln0=aln80~Psnlbx]16isb572CCB9AE9DB03273snlbxq}}
 
: It encodes the email address in the hex constant {{mono|1=n=0x572CCB9AE9DB03273}} and operates on it with the macro {{mono|1=b}} defined as {{mono|1=[ln0=aln80~Psnlbx]}}. This recursively calls itself until {{mono|1=n}} 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: {{mono|1=[q]sa[d0=a80~anlbx]16isb572CCB9AE9DB03273lbxq}}. 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: {{mono|1=(echo -n "0123456789" | xxd -p -u -c 1; echo 0) | dc -"16i0[80?d0!=x*+]dsxx10op"}} (for Bash...and using GNU dc where != is accepted). For the string "Wikipedia", the constant is: {{mono|1=30E9C997869D7A6B80}} [[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 15 ⟶ 36:
 
I believe that this is slightly incomplete. Wouldn't it be better to specify the original implementation language, rather than giving a hint at which one it is ''not?'' --[[User:Blazar|Blazar]].[[User_talk:Blazar|writeto()]] 14:39, 2 August 2008 (UTC)
 
:: A dc prototype for PDP-7 Unix was written in B. [http://plan9.bell-labs.com/who/dmr/chist.html][http://cm.bell-labs.com/cm/cs/who/dmr/hist.html] Dc was written in assembly in V6. [http://www.bsdlover.cn/study/UnixTree/V6/usr/source/s1/index.html] It was rewritten in C for V7. [http://www.bsdlover.cn/study/UnixTree/V7/usr/src/cmd/dc/index.html] [http://plan9.bell-labs.com/sources/plan9/sys/src/cmd/dc.c The Plan 9 version] is essentially the same as the V7 version with a few small changes to accommodate the new C compiler. [[Special:Contributions/70.225.161.132|70.225.161.132]] ([[User talk:70.225.161.132|talk]]) 06:27, 27 March 2011 (UTC)
 
== Typo(s) ==
 
There is a typo (or rather, a grammar mistake) in the article's "Input/Output" section: It says "... will affect the parsing of ''the'' every numeric value ..."—in my opinion, the second "the" is wrong, but I cannot change it myself as the article is protected. Would some registered user correct this, please?--[[Special:Contributions/131.152.224.31|131.152.224.31]] ([[User talk:131.152.224.31|talk]]) 14:33, 29 September 2011 (UTC)
 
Oops, obviously, it is not protected. I'm gonna change it myself. Cheers!--[[Special:Contributions/131.152.224.31|131.152.224.31]] ([[User talk:131.152.224.31|talk]]) 14:34, 29 September 2011 (UTC)
 
== Examples ==
 
A commented version is slightly easier to understand ...
 
This example, Perl source containing embedded dc source, was formatted with language-specific, syntax-aware color coding. While I personally find that the jarring color shifts make source code almost unreadable, I would have left this style in place were it not already meaningless:
 
# The Wikipedia renderer doesn't have a style for “dc” source at all.
# The renderer doesn't handle nested source.
# The renderer doesn't handle multiple languages in one block of code.
# All the dc source, which (in this article on dc) is the whole point of the example, was rendered in one uniform color as being a single Perl function argument.
 
Since the colors only distracted from the dc example by highlighting the Perl code, I'm dropping those colors, leaving the dc and Perl source unchanged.
[[Special:Contributions/206.205.52.162|206.205.52.162]] ([[User talk:206.205.52.162|talk]]) 16:50, 19 April 2013 (UTC)
 
: Some more examples of bad coloring needed attention. Editors, in this article about dc, it isn't clearly an improvement to try to color-code <u>dc source</u> using the Perl style, or the bash style, or any other unrelated style. [[Special:Contributions/50.181.30.121|50.181.30.121]] ([[User talk:50.181.30.121|talk]]) 23:54, 24 April 2014 (UTC)
 
== External links modified ==
 
Hello fellow Wikipedians,
 
I have just modified {{plural:1|one external link|1 external links}} on [[Dc (computer program)]]. Please take a moment to review [https://en.wikipedia.org/w/index.php?diff=prev&oldid=753743945 my edit]. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit [[User:Cyberpower678/FaQs#InternetArchiveBot|this simple FaQ]] for additional information. I made the following changes:
*Added archive https://web.archive.org/web/20150408054606/http://cm.bell-labs.com/cm/cs/who/dmr/hist.html to http://cm.bell-labs.com/cm/cs/who/dmr/hist.html
 
When you have finished reviewing my changes, please set the ''checked'' parameter below to '''true''' or '''failed''' to let others know (documentation at {{tlx|Sourcecheck}}).
 
{{sourcecheck|checked=true}}
 
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)