BRL-CAD
Loading...
Searching...
No Matches
num.h
Go to the documentation of this file.
1
/* N U M . H
2
* BRL-CAD
3
*
4
* Copyright (c) 2026 United States Government as represented by the
5
* U.S. Army Research Laboratory.
6
*
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public License
9
* version 2.1 as published by the Free Software Foundation.
10
*
11
* This library is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this file; see the file named COPYING for more
18
* information.
19
*/
20
21
#ifndef BU_NUM_H
22
#define BU_NUM_H
23
24
#include "
common.h
"
25
26
#include <stddef.h>
27
28
#include "
bu/defines.h
"
29
30
__BEGIN_DECLS
31
32
/**
33
* Print numeric values as a table on standard output.
34
*
35
* Values are emitted left-to-right in rows of @p cols entries. Optional
36
* strings control the table and row delimiters, number format, and column
37
* separator. A NULL number format uses %.17g.
38
*
39
* Print one space-separated row using the defaults:
40
* @code
41
* const double vals[] = {1.0, 2.0, 3.0};
42
* bu_num_print(vals, 3, 3, NULL, NULL, NULL, NULL, NULL, "\n");
43
* // Prints: 1 2 3
44
* @endcode
45
*
46
* Print the values as a bracketed 2-by-2 matrix:
47
* @code
48
* const double vals[] = {1.0, 2.0, 3.0, 4.0};
49
* bu_num_print(vals, 4, 2, "[\n", " [", "%.0f", ", ", "]\n", "]\n]\n");
50
* // Prints:
51
* // [
52
* // [1, 2]
53
* // [3, 4]
54
* // ]
55
* @endcode
56
*/
57
BU_EXPORT
extern
void
bu_num_print
(
const
double
*
vals
,
58
size_t
nvals
,
59
size_t
cols
,
60
const
char
*
tbl_start
,
61
const
char
*
row_start
,
62
const
char
*
num_fmt
,
63
const
char
*
col_sep
,
64
const
char
*
row_end
,
65
const
char
*
tbl_end
);
66
67
__END_DECLS
68
69
#endif
/* BU_NUM_H */
70
71
/*
72
* Local Variables:
73
* mode: C
74
* tab-width: 8
75
* indent-tabs-mode: t
76
* c-file-style: "stroustrup"
77
* End:
78
* ex: shiftwidth=4 tabstop=8
79
*/
defines.h
dvec
Definition
dvec.h:74
common.h
Header file for the BRL-CAD common definitions.
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)
include
bu
num.h
Generated on Mon Aug 17 2026 00:59:52 for BRL-CAD by
1.9.8