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

feat: error handling and array expansion #2474

Closed
wants to merge 12 commits into from
Closed

feat: error handling and array expansion #2474

wants to merge 12 commits into from

Conversation

abdelrahman830a
Copy link

@abdelrahman830a abdelrahman830a commented Jun 11, 2024

close #2425

Pull Request Checklist

  • Related tickets or issues have been linked in the PR description (or missing issue).
  • Naming convention is followed (do please check it especially when you created new plugins, commands and resources).
  • Unit tests have been added for the changes (if applicable).
  • Breaking changes have been documented (or no breaking changes introduced in this PR).

@Dushusir Dushusir added the qa:untested This PR is ready to be tested label Jun 11, 2024
}

if (!Number.isFinite(currentValue) || Number(currentValue) < -1 || Number(currentValue) > 1) {
return ErrorValueObject.create(ErrorType.VALUE);
Copy link
Member

@Dushusir Dushusir Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should reports #NUM!
image
Please check other functions for similar situations. We hope to be as consistent as possible with Excel's errors.

Copy link

github-actions bot commented Jun 11, 2024

View Deployment

📑 Examples 📚 Storybook
🔗 Preview link 🔗 Preview link

return ErrorValueObject.create(ErrorType.VALUE);
}

const result = Math.atan2(Number(currentValue1), Number(currentValue2));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two parameters of this formula may be arrays of different sizes. In this case, you need to use expandArrayValueObject to expand the two input parameters. Refer to the usage in Text.

However, I suggest using the existing method atan2 in ArrayValueObejct. If it doesn't work, expand it yourself

@Dushusir
Copy link
Member

Please check the PR title and test errors, and make sure it passes all CI (except Univer Merge Assistant, which is manually triggered by our QA)

}

if (typeof value !== 'number' || value < -1 || value > 1) {
return ErrorValueObject.create(ErrorType.VALUE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=ACOS(3) reports #NUM!
image

@Dushusir
Copy link
Member

Please refer to the second step to complete the internationalization content, refer to https://univer.ai/guides/sheet/customization/formula#how-to-implement-the-formula, just like adding

When you enter the formula, you can trigger the auto-completion, which means that the internationalization content has been added successfully.
image

@abdelrahman830a abdelrahman830a changed the title abs, acos, acosh Modified as per request Feat: error handling and array expansion Jun 11, 2024
@abdelrahman830a abdelrahman830a changed the title Feat: error handling and array expansion feat: error handling and array expansion Jun 11, 2024
@Dushusir Dushusir removed the qa:untested This PR is ready to be tested label Jun 12, 2024
@Dushusir Dushusir marked this pull request as draft June 12, 2024 03:44
@abdelrahman830a abdelrahman830a closed this by deleting the head repository Jun 12, 2024
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

Successfully merging this pull request may close these issues.

[Feature] Supplement Math Formulas for Formula Engine
2 participants