ocaml-community / calendar

OCaml library for handling dates and times.
Other
42 stars 9 forks source link

Cleanup the float/int distinction #21

Open Drup opened 5 years ago

Drup commented 5 years ago

There is currently Calendar, Calendar.Precise, FCalendar and FCalendar.Precise, all with various float/int combination. The tradeoffs are absolutely not explained in the documentation, and I'm quite sure they don't apply anymore, in these times of ubiquitous 64bit systems. We should be able to clean all that up.

loxs commented 5 years ago

I was wondering about this too...

signoles commented 5 years ago

The precise versions are still useful and are not related to 64-bit systems.

In "standard" implementations (Calendar and FCalendar), a calendar is simply represented by a float. It may lead to approximation due to floating-point rounding.

In "precise" implementations (*.Precise), the "date" part is not represented by a float but by an integer, so it remains precise. However, it is more memory-expensive.

If you'd like to remove some of these implementations, I would suggest not to remove the precise version.

Drup commented 5 years ago

@signoles What I had in mind was actually to make the precise version the default. ;)

signoles commented 5 years ago

then it makes sense