Skip to content

Docker Quick Start

The Docker image provides a ready-to-use C++ development environment with compilers, cmake, the Universal library headers pre-installed, and command-line tools (including ucalc) on the PATH.

Terminal window
docker pull stillwater/universal
docker run -it --rm stillwater/universal bash

Write and compile programs using Universal directly inside the container:

hello.cpp
#include <universal/number/posit/posit.hpp>
#include <iostream>
int main() {
sw::universal::posit<16,2> p = 1.5;
std::cout << p << '\n';
}
Terminal window
g++ -std=c++20 -o hello hello.cpp && ./hello
Terminal window
# Interactive mixed-precision calculator
ucalc
ucalc> type posit32; show 1.5
ucalc> compare 0.1
ucalc> type bfloat16; precision
# Inspect IEEE-754 floating-point values
ieee 1.5
# One-shot ucalc commands
ucalc "type fp16; sweep sin(x) for x in [0, 3.14, 6]"

See ucalc for the full interactive calculator documentation, or Command-Line Tools for the standalone inspection utilities.

For a full development environment with both GCC and Clang pre-installed, use the VS Code Dev Container.

  1. Clone the repository and open it in VS Code.
  2. When prompted, select Reopen in Container (or run the command Dev Containers: Reopen in Container).
  3. Once the container builds, open the CMake Tools preset selector and choose a preset such as gcc-debug or clang-release.
  4. Build and debug as usual with the CMake Tools extension.

CMake presets handle compiler selection automatically. Choose gcc-* presets for GCC or clang-* presets for Clang — no manual toolchain configuration needed.