Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Floating point error for FastExcel#date_num #103

Open
tientt-holistics opened this issue Jul 26, 2024 · 0 comments
Open

Floating point error for FastExcel#date_num #103

tientt-holistics opened this issue Jul 26, 2024 · 0 comments

Comments

@tientt-holistics
Copy link

tientt-holistics commented Jul 26, 2024

Hi! First of all thanks for this gem!

There might be a floating point error for FastExcel#date_num in the latest version 0.5.0
Reproduce

time = Time.new("2016-09-01 00:00:00 +0700")
FastExcel.date_num(Time.new("2016-09-01 00:00:00 +0700"))

Expected

42370

Actual

42369.99999999999

This affects all outputted Excel files since it is being used in FastExcel::WorksheetExt#write_value.
I understand there could be a performance trade-off here. But I would really like to have an option to explicitly decide between fast and precision.

Thank you in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant