Graphviz 13.0.0~dev.20241220.2304
|
Arithmetic helper functions. More...
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
#include <string.h>
Go to the source code of this file.
Functions | |
static int | fcmp (double a, double b) |
comparator for doubles | |
static int | imax (int a, int b) |
maximum of two integers | |
static int | imin (int a, int b) |
minimum of two integers | |
static bool | is_exactly_equal (double a, double b) |
are two values precisely the same? | |
static bool | is_exactly_zero (double v) |
is a value precisely 0.0? | |
static int | scale_clamp (int original, double scale) |
scale up or down a non-negative integer, clamping to [0, INT_MAX] | |
|
inlinestatic |
Definition at line 13 of file gv_math.h.
Referenced by countHorzCross(), and countVertCross().
|
inlinestatic |
Definition at line 24 of file gv_math.h.
Referenced by agerr_va().
|
inlinestatic |
Definition at line 27 of file gv_math.h.
Referenced by common_init_node(), dfs(), dfs(), make_map_internal(), node_distinct_coloring_internal2(), QuadTree_get_nearest(), QuadTree_get_nearest_internal(), and sfprint().
|
inlinestatic |
This function should only be used when you know you want comparison with no tolerance, which is rare. Floating-point arithmetic accumulates imprecision, so equality comparisons should generally include a non-zero tolerance to account for this. In general, this function is only applicable for checking things like “is this variable unchanged since a previous assignment from a literal?”
a | First operand to comparison |
b | Second operand to comparison |
Definition at line 43 of file gv_math.h.
Referenced by is_exactly_zero(), is_set(), pango_textlayout(), point_init(), poly_init(), rgb2hsv(), and routesplines_().
|
inlinestatic |
This function should only be used when you know you want comparison with no tolerance, which is rare. Floating-point arithmetic accumulates imprecision, so equality comparisons should generally include a non-zero tolerance to account for this. Valid double
representations even include -0.0, for which this function will return false. In general, this function is only applicable for checking things like “is this variable unchanged since a previous assignment from the literal 0
?” or “did this value we parsed from user input originate from the string "0.0"?”
v | Value to check |
Definition at line 62 of file gv_math.h.
References is_exactly_equal().
Referenced by dotneato_args_initialize(), emit_begin_node(), get_inputscale(), isBox(), isRect(), poly_init(), and poly_inside().
|
inlinestatic |