Compare commits
20 Commits
feature/ni
...
dynamic-ar
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf894d0045 | ||
|
|
3a399fc91a | ||
|
|
71a2bb2dca | ||
|
|
889845b948 | ||
|
|
8844b80c51 | ||
|
|
0f8f345aae | ||
|
|
3191e12b93 | ||
|
|
61cecb7af5 | ||
|
|
fdeae2c771 | ||
|
|
3e9c69f122 | ||
|
|
c1c43143cc | ||
|
|
763b43a590 | ||
|
|
8dbfe07392 | ||
|
|
e39bfe912a | ||
|
|
9bbf94e033 | ||
|
|
0194912845 | ||
|
|
1d4d84bb57 | ||
|
|
e841c17aca | ||
|
|
f2c43f2070 | ||
|
|
32b1f8ef4e |
@@ -717,7 +717,7 @@ impl Parser {
|
|||||||
return Node::ParseErrorKind {
|
return Node::ParseErrorKind {
|
||||||
formula: self.lexer.get_formula(),
|
formula: self.lexer.get_formula(),
|
||||||
position: 0,
|
position: 0,
|
||||||
message: "sheet not found".to_string(),
|
message: format!("sheet not found: {}", context.sheet),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -850,7 +850,7 @@ impl Parser {
|
|||||||
return Node::ParseErrorKind {
|
return Node::ParseErrorKind {
|
||||||
formula: self.lexer.get_formula(),
|
formula: self.lexer.get_formula(),
|
||||||
position: 0,
|
position: 0,
|
||||||
message: "sheet not found".to_string(),
|
message: format!("sheet not found: {}", context.sheet),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -878,7 +878,7 @@ impl Parser {
|
|||||||
return Node::ParseErrorKind {
|
return Node::ParseErrorKind {
|
||||||
formula: self.lexer.get_formula(),
|
formula: self.lexer.get_formula(),
|
||||||
position: 0,
|
position: 0,
|
||||||
message: "sheet not found".to_string(),
|
message: format!("table sheet not found: {}", table.sheet_name),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ impl Model {
|
|||||||
}
|
}
|
||||||
// None of the cases matched so we return the default
|
// None of the cases matched so we return the default
|
||||||
// If there is an even number of args is the last one otherwise is #N/A
|
// If there is an even number of args is the last one otherwise is #N/A
|
||||||
if args_count % 2 == 0 {
|
if args_count.is_multiple_of(2) {
|
||||||
return self.evaluate_node_in_context(&args[args_count - 1], cell);
|
return self.evaluate_node_in_context(&args[args_count - 1], cell);
|
||||||
}
|
}
|
||||||
CalcResult::Error {
|
CalcResult::Error {
|
||||||
@@ -262,7 +262,7 @@ impl Model {
|
|||||||
if args_count < 2 {
|
if args_count < 2 {
|
||||||
return CalcResult::new_args_number_error(cell);
|
return CalcResult::new_args_number_error(cell);
|
||||||
}
|
}
|
||||||
if args_count % 2 != 0 {
|
if !args_count.is_multiple_of(2) {
|
||||||
// Missing value for last condition
|
// Missing value for last condition
|
||||||
return CalcResult::new_args_number_error(cell);
|
return CalcResult::new_args_number_error(cell);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ impl Model {
|
|||||||
// FIXME: This function shares a lot of code with apply_ifs. Can we merge them?
|
// FIXME: This function shares a lot of code with apply_ifs. Can we merge them?
|
||||||
pub(crate) fn fn_countifs(&mut self, args: &[Node], cell: CellReferenceIndex) -> CalcResult {
|
pub(crate) fn fn_countifs(&mut self, args: &[Node], cell: CellReferenceIndex) -> CalcResult {
|
||||||
let args_count = args.len();
|
let args_count = args.len();
|
||||||
if args_count < 2 || args_count % 2 == 1 {
|
if args_count < 2 || !args_count.is_multiple_of(2) {
|
||||||
return CalcResult::new_args_number_error(cell);
|
return CalcResult::new_args_number_error(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,7 +476,7 @@ impl Model {
|
|||||||
F: FnMut(f64),
|
F: FnMut(f64),
|
||||||
{
|
{
|
||||||
let args_count = args.len();
|
let args_count = args.len();
|
||||||
if args_count < 3 || args_count % 2 == 0 {
|
if args_count < 3 || args_count.is_multiple_of(2) {
|
||||||
return Err(CalcResult::new_args_number_error(cell));
|
return Err(CalcResult::new_args_number_error(cell));
|
||||||
}
|
}
|
||||||
let arg_0 = self.evaluate_node_in_context(&args[0], cell);
|
let arg_0 = self.evaluate_node_in_context(&args[0], cell);
|
||||||
|
|||||||
@@ -4,14 +4,19 @@
|
|||||||
Example usage:
|
Example usage:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { Model } from '@ironcalc/wasm';
|
import { Model } from '@ironcalc/nodejs';
|
||||||
|
|
||||||
const model = new Model("Workbook1", "en", "UTC");
|
const model = new Model("Workbook1", "en", "UTC");
|
||||||
|
|
||||||
model.setUserInput(0, 1, 1, "=1+1");
|
model.setUserInput(0, 1, 1, "=1+1");
|
||||||
const result1 = model.getFormattedCellValue(0, 1, 1);
|
|
||||||
|
|
||||||
console.log('Cell value', result1);
|
const result1 = model.getFormattedCellValue(0, 1, 1);
|
||||||
|
console.log('Cell value', result1); // "#ERROR"
|
||||||
|
|
||||||
|
model.evaluate();
|
||||||
|
|
||||||
|
const resultAfterEvaluate = model.getFormattedCellValue(0, 1, 1);
|
||||||
|
console.log('Cell value', resultAfterEvaluate); // 2
|
||||||
|
|
||||||
let result2 = model.getCellStyle(0, 1, 1);
|
let result2 = model.getCellStyle(0, 1, 1);
|
||||||
console.log('Cell style', result2);
|
console.log('Cell style', result2);
|
||||||
|
|||||||
@@ -67,3 +67,7 @@ Using IronCalc, a complex number is a string of the form "1+j3".
|
|||||||
"#N/A" => #N/A
|
"#N/A" => #N/A
|
||||||
|
|
||||||
## Arrays
|
## Arrays
|
||||||
|
|
||||||
|
## References
|
||||||
|
|
||||||
|
A reference is a pointer to a single cell or a range of cells. The reference can either be entered manually, for example "A4", or as the result of a calculation, such as the OFFSET Function or the INDIRECT Function. A reference can also be built, for example with the Colon (\:) Operator.
|
||||||
BIN
docs/src/functions/images/hyperbolicarccosine-curve.png
Normal file
BIN
docs/src/functions/images/hyperbolicarccosine-curve.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
BIN
docs/src/functions/images/hyperbolicarcsine-curve.png
Normal file
BIN
docs/src/functions/images/hyperbolicarcsine-curve.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 79 KiB |
BIN
docs/src/functions/images/hyperbolicarctangent-curve.png
Normal file
BIN
docs/src/functions/images/hyperbolicarctangent-curve.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
@@ -16,7 +16,7 @@ You can track the progress in this [GitHub issue](https://github.com/ironcalc/Ir
|
|||||||
| CHOOSE | <Badge type="tip" text="Available" /> | – |
|
| CHOOSE | <Badge type="tip" text="Available" /> | – |
|
||||||
| CHOOSECOLS | <Badge type="info" text="Not implemented yet" /> | – |
|
| CHOOSECOLS | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| CHOOSEROWS | <Badge type="info" text="Not implemented yet" /> | – |
|
| CHOOSEROWS | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| COLUMN | <Badge type="tip" text="Available" /> | – |
|
| COLUMN | <Badge type="tip" text="Available" /> | [COLUMN](lookup_and_reference/column) |
|
||||||
| COLUMNS | <Badge type="tip" text="Available" /> | – |
|
| COLUMNS | <Badge type="tip" text="Available" /> | – |
|
||||||
| DROP | <Badge type="info" text="Not implemented yet" /> | – |
|
| DROP | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| EXPAND | <Badge type="info" text="Not implemented yet" /> | – |
|
| EXPAND | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
|
|||||||
@@ -4,8 +4,28 @@ outline: deep
|
|||||||
lang: en-US
|
lang: en-US
|
||||||
---
|
---
|
||||||
|
|
||||||
# COLUMN
|
# COLUMN function
|
||||||
|
## Overview
|
||||||
::: warning
|
The COLUMN Function in IronCalc is a lookup & reference formula that is used to query and return the column number of a referenced Column or Cell.
|
||||||
🚧 This function is implemented but currently lacks detailed documentation. For guidance, you may refer to the equivalent functionality in [Microsoft Excel documentation](https://support.microsoft.com/en-us/office/excel-functions-by-category-5f91f4e9-7b42-46d2-9bd1-63f26a86c0eb).
|
## Usage
|
||||||
:::
|
### Syntax
|
||||||
|
**COLUMN(<span title="Reference" style="color:#1E88E5">reference</span>) => <span title="Number" style="color:#1E88E5">column</span>**
|
||||||
|
### Argument descriptions
|
||||||
|
* *reference* ([cell](/features/value-types#references), [optional](/features/optional-arguments.md)). The number of the cell you wish to reference the column number of.
|
||||||
|
### Additional guidance
|
||||||
|
* When referencing a range of cells, only the column number of the left most cell will be returned.
|
||||||
|
* You are also able to reference complete columns instead of individual cells.
|
||||||
|
### Returned value
|
||||||
|
COLUMN returns the [number](/features/value-types#numbers) of the specific cell or column which is being referenced.
|
||||||
|
### Error conditions
|
||||||
|
* IronCalc currently does not support the referencing of cells with names.
|
||||||
|
## Details
|
||||||
|
The COLUMN Function can only be used to display the correlating number of a single column within a Sheet. If you wish to show the number of columns used within a specific range, you can use the COLUMNS Function.
|
||||||
|
## Examples
|
||||||
|
### No Cell Reference
|
||||||
|
When no cell reference is made, the formula uses **=COLUMN()**. This will then output the column number of the cell where the formula is placed.<br><br>For example, if the formula is placed in cell A1, then "1" will be displayed.
|
||||||
|
### With Cell Reference
|
||||||
|
When a cell reference is made, the formula uses **=COLUMN([Referenced Cell])**. This will then output the column number of the referenced cell, regardless of where the formula is placed in the sheet.<br><br>For example, if the cell B1 is the referenced cell, "2" will be the output of the formula no matter where it is placed in the sheet.<br><br>**Note:** references do not always have to be specific cells, you can also reference complete columns. For example, **=COLUMN(B:B)** would also result in an output of "2".
|
||||||
|
### Range References
|
||||||
|
The COLUMN function can also be used to reference a range of Cells or Columns. In this case only the most left-hand column will be the resulting output.<br><br>For example, **=COLUMN(A1:J1)** will result in the ouput of "1".
|
||||||
|
## Links
|
||||||
@@ -13,16 +13,16 @@ You can track the progress in this [GitHub issue](https://github.com/ironcalc/Ir
|
|||||||
| --------------- | ---------------------------------------------- | ------------- |
|
| --------------- | ---------------------------------------------- | ------------- |
|
||||||
| ABS | <Badge type="tip" text="Available" /> | – |
|
| ABS | <Badge type="tip" text="Available" /> | – |
|
||||||
| ACOS | <Badge type="tip" text="Available" /> | [ACOS](math_and_trigonometry/acos) |
|
| ACOS | <Badge type="tip" text="Available" /> | [ACOS](math_and_trigonometry/acos) |
|
||||||
| ACOSH | <Badge type="tip" text="Available" /> | – |
|
| ACOSH | <Badge type="tip" text="Available" /> | [ACOSH](math_and_trigonometry/acosh) |
|
||||||
| ACOT | <Badge type="info" text="Not implemented yet" /> | – |
|
| ACOT | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| ACOTH | <Badge type="info" text="Not implemented yet" /> | – |
|
| ACOTH | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| AGGREGATE | <Badge type="info" text="Not implemented yet" /> | – |
|
| AGGREGATE | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| ARABIC | <Badge type="info" text="Not implemented yet" /> | – |
|
| ARABIC | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| ASIN | <Badge type="tip" text="Available" /> | [ASIN](math_and_trigonometry/asin) |
|
| ASIN | <Badge type="tip" text="Available" /> | [ASIN](math_and_trigonometry/asin) |
|
||||||
| ASINH | <Badge type="tip" text="Available" /> | – |
|
| ASINH | <Badge type="tip" text="Available" /> | [ASINH](math_and_trigonometry/asinh) |
|
||||||
| ATAN | <Badge type="tip" text="Available" /> | [ATAN](math_and_trigonometry/atan) |
|
| ATAN | <Badge type="tip" text="Available" /> | [ATAN](math_and_trigonometry/atan) |
|
||||||
| ATAN2 | <Badge type="tip" text="Available" /> | – |
|
| ATAN2 | <Badge type="tip" text="Available" /> | [ATAN2](math_and_trigonometry/atan2) |
|
||||||
| ATANH | <Badge type="tip" text="Available" /> | – |
|
| ATANH | <Badge type="tip" text="Available" /> | [ATANH](math_and_trigonometry/atanh) |
|
||||||
| BASE | <Badge type="info" text="Not implemented yet" /> | – |
|
| BASE | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| CEILING | <Badge type="info" text="Not implemented yet" /> | – |
|
| CEILING | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| CEILING.MATH | <Badge type="info" text="Not implemented yet" /> | – |
|
| CEILING.MATH | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
@@ -49,9 +49,9 @@ You can track the progress in this [GitHub issue](https://github.com/ironcalc/Ir
|
|||||||
| ISO.CEILING | <Badge type="info" text="Not implemented yet" /> | – |
|
| ISO.CEILING | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| LCM | <Badge type="info" text="Not implemented yet" /> | – |
|
| LCM | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| LET | <Badge type="info" text="Not implemented yet" /> | – |
|
| LET | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| LN | <Badge type="info" text="Not implemented yet" /> | – |
|
| LN | <Badge type="info" text="Available" /> | – |
|
||||||
| LOG | <Badge type="info" text="Not implemented yet" /> | – |
|
| LOG | <Badge type="info" text="Available" /> | – |
|
||||||
| LOG10 | <Badge type="info" text="Not implemented yet" /> | – |
|
| LOG10 | <Badge type="info" text="Available" /> | – |
|
||||||
| MDETERM | <Badge type="info" text="Not implemented yet" /> | – |
|
| MDETERM | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| MINVERSE | <Badge type="info" text="Not implemented yet" /> | – |
|
| MINVERSE | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| MMULT | <Badge type="info" text="Not implemented yet" /> | – |
|
| MMULT | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
@@ -80,11 +80,11 @@ You can track the progress in this [GitHub issue](https://github.com/ironcalc/Ir
|
|||||||
| SIN | <Badge type="tip" text="Available" /> | [SIN](math_and_trigonometry/sin) |
|
| SIN | <Badge type="tip" text="Available" /> | [SIN](math_and_trigonometry/sin) |
|
||||||
| SINH | <Badge type="tip" text="Available" /> | [SINH](math_and_trigonometry/sinh) |
|
| SINH | <Badge type="tip" text="Available" /> | [SINH](math_and_trigonometry/sinh) |
|
||||||
| SQRT | <Badge type="tip" text="Available" /> | – |
|
| SQRT | <Badge type="tip" text="Available" /> | – |
|
||||||
| SQRTPI | <Badge type="info" text="Not implemented yet" /> | – |
|
| SQRTPI | <Badge type="info" text="Available" /> | – |
|
||||||
| SUBTOTAL | <Badge type="info" text="Not implemented yet" /> | – |
|
| SUBTOTAL | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| SUM | <Badge type="tip" text="Available" /> | – |
|
| SUM | <Badge type="tip" text="Available" /> | – |
|
||||||
| SUMIF | <Badge type="tip" text="Available" /> | – |
|
| SUMIF | <Badge type="tip" text="Available" /> | – |
|
||||||
| SUMIFS | <Badge type="info" text="Not implemented yet" /> | – |
|
| SUMIFS | <Badge type="info" text="Available" /> | – |
|
||||||
| SUMPRODUCT | <Badge type="info" text="Not implemented yet" /> | – |
|
| SUMPRODUCT | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| SUMSQ | <Badge type="info" text="Not implemented yet" /> | – |
|
| SUMSQ | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
| SUMX2MY2 | <Badge type="info" text="Not implemented yet" /> | – |
|
| SUMX2MY2 | <Badge type="info" text="Not implemented yet" /> | – |
|
||||||
|
|||||||
@@ -3,9 +3,40 @@ layout: doc
|
|||||||
outline: deep
|
outline: deep
|
||||||
lang: en-US
|
lang: en-US
|
||||||
---
|
---
|
||||||
|
# ACOSH function
|
||||||
|
## Overview
|
||||||
|
ACOSH is a function of the Math and Trigonometry category that calculates the inverse hyperbolic cosine (hyperbolic arccosine) of a number, returning a non-negative value in the range [0, +∞).
|
||||||
|
## Usage
|
||||||
|
### Syntax
|
||||||
|
**ACOSH(<span title="Number" style="color:#1E88E5">number</span>) => <span title="Number" style="color:#1E88E5">acosh</span>**
|
||||||
|
### Argument descriptions
|
||||||
|
* *number* ([number](/features/value-types#numbers), required). The value whose hyperbolic arccosine is to be calculated. The value must be greater than or equal to 1.
|
||||||
|
|
||||||
# ACOSH
|
### Additional guidance
|
||||||
|
The hyperbolic arccosine function is defined as:
|
||||||
|
|
||||||
::: warning
|
$$
|
||||||
🚧 This function is implemented but currently lacks detailed documentation. For guidance, you may refer to the equivalent functionality in [Microsoft Excel documentation](https://support.microsoft.com/en-us/office/excel-functions-by-category-5f91f4e9-7b42-46d2-9bd1-63f26a86c0eb).
|
\operatorname{acosh}(x) = \ln(x + \sqrt{x^2 - 1})
|
||||||
:::
|
$$
|
||||||
|
|
||||||
|
### Returned value
|
||||||
|
ACOSH returns a [number](/features/value-types#numbers) in the range [0, +∞) that is the hyperbolic arccosine of the specified value, expressed in radians.
|
||||||
|
### Error conditions
|
||||||
|
* In common with many other IronCalc functions, ACOSH propagates errors that are found in its argument.
|
||||||
|
* If no argument, or more than one argument, is supplied, then ACOSH returns the [`#ERROR!`](/features/error-types.md#error) error.
|
||||||
|
* If the value of the *number* argument is not (or cannot be converted to) a [number](/features/value-types#numbers), then ACOSH returns the [`#VALUE!`](/features/error-types.md#value) error.
|
||||||
|
* If the value of the *number* argument is less than 1, then ACOSH returns the [`#NUM!`](/features/error-types.md#num) error.
|
||||||
|
<!--@include: ../markdown-snippets/error-type-details.txt-->
|
||||||
|
## Details
|
||||||
|
* The ACOSH function utilizes the *acosh()* method provided by the [Rust Standard Library](https://doc.rust-lang.org/std/).
|
||||||
|
* The figure below illustrates the output of the ACOSH function for values $x \geq 1$ in the range [0, +∞).
|
||||||
|
<center><img src="/functions/images/hyperbolicarccosine-curve.png" width="350" alt="Graph showing acosh(x) for x ≥ 1."></center>
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
[See some examples in IronCalc](https://app.ironcalc.com/?example=acosh).
|
||||||
|
|
||||||
|
## Links
|
||||||
|
* For more information about inverse hyperbolic functions, visit Wikipedia's [Inverse hyperbolic functions](https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions) page.
|
||||||
|
* See also IronCalc's [COSH](/functions/math_and_trigonometry/cosh), [ASINH](/functions/math_and_trigonometry/asinh) and [ATANH](/functions/math_and_trigonometry/atanh) functions.
|
||||||
|
* Visit Microsoft Excel's [ACOSH function](https://support.microsoft.com/en-us/office/acosh-function-e3992cc1-103f-4e72-9f04-624b9ef5ebfe) page.
|
||||||
|
* Both [Google Sheets](https://support.google.com/docs/answer/3093391) and [LibreOffice Calc](https://wiki.documentfoundation.org/Documentation/Calc_Functions/ACOSH) provide versions of the ACOSH function.
|
||||||
@@ -4,8 +4,36 @@ outline: deep
|
|||||||
lang: en-US
|
lang: en-US
|
||||||
---
|
---
|
||||||
|
|
||||||
# ASINH
|
# ASINH function
|
||||||
|
## Overview
|
||||||
|
ASINH is a function of the Math and Trigonometry category that calculates the inverse hyperbolic sine (hyperbolic arcsine) of a number, returning the hyperbolic angle expressed in radians.
|
||||||
|
## Usage
|
||||||
|
### Syntax
|
||||||
|
**ASINH(<span title="Number" style="color:#1E88E5">number</span>) => <span title="Number" style="color:#1E88E5">asinh</span>**
|
||||||
|
### Argument descriptions
|
||||||
|
* *number* ([number](/features/value-types#numbers), required). The value whose inverse hyperbolic sine is to be calculated.
|
||||||
|
### Additional guidance
|
||||||
|
The hyperbolic arcsine function is defined as:
|
||||||
|
$$
|
||||||
|
\operatorname{asinh}(x) = \ln\!\left(x + \sqrt{x^2 + 1}\,\right)
|
||||||
|
$$
|
||||||
|
### Returned value
|
||||||
|
ASINH returns a real [number](/features/value-types#numbers) in the range (-∞, +∞) that is the hyperbolic arcsine of the specified value, expressed in radians.
|
||||||
|
### Error conditions
|
||||||
|
* In common with many other IronCalc functions, ASINH propagates errors that are found in its argument.
|
||||||
|
* If no argument, or more than one argument, is supplied, then ASINH returns the [`#ERROR!`](/features/error-types.md#error) error.
|
||||||
|
* If the value of the *number* argument is not (or cannot be converted to) a [number](/features/value-types#numbers), then ASINH returns the [`#VALUE!`](/features/error-types.md#value) error.
|
||||||
|
<!--@include: ../markdown-snippets/error-type-details.txt-->
|
||||||
|
## Details
|
||||||
|
* The ASINH function utilizes the *asinh()* method provided by the [Rust Standard Library](https://doc.rust-lang.org/std/).
|
||||||
|
* The figure below illustrates the output of the ASINH function.
|
||||||
|
<center><img src="/functions/images/hyperbolicarcsine-curve.png" width="350" alt="Graph showing asinh(x)."></center>
|
||||||
|
|
||||||
::: warning
|
## Examples
|
||||||
🚧 This function is implemented but currently lacks detailed documentation. For guidance, you may refer to the equivalent functionality in [Microsoft Excel documentation](https://support.microsoft.com/en-us/office/excel-functions-by-category-5f91f4e9-7b42-46d2-9bd1-63f26a86c0eb).
|
[See some examples in IronCalc](https://app.ironcalc.com/?example=asinh).
|
||||||
:::
|
|
||||||
|
## Links
|
||||||
|
* For more information about inverse hyperbolic functions, visit Wikipedia's [Inverse hyperbolic functions](https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions) page.
|
||||||
|
* See also IronCalc's [SINH](/functions/math_and_trigonometry/sinh), [ACOSH](/functions/math_and_trigonometry/acosh) and [ATANH](/functions/math_and_trigonometry/atanh) functions.
|
||||||
|
* Visit Microsoft Excel's [ASINH function](https://support.microsoft.com/de-de/office/asinh-function-62b4f5b6-d9cc-4c17-9d04-aa5371806c74) page.
|
||||||
|
* Both [Google Sheets](https://support.google.com/docs/answer/3093393) and [LibreOffice Calc](https://wiki.documentfoundation.org/Documentation/Calc_Functions/ASINH) provide versions of the ASINH function.
|
||||||
@@ -4,8 +4,34 @@ outline: deep
|
|||||||
lang: en-US
|
lang: en-US
|
||||||
---
|
---
|
||||||
|
|
||||||
# ATAN2
|
# ATAN2 function
|
||||||
|
## Overview
|
||||||
|
ATAN2 is a function of the Math and Trigonometry category that calculates the inverse tangent (arctangent) for the specified *x* and *y* coordinates. The arctangent returns the angle defined by the x-axis and a line defined by the origin and a point with coordinates (x,y). The returned angle is expressed in radians, in the range (-$\pi$, +$\pi$].
|
||||||
|
## Usage
|
||||||
|
### Syntax
|
||||||
|
**ATAN2(<span title="Number" style="color:#1E88E5">x,y</span>) => <span title="Number" style="color:#1E88E5">atan2</span>**
|
||||||
|
### Argument descriptions
|
||||||
|
* *x* ([number](/features/value-types#numbers), required). Value of the x coordinate.
|
||||||
|
* *y* ([number](/features/value-types#numbers), required). Value of the y coordinate.
|
||||||
|
### Additional guidance
|
||||||
|
If the returned value is positive, it represents a counterclockwise angle from the x-axis, while a negative value represents a clockwise angle.
|
||||||
|
ATAN2(x,y) is equivalent to ATAN(y/x), with the difference that the x argument in ATAN2 can be 0.
|
||||||
|
### Returned value
|
||||||
|
ATAN2 returns a number in radians in the range (-$\pi$, +$\pi$] that is the inverse tangent for the specified x and y coordinates.
|
||||||
|
### Error conditions
|
||||||
|
* In common with many other IronCalc functions, ATAN2 propagates errors that are found in its argument.
|
||||||
|
* If no argument, or arguments other than 2, are supplied, then ATAN2 returns the [`#ERROR!`](/features/error-types.md#error) error.
|
||||||
|
* If the value of either the *x* or *y* argument is not (or cannot be converted to) a [number](/features/value-types#numbers), then ATAN2 returns the [`#VALUE!`](/features/error-types.md#value) error.
|
||||||
|
* If both *x* and *y* are equal to 0, ATAN2 returns a [`#DIV/0!`](/features/error-types.md#div-0) error.
|
||||||
|
<!--@include: ../markdown-snippets/error-type-details.txt-->
|
||||||
|
## Details
|
||||||
|
* The ATAN2 function utilizes the *atan2()* method provided by the [Rust Standard Library](https://doc.rust-lang.org/std/).
|
||||||
|
## Examples
|
||||||
|
[See some examples in IronCalc](https://app.ironcalc.com/?example=atan2).
|
||||||
|
|
||||||
|
## Links
|
||||||
|
* For more information about inverse trigonometric functions, visit Wikipedia's [Inverse trigonometric functions](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) page.
|
||||||
|
* See also IronCalc's [ATAN](/functions/math_and_trigonometry/atan), [TAN](/functions/math_and_trigonometry/tan) and [ASIN](/functions/math_and_trigonometry/asin) functions.
|
||||||
|
* Visit Microsoft Excel's [ATAN2 function](https://support.microsoft.com/en-us/office/atan2-function-51123ced-348c-416a-b2e2-833f7868569f) page.
|
||||||
|
* Both [Google Sheets](https://support.google.com/docs/answer/3093468) and [LibreOffice Calc](https://wiki.documentfoundation.org/Documentation/Calc_Functions/ATAN2) provide versions of the ATAN2 function.
|
||||||
|
|
||||||
::: warning
|
|
||||||
🚧 This function is implemented but currently lacks detailed documentation. For guidance, you may refer to the equivalent functionality in [Microsoft Excel documentation](https://support.microsoft.com/en-us/office/excel-functions-by-category-5f91f4e9-7b42-46d2-9bd1-63f26a86c0eb).
|
|
||||||
:::
|
|
||||||
@@ -4,8 +4,37 @@ outline: deep
|
|||||||
lang: en-US
|
lang: en-US
|
||||||
---
|
---
|
||||||
|
|
||||||
# ATANH
|
# ATANH function
|
||||||
|
## Overview
|
||||||
|
ATANH is a function of the Math and Trigonometry category that calculates the inverse hyperbolic tangent (hyperbolic arctangent) of a number in the range (-1, +1), returning the hyperbolic angle expressed in radians.
|
||||||
|
## Usage
|
||||||
|
### Syntax
|
||||||
|
**ATANH(<span title="Number" style="color:#1E88E5">number</span>) => <span title="Number" style="color:#1E88E5">atanh</span>**
|
||||||
|
### Argument descriptions
|
||||||
|
* *number* ([number](/features/value-types#numbers), required). The value whose inverse hyperbolic tangent is to be calculated, in the range (-1,+1).
|
||||||
|
### Additional guidance
|
||||||
|
The hyperbolic arctangent function is defined as:
|
||||||
|
$$
|
||||||
|
\operatorname{atanh}(x) = \tfrac{1}{2}\,\ln\!\left(\dfrac{1+x}{1-x}\right),\quad |x| < 1
|
||||||
|
$$
|
||||||
|
### Returned value
|
||||||
|
ATANH returns a real [number](/features/value-types#numbers) in the range (-∞, +∞) that is the hyperbolic arctangent of the specified value, expressed in radians.
|
||||||
|
### Error conditions
|
||||||
|
* In common with many other IronCalc functions, ATANH propagates errors that are found in its argument.
|
||||||
|
* If no argument, or more than one argument, is supplied, then ATANH returns the [`#ERROR!`](/features/error-types.md#error) error.
|
||||||
|
* If the value of the *number* argument is not (or cannot be converted to) a [number](/features/value-types#numbers), then ATANH returns the [`#VALUE!`](/features/error-types.md#value) error.
|
||||||
|
* If the value of the *number* argument lies outside the domain (-1, +1), then ATANH returns the [`#NUM!`](/features/error-types.md#num) error.
|
||||||
|
<!--@include: ../markdown-snippets/error-type-details.txt-->
|
||||||
|
## Details
|
||||||
|
* The ATANH function utilizes the *atanh()* method provided by the [Rust Standard Library](https://doc.rust-lang.org/std/).
|
||||||
|
* The figure below illustrates the output of the ATANH function.
|
||||||
|
<center><img src="/functions/images/hyperbolicarctangent-curve.png" width="350" alt="Graph showing atanh(x)."></center>
|
||||||
|
|
||||||
::: warning
|
## Examples
|
||||||
🚧 This function is implemented but currently lacks detailed documentation. For guidance, you may refer to the equivalent functionality in [Microsoft Excel documentation](https://support.microsoft.com/en-us/office/excel-functions-by-category-5f91f4e9-7b42-46d2-9bd1-63f26a86c0eb).
|
[See some examples in IronCalc](https://app.ironcalc.com/?example=atanh).
|
||||||
:::
|
|
||||||
|
## Links
|
||||||
|
* For more information about inverse hyperbolic functions, visit Wikipedia's [Inverse hyperbolic functions](https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions) page.
|
||||||
|
* See also IronCalc's [ASINH](/functions/math_and_trigonometry/asinh), [ACOSH](/functions/math_and_trigonometry/acosh) and [TANH](/functions/math_and_trigonometry/tanh) functions.
|
||||||
|
* Visit Microsoft Excel's [ATANH function](https://support.microsoft.com/de-de/office/atanh-function-453534d1-76a5-4f17-8c04-c3f2feee0dd5) page.
|
||||||
|
* Both [Google Sheets](https://support.google.com/docs/answer/3093397) and [LibreOffice Calc](https://wiki.documentfoundation.org/Documentation/Calc_Functions/ATANH) provide versions of the ATANH function.
|
||||||
@@ -7,6 +7,5 @@ lang: en-US
|
|||||||
# LN
|
# LN
|
||||||
|
|
||||||
::: warning
|
::: warning
|
||||||
🚧 This function is not yet available in IronCalc.
|
🚧 This function is implemented but currently lacks detailed documentation. For guidance, you may refer to the equivalent functionality in [Microsoft Excel documentation](https://support.microsoft.com/en-us/office/excel-functions-by-category-5f91f4e9-7b42-46d2-9bd1-63f26a86c0eb).
|
||||||
[Follow development here](https://github.com/ironcalc/IronCalc/labels/Functions)
|
|
||||||
:::
|
:::
|
||||||
@@ -7,6 +7,5 @@ lang: en-US
|
|||||||
# LOG
|
# LOG
|
||||||
|
|
||||||
::: warning
|
::: warning
|
||||||
🚧 This function is not yet available in IronCalc.
|
🚧 This function is implemented but currently lacks detailed documentation. For guidance, you may refer to the equivalent functionality in [Microsoft Excel documentation](https://support.microsoft.com/en-us/office/excel-functions-by-category-5f91f4e9-7b42-46d2-9bd1-63f26a86c0eb).
|
||||||
[Follow development here](https://github.com/ironcalc/IronCalc/labels/Functions)
|
|
||||||
:::
|
:::
|
||||||
@@ -7,6 +7,5 @@ lang: en-US
|
|||||||
# LOG10
|
# LOG10
|
||||||
|
|
||||||
::: warning
|
::: warning
|
||||||
🚧 This function is not yet available in IronCalc.
|
🚧 This function is implemented but currently lacks detailed documentation. For guidance, you may refer to the equivalent functionality in [Microsoft Excel documentation](https://support.microsoft.com/en-us/office/excel-functions-by-category-5f91f4e9-7b42-46d2-9bd1-63f26a86c0eb).
|
||||||
[Follow development here](https://github.com/ironcalc/IronCalc/labels/Functions)
|
|
||||||
:::
|
:::
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
//! This is primary for QA internal testing and will be superseded by an official
|
//! This is primary for QA internal testing and will be superseded by an official
|
||||||
//! IronCalc CLI.
|
//! IronCalc CLI.
|
||||||
//!
|
//!
|
||||||
//! Usage: test file.xlsx
|
//! Usage: test file.xlsx [output.icalc]
|
||||||
|
|
||||||
use std::path;
|
use std::path;
|
||||||
|
|
||||||
@@ -15,15 +15,20 @@ use ironcalc::{export::save_to_icalc, import::load_from_xlsx};
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args: Vec<_> = std::env::args().collect();
|
let args: Vec<_> = std::env::args().collect();
|
||||||
if args.len() != 2 {
|
if args.len() != 2 && args.len() != 3 {
|
||||||
panic!("Usage: {} <file.xlsx>", args[0]);
|
panic!("Usage: {} <file.xlsx> [output.icalc]", args[0]);
|
||||||
}
|
}
|
||||||
// first test the file
|
// first test the file
|
||||||
let file_name = &args[1];
|
let file_name = &args[1];
|
||||||
|
|
||||||
let file_path = path::Path::new(file_name);
|
let output_file_name = if args.len() == 3 {
|
||||||
let base_name = file_path.file_stem().unwrap().to_str().unwrap();
|
&args[2]
|
||||||
let output_file_name = &format!("{base_name}.ic");
|
} else {
|
||||||
|
let file_path = path::Path::new(file_name);
|
||||||
|
let base_name = file_path.file_stem().unwrap().to_str().unwrap();
|
||||||
|
&format!("{base_name}.ic")
|
||||||
|
};
|
||||||
|
|
||||||
let model = load_from_xlsx(file_name, "en", "UTC").unwrap();
|
let model = load_from_xlsx(file_name, "en", "UTC").unwrap();
|
||||||
save_to_icalc(&model, output_file_name).unwrap();
|
save_to_icalc(&model, output_file_name).unwrap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,30 +264,29 @@ enum ParseReferenceError {
|
|||||||
// There is a similar named function in ironcalc_base. We probably should fix both at the same time.
|
// There is a similar named function in ironcalc_base. We probably should fix both at the same time.
|
||||||
// NB: Maybe use regexes for this?
|
// NB: Maybe use regexes for this?
|
||||||
fn parse_reference(s: &str) -> Result<CellReferenceRC, ParseReferenceError> {
|
fn parse_reference(s: &str) -> Result<CellReferenceRC, ParseReferenceError> {
|
||||||
let bytes = s.as_bytes();
|
|
||||||
let mut sheet_name = "".to_string();
|
let mut sheet_name = "".to_string();
|
||||||
let mut column = "".to_string();
|
let mut column = "".to_string();
|
||||||
let mut row = "".to_string();
|
let mut row = "".to_string();
|
||||||
let mut state = "sheet"; // "sheet", "col", "row"
|
let mut state = "sheet"; // "sheet", "col", "row"
|
||||||
for &byte in bytes {
|
for ch in s.chars() {
|
||||||
match state {
|
match state {
|
||||||
"sheet" => {
|
"sheet" => {
|
||||||
if byte == b'!' {
|
if ch == '!' {
|
||||||
state = "col"
|
state = "col"
|
||||||
} else {
|
} else {
|
||||||
sheet_name.push(byte as char);
|
sheet_name.push(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"col" => {
|
"col" => {
|
||||||
if byte.is_ascii_alphabetic() {
|
if ch.is_ascii_alphabetic() {
|
||||||
column.push(byte as char);
|
column.push(ch);
|
||||||
} else {
|
} else {
|
||||||
state = "row";
|
state = "row";
|
||||||
row.push(byte as char);
|
row.push(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
row.push(byte as char);
|
row.push(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1126,3 +1125,16 @@ pub(super) fn load_sheets<R: Read + std::io::Seek>(
|
|||||||
}
|
}
|
||||||
Ok((sheets, selected_sheet))
|
Ok((sheets, selected_sheet))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use crate::import::worksheets::parse_reference;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parse_reference_works() {
|
||||||
|
let cell_reference = parse_reference("📈 Overview!B2");
|
||||||
|
assert!(cell_reference.is_ok());
|
||||||
|
let cell_reference = cell_reference.unwrap();
|
||||||
|
assert_eq!(cell_reference.sheet, "📈 Overview");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
BIN
xlsx/tests/templates/mortgage_calculator.xlsx
Normal file
BIN
xlsx/tests/templates/mortgage_calculator.xlsx
Normal file
Binary file not shown.
BIN
xlsx/tests/templates/travel_expenses_tracker.xlsx
Normal file
BIN
xlsx/tests/templates/travel_expenses_tracker.xlsx
Normal file
Binary file not shown.
@@ -472,6 +472,45 @@ fn test_exporting_merged_cells() {
|
|||||||
fs::remove_file(temp_file_name).unwrap();
|
fs::remove_file(temp_file_name).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_templates_xlsx() {
|
||||||
|
let mut entries = fs::read_dir("tests/templates/")
|
||||||
|
.unwrap()
|
||||||
|
.map(|res| res.map(|e| e.path()))
|
||||||
|
.collect::<Result<Vec<_>, io::Error>>()
|
||||||
|
.unwrap();
|
||||||
|
entries.sort();
|
||||||
|
let temp_folder = env::temp_dir();
|
||||||
|
let path = format!("{}", Uuid::new_v4());
|
||||||
|
let dir = temp_folder.join(path);
|
||||||
|
fs::create_dir(&dir).unwrap();
|
||||||
|
let mut is_error = false;
|
||||||
|
for file_path in entries {
|
||||||
|
let file_name_str = file_path.file_name().unwrap().to_str().unwrap();
|
||||||
|
let file_path_str = file_path.to_str().unwrap();
|
||||||
|
println!("Testing file: {file_path_str}");
|
||||||
|
if file_name_str.ends_with(".xlsx") && !file_name_str.starts_with('~') {
|
||||||
|
if let Err(message) = test_file(file_path_str) {
|
||||||
|
println!("Error with file: '{file_path_str}'");
|
||||||
|
println!("{message}");
|
||||||
|
is_error = true;
|
||||||
|
}
|
||||||
|
let t = test_load_and_saving(file_path_str, &dir);
|
||||||
|
if t.is_err() {
|
||||||
|
println!("Error while load and saving file: {file_path_str}");
|
||||||
|
is_error = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
println!("skipping");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fs::remove_dir_all(&dir).unwrap();
|
||||||
|
assert!(
|
||||||
|
!is_error,
|
||||||
|
"Models were evaluated inconsistently with XLSX data."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_documentation_xlsx() {
|
fn test_documentation_xlsx() {
|
||||||
let mut entries = fs::read_dir("tests/docs/")
|
let mut entries = fs::read_dir("tests/docs/")
|
||||||
|
|||||||
Reference in New Issue
Block a user