BRL-CAD
Loading...
Searching...
No Matches
num.h File Reference
#include "common.h"
#include <stddef.h>
#include "bu/defines.h"
Include dependency graph for num.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void bu_num_print (const double *vals, size_t nvals, size_t cols, const char *tbl_start, const char *row_start, const char *num_fmt, const char *col_sep, const char *row_end, const char *tbl_end)
 

Function Documentation

◆ bu_num_print()

void bu_num_print ( const double vals,
size_t  nvals,
size_t  cols,
const char tbl_start,
const char row_start,
const char num_fmt,
const char col_sep,
const char row_end,
const char tbl_end 
)
extern

Print numeric values as a table on standard output.

Values are emitted left-to-right in rows of cols entries. Optional strings control the table and row delimiters, number format, and column separator. A NULL number format uses %.17g.

Print one space-separated row using the defaults:

const double vals[] = {1.0, 2.0, 3.0};
bu_num_print(vals, 3, 3, NULL, NULL, NULL, NULL, NULL, "\n");
// Prints: 1 2 3
Definition dvec.h:74
void bu_num_print(const double *vals, size_t nvals, size_t cols, const char *tbl_start, const char *row_start, const char *num_fmt, const char *col_sep, const char *row_end, const char *tbl_end)

Print the values as a bracketed 2-by-2 matrix:

const double vals[] = {1.0, 2.0, 3.0, 4.0};
bu_num_print(vals, 4, 2, "[\n", " [", "%.0f", ", ", "]\n", "]\n]\n");
// Prints:
// [
// [1, 2]
// [3, 4]
// ]