Skip to main content

Module arithmetic

Module arithmetic 

Source
Expand description

Arithmetic operations on BrightDate values.

Functionsยง

absolute_difference
Absolute difference between two BrightDate values.
add
Add days to a BrightDate value.
add_microdays
Add microdays to a BrightDate value.
add_millidays
Add millidays to a BrightDate value.
ceil_to_day
Ceiling to the nearest whole-day boundary.
clamp
Clamp value to the closed interval [min_val, max_val].
compare
Compare two BrightDate values, returning std::cmp::Ordering.
difference
Signed difference a โˆ’ b in decimal days.
equals
Test equality within tolerance decimal days.
floor_to_day
Floor to the nearest whole-day boundary.
is_in_range
True if value is in the closed interval [start, end].
lerp
Linear interpolation: a + t * (b โˆ’ a).
linspace
Generate n evenly-spaced values from start to end inclusive.
max_of
Return the maximum value in a slice. Panics if the slice is empty.
midpoint
Midpoint of two BrightDate values.
min_of
Return the minimum value in a slice. Panics if the slice is empty.
round_to_microday
Round to nearest microday.
round_to_milliday
Round to nearest milliday.
sort
Return a sorted copy of values (does not mutate the input).
subtract
Subtract days from a BrightDate value.
whole_days_between
Whole-day count between two BrightDate values (truncates toward zero).