Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
human_readable.hpp File Reference

Convert raw numeric values to human-readable SI-formatted pairs. More...

#include <array>
#include <cmath>
#include <utility>
Include dependency graph for human_readable.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sham::human_readable_t
 Struct holding a scaled value with its SI prefix. More...

Namespaces

namespace  sham
 namespace for backends this one is named only sham since shambackends is too long to write

Functions

template<bool allow_below_1>
consteval auto sham::details::make_si_pairs ()
 Generate a compile-time table of SI prefixes and their magnitudes.
template<bool allow_below_1 = true>
human_readable_t sham::to_human_readable (double value)
 Convert a raw value to a human-readable scaled form with an SI prefix.

Detailed Description

Convert raw numeric values to human-readable SI-formatted pairs.

Author
Timothée David–Cléris (tim.s.nosp@m.hamr.nosp@m.ock@p.nosp@m.roto.nosp@m.n.me)

Definition in file human_readable.hpp.

Function Documentation

◆ make_si_pairs()

template<bool allow_below_1>
auto sham::details::make_si_pairs ( )
consteval

Generate a compile-time table of SI prefixes and their magnitudes.

Template Parameters
allow_below_1When true, includes sub-unity prefixes (nano through milli). When false, starts at unity (no sub-unity prefixes).
Returns
constexpr std::array of {prefix, magnitude} pairs sorted ascending

Definition at line 34 of file human_readable.hpp.