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.
docker pull stillwater/universaldocker run -it --rm stillwater/universal bashWrite and compile programs using Universal directly inside the container:
#include <universal/number/posit/posit.hpp>#include <iostream>int main() { sw::universal::posit<16,2> p = 1.5; std::cout << p << '\n';}g++ -std=c++20 -o hello hello.cpp && ./helloTry the Command-Line Tools
Section titled “Try the Command-Line Tools”# Interactive mixed-precision calculatorucalcucalc> type posit32; show 1.5ucalc> compare 0.1ucalc> type bfloat16; precision
# Inspect IEEE-754 floating-point valuesieee 1.5
# One-shot ucalc commandsucalc "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.
Development Container
Section titled “Development Container”For a full development environment with both GCC and Clang pre-installed, use the VS Code Dev Container.
Prerequisites
Section titled “Prerequisites”- Docker
- VS Code with the Dev Containers extension
Getting started
Section titled “Getting started”- Clone the repository and open it in VS Code.
- When prompted, select Reopen in Container (or run the command
Dev Containers: Reopen in Container). - Once the container builds, open the CMake Tools preset selector and choose a preset such as
gcc-debugorclang-release. - Build and debug as usual with the CMake Tools extension.
Switching compilers
Section titled “Switching compilers”CMake presets handle compiler selection automatically. Choose gcc-* presets for GCC or clang-* presets for Clang — no manual toolchain configuration needed.