Blogs

Comparing Floating-Point Values in C++

Tags:

Here is a C++ implementation of the AlmostEqual2sComplement algorithm from "Comparing Floating Point Numbers" by Bruce Dawson. The implementation comes from the Google C++ Test Framework (Copyright 2005, Google Inc. All rights reserved, authors Zhanyong Wan and Sean Mcafee), so nothing here is original. I like the way it uses uniquely C++ idioms to produce a subtly elegant result.

Writing IEEE Floating-Point C++ Data as Decimal Text

Tags:

Here are my notes on writing floating-point binary data as decimal strings, including within XML nodes. My concern is with IEEE 754-2008 Floating-Point binary values, and really only with the single- (C/C++ float) and double-precision (C/C++ double) forms, not the extended forms.

Avoiding Round-Off Errors in the Round Trip

Using std::copy for STL Container Output and Input

Tags:

Here are a couple of concise constructs that come in handy when debugging C++ code involving STL containers.

Output

The following line of code prints the contents of an STL container cont whose value_type is T to the std::cout stream, where each element is separated by a space.

#include <algorithm>
#include <iterator>
#include <iostream>
 
std::copy(cont.begin(), cont.end(), std::ostream_iterator<T>(std::cout, " "));

Name Change

After doing business as Dynamic Software Solutions for 10 years I have decided to create a limited liability corporation under which to do business. My new business name is Working Software, LLC. Everything else is the same. Except now nobody else in the Commonwealth of Virginia is allowed to use that business name, and my business name finally matches my web-site domain name.

Unix Environment Variables for Mac OS X Applications

Tags:

Mac OS X applications that are launched by the Finder (e.g., by double clicking the associated.app folder) do not see environment variable settings you make for your Unix shell, say from a Terminal window or in your .bash_profile file. For these applications you must put your settings in a property list file that Mac OS X reads when you log in. That file is ~/.MacOSX/environment.plist

Building and Installing PostgreSQL on Mac OS X

Here are instructions for building and installing the PostgreSQL database server on a Mac OS X system. This includes instructions for using dscl to create a special user account to manage the database processes and data, and a sample launchd script to automatically launch the database server on system startup.

Working With DocBook XML On Mac OS X

Here is what I did to my Mac OS X 10.4 environment to work with DocBook XML.

Syndicate content