1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! Actual/365 (Fixed) day counter (English / Canadian convention).
use crateDate;
use crateDayCounter;
/// Actual/365 Fixed day counter.
///
/// Year fraction is given by:
/// $$\text{Year Fraction} = \frac{d_2 - d_1}{365}$$
///
/// # Examples
/// ```
/// use quantlib_rs::time::date::{Date, Month};
/// use quantlib_rs::time::day_counter::DayCounter;
/// use quantlib_rs::time::day_counters::actual_365_fixed::Actual365Fixed;
///
/// let dc = Actual365Fixed;
/// let d1 = Date::from_ymd(2024, Month::January, 1).unwrap();
/// let d2 = Date::from_ymd(2024, Month::July, 1).unwrap();
///
/// assert_eq!(dc.day_count(d1, d2), 182);
/// assert!((dc.year_fraction(d1, d2) - 182.0 / 365.0).abs() < 1e-12);
/// ```
;