<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Doings &#187; unix</title>
	<atom:link href="http://do-boy.com/doings/category/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://do-boy.com/doings</link>
	<description>What a do-boy does</description>
	<lastBuildDate>Thu, 12 Aug 2010 16:20:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>bc Extensions</title>
		<link>http://do-boy.com/doings/2010/03/11/bc-extensions/</link>
		<comments>http://do-boy.com/doings/2010/03/11/bc-extensions/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 23:47:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[hack]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://do-boy.com/doings/?p=49</guid>
		<description><![CDATA[More often than not, if I have to do any calculations from my laptop, I eschew the very fine GUI application PCalc in favor of bc on the command line. I also like to use the extended version, bc -l to get decimal places in my result. Like most bc enthusiasts, I have this aliased [...]]]></description>
			<content:encoded><![CDATA[<p>More often than not, if I have to do any calculations from my laptop, I eschew the very fine GUI application <a href="http://www.pcalc.com/">PCalc</a> in favor of <code>bc</code> on the command line. I also like to use the extended version, <code>bc -l</code> to get decimal places in my result.</p>
<p>Like most bc enthusiasts, I have this aliased in my <code>.bash_profile</code> file like so:</p>
<p><code>alias bc='bc -l'</code></p>
<p>But if you&#8217;re a bc nerd, this probably isn&#8217;t enough; you also want to pre-define functions and have a bunch of scientific constants, too. There&#8217;s a pretty standard <code>extensions.bc</code> file out there, and you can get it from the straight from the <a href="http://x-bc.sourceforge.net/">open-source project</a>: first <a href="http://x-bc.sourceforge.net/extensions_bc.html">a buncha functions</a>, then the <a href="http://x-bc.sourceforge.net/scientific_constants_bc.html">scientific constants</a>.</p>
<p>The usual way is to include these when you run bc, so your alias in <code>.bash_profile</code> becomes</p>
<p><code>alias bc='bc -l /PATH_TO/extensions.bc /PATH_TO/scientific_constants.bc'</code></p>
<p>After a while, I know I&#8217;ll forget where my bc extensions files are, so I include a message in my alias:</p>
<p><code>echo "Using bc -l with extensions in /PATH_TO/"</code></p>
<p>So my alias is</p>
<p><code>alias bc='echo "Using bc -l with extensions in /PATH_TO/";bc -l /PATH_TO/extensions.bc /PATH_TO/scientific_constants.bc'</code></p>
<p>Now every time I run bc, I see</p>
<p><code>Using bc -l with extensions in /PATH_TO/<br />
bc 1.06<br />
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.<br />
This is free software with ABSOLUTELY NO WARRANTY.<br />
For details type `warranty'.</code></p>
<p>And that way I can remember why it works just the way I want it to.</p>
]]></content:encoded>
			<wfw:commentRss>http://do-boy.com/doings/2010/03/11/bc-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
