What’s 1.21 Gigawatts in Watts?
Introducing whats
, a lightweight command-line tool for getting answers to
everyday questions like whats 2 meters in feet
or more importantly whats 1.21 gigawatts in watts
.

Earlier this year I started dipping my toes into Zig, an imperative,
general-purpose, statically typed, compiled system programming language with a
focus on performance and simplicity. As part of this journey, I created a
lightweight open source utility called whats
.
What’s whats
?
whats
is a command-line tool designed for quick, intuitive unit conversions
and basic calculations. It lets users phrase their queries naturally and returns
concise, relevant answers. For example:
whats 3 meters in feet
The tool is flexible in how it interprets input and it supports various styles,
such as whats 3meters in feet
, shorthand like whats 3m in ft
, or even the
minimal whats 3m ft
. The aim is to build something that feels instinctive to
use, enabling effortless access to everyday conversions and calculations.
Currently, whats
supports conversions across a broad range of unit types,
including data, energy, length, mass, currency, power, pressure, temperature,
time, and volume. While its calculation capabilities are currently limited, I’m
looking forward to expanding support for more advanced conversions and
computational features.

What’s underneath?
To power the flexible, multi-path conversion logic in whats
, I needed a
reliable way to traverse relationships between units. In some cases, the
conversion path isn’t direct, as you might go from A to B via C, for example.
This called for a classic graph traversal approach, and I chose breadth-first
search (BFS).
Instead of embedding this logic directly into whats
, I decided to write a
standalone Zig library: bfstree.zig. This helped me understand how Zig
libraries are supposed to look and how they can be used inside an exe
project.
The library provides a simple, efficient implementation of the BFS algorithm, allowing for clean and reusable graph traversal in any Zig project.
What’s Breadth-First Search?
At its core, BFS explores a graph by starting from a given node and visiting all its neighbors before moving on to the next layer of neighbors. It’s particularly useful for finding the shortest path in unweighted graphs.
For example, imagine a network of flight routes:
Prague → Paris → Madrid
↘ ↘
Rome Lisbon
If you want to find a path from Prague to Lisbon, BFS will explore Paris and Rome first, then proceed to Madrid and Lisbon, ultimately returning the shortest route:
Prague → Paris → Lisbon
You can see a Zig implementation of this idea in action in the “BFS Path finding” test case, which models cities and connections as graph nodes and edges. The BFS algorithm quickly finds a valid route from source to destination, demonstrating not only the generality of the library but also its usefulness beyond just unit conversions.
What’s next?
I plan to extend whats
with support for more complex calculations and
conversions, and more currency exchange rates using different APIs. Other ideas
include the integration of tldr, as well as maybe a general knowledge source
to answer broader questions, like for example whats the epr paradox
, or maybe
even more complex things like whats love
. All of these implementations will
certainly touch some interesting areas of Zig that I’m curious to explore in
detail.
What’s the catch?
whats
is primarily a learning exercise, not a showcase of Zig craftsmanship.
While functional, the code likely wouldn’t win any style awards. Hence, please
don’t treat it as a model of how Zig ought to be written. If you’re well-versed
in Zig, I warmly welcome your wisdom and suggestions. But if your
sole mission is to roast the implementation in a comment thread,
kindly consider that I quite possibly outlift you in the gym. (-;
Check out whats on GitHub
Enjoyed this? Support me via Monero, Bitcoin or Ethereum! More info.