Compare commits

...

1 Commits

Author SHA1 Message Date
Nicolás Hatcher
dcfee794b9 UPDATE[docs]: Compatibility and other engines 2025-01-04 09:46:26 +01:00
5 changed files with 116 additions and 3 deletions

View File

@@ -75,9 +75,13 @@ export default defineConfig({
link: "/features/units", link: "/features/units",
}, },
{ {
text: "Serial Numbers", text: "Dates and serial numbers",
link: "/features/serial-numbers", link: "/features/serial-numbers",
}, },
{
text: "Numbers in IronCalc",
link: "/features/numbers-in-ironcalc",
},
{ {
text: "Unsupported Features", text: "Unsupported Features",
link: "/features/unsupported-features", link: "/features/unsupported-features",
@@ -2028,6 +2032,16 @@ export default defineConfig({
}, },
], ],
}, },
{
text: "Spreadhsheet Engines",
collapsed: true,
items: [
{
text: "Spreadsheet Engines",
link: "/other-spreadsheets/index",
},
],
},
{ {
text: "Contributing", text: "Contributing",
collapsed: true, collapsed: true,

View File

@@ -0,0 +1,38 @@
---
layout: doc
outline: deep
lang: en-US
---
# Numbers in IronCalc
::: warning
**Note:** This draft page is under construction 🚧
::: warning
**Note:** This page contains technical documentation
Numbers in IronCalc are [IEE 754](https://en.wikipedia.org/wiki/IEEE_754) doubles (64 bit) and are displayed uo to 15 decimal digits.
## Integers
Some Integers are well represented by IEEE 754 doubles. The largest integer that can be stored perfectly as a double is:
$$
2^53 = 9,007,199,254,740,992
$$
## Floating points
The reader should be aware that numbers like 0.1 or 0.3 are not stored perfectly by computers, _only an approximation to them_ is stored.
This results in imperfect operations like the famous `0.1 + 0.2 != 0.3`.
When comparing numbers we also compare up to 15 significant figures. With this 'trick' `=IF(0.2+0.1=0.3,TRUE,FALSE)` is actually `TRUE`.
## Compatibility issues
Excel [mostly follows IEEE 754](https://learn.microsoft.com/en-us/office/troubleshoot/excel/floating-point-arithmetic-inaccurate-result). Like IronCalc displays numbers with 15 significant digits. Excel does a few other undisclosed 'hacks'.
If the result of an addition (or subtraction) of two non very small numbers is a number close to EPS and it is the end of the calculation then it is zero.
That's is how it gets `=0.3-0.2-0.1` as `0`. However `=1*(0.3-0.2-0.1)` in Excel is `-2.77556E-17`

View File

@@ -31,3 +31,20 @@ The fractional part of a serial number represents time, as a fraction of the day
Since date-times are stored as numbers, they can be used for arithmetic operations in formulas. For example, it is possible to determine the difference between two dates by subtracting one serial number from the other. Since date-times are stored as numbers, they can be used for arithmetic operations in formulas. For example, it is possible to determine the difference between two dates by subtracting one serial number from the other.
**Note**: A #VALUE! error is reported if a date-formatted cell contains a number less than 1 or greater than 2,958,465. **Note**: A #VALUE! error is reported if a date-formatted cell contains a number less than 1 or greater than 2,958,465.
## Compatibility Notes
Excel has an infamous [feature](https://learn.microsoft.com/en-us/office/troubleshoot/excel/wrongly-assumes-1900-is-leap-year) that was ported from a bug in Lotus 1-2-3 that assumes that the year 1900 is a leap year.
That means that serial numbers 1 to 60 in IronCalc are different than Excel.
In IronCalc, Google Sheets, Libre Office and Zoho Date(1900,1,1) returns 2
In Excel Date(1900,1,1) returns 1.
Gnumeric solves the problem in yet another way. It follows Excel from 1 to 59, skips 60, and it follows Excel (and all other engines from there on).
A formula like `=DAY(60)` produces `#NUM!` in Gnumeric.
Serial number 61 corresponds to 1 March 1900, and from there on most spreadsheet engines agree.
IronCalc, like Excel, doesn't deal with serial numbers outside of the range [1, 2,958,465]. Other engines like Google sheets, do not have an upper limit.

View File

@@ -7,28 +7,42 @@ lang: en-US
::: warning ::: warning
**Note:** This draft page is under construction 🚧 **Note:** This draft page is under construction 🚧
::: :::
## Overview ## Overview
DAY is a function of the Date and Time category that extracts the day of the month from a valid date [serial number](/features/serial-numbers.md), returning a number in the range [1, 31]. DAY is a function of the Date and Time category that extracts the day of the month from a valid date [serial number](/features/serial-numbers.md), returning a number in the range [1, 31].
## Usage ## Usage
### Syntax ### Syntax
**DAY(<span title="Number" style="color:#1E88E5">date</span>) => <span title="Number" style="color:#1E88E5">day</span>** **DAY(<span title="Number" style="color:#1E88E5">date</span>) => <span title="Number" style="color:#1E88E5">day</span>**
### Argument descriptions ### Argument descriptions
* *date* ([number](/features/value-types#numbers), required). The date for which the day of the month is to be calculated, expressed as a [serial number](/features/serial-numbers.md) in the range [0, 2958465]. The value 0 corresponds to the date 1899-12-30, while 2958465 corresponds to 9999-12-31. * *date* ([number](/features/value-types#numbers), required). The date for which the day of the month is to be calculated, expressed as a [serial number](/features/serial-numbers.md) in the range [1, 2958465]. The value corresponds to the date 1899-12-31, while 2958465 corresponds to 9999-12-31.
### Additional guidance ### Additional guidance
If the supplied _date_ argument has a fractional part, DAY uses its [floor value](https://en.wikipedia.org/wiki/Floor_and_ceiling_functions). If the supplied _date_ argument has a fractional part, DAY uses its [floor value](https://en.wikipedia.org/wiki/Floor_and_ceiling_functions).
### Returned value ### Returned value
DAY returns an integer [number](/features/value-types#numbers) in the range [1, 31], that is the day of the month according to the [Gregorian calendar](https://en.wikipedia.org/wiki/Gregorian_calendar). DAY returns an integer [number](/features/value-types#numbers) in the range [1, 31], that is the day of the month according to the [Gregorian calendar](https://en.wikipedia.org/wiki/Gregorian_calendar).
### Error conditions ### Error conditions
* In common with many other IronCalc functions, DAY propagates errors that are found in its argument. * In common with many other IronCalc functions, DAY propagates errors that are found in its argument.
* If no argument, or more than one argument, is supplied, then DAY returns the [`#ERROR!`](/features/error-types.md#error) error. * If no argument, or more than one argument, is supplied, then DAY returns the [`#ERROR!`](/features/error-types.md#error) error.
* If the value of the *date* argument is not (or cannot be converted to) a [number](/features/value-types#numbers), then DAY returns the [`#VALUE!`](/features/error-types.md#value) error. * If the value of the *date* argument is not (or cannot be converted to) a [number](/features/value-types#numbers), then DAY returns the [`#VALUE!`](/features/error-types.md#value) error.
* For some argument values, DAY may return the [`#DIV/0!`](/features/error-types.md#div-0) error. * For some argument values, DAY may return the [`#DIV/0!`](/features/error-types.md#div-0) error.
* If date is less than 0, or greater than 2,958,465, then DAY returns the [`#NUM!`](/features/error-types.md#num) error. * If date is less than 1, or greater than 2,958,465, then DAY returns the [`#NUM!`](/features/error-types.md#num) error.
* At present, DAY does not accept a string representation of a date literal as an argument. For example, the formula `=DAY("2024-12-31")` returns the [`#VALUE!`](/features/error-types.md#value) error. * At present, DAY does not accept a string representation of a date literal as an argument. For example, the formula `=DAY("2024-12-31")` returns the [`#VALUE!`](/features/error-types.md#value) error.
<!--@include: ../markdown-snippets/error-type-details.txt--> <!--@include: ../markdown-snippets/error-type-details.txt-->
## Details ## Details
IronCalc utilizes Rust's [chrono](https://docs.rs/chrono/latest/chrono/) crate to implement the DAY function. IronCalc utilizes Rust's [chrono](https://docs.rs/chrono/latest/chrono/) crate to implement the DAY function.
## Compatibility Notes
In IronCalc the argument of DAY cannot be text. This is confusing, and error prone, as in "10/12/2026" it is not clear if the day is 10 or 12.
Most of all other spreadsheet engines like Excel, Google Sheets, Libre Office and Gnumeric accept text as input.
## Examples ## Examples
[See some examples in IronCalc](https://app.ironcalc.com/?example=day). [See some examples in IronCalc](https://app.ironcalc.com/?example=day).
## Links ## Links

View File

@@ -0,0 +1,30 @@
---
layout: doc
outline: deep
lang: en-US
---
::: warning
**Note:** This draft page is under construction 🚧
:::
# Other spreadsheet engines
There are numerous spreadsheet engines out there
## Excel, the Friendly Giant
## Google Sheets
## LibreOffice
## Gnumeric
# Links
For a list of spreadsheet software you can consult [wikipedia](https://en.wikipedia.org/wiki/List_of_spreadsheet_software).