Implement forecast function#1324
Merged
tonyqus merged 5 commits intoMay 12, 2024
Merged
Conversation
ken-swyfft
commented
May 1, 2024
ken-swyfft
commented
May 1, 2024
Member
Contributor
Author
|
I see that the |
Member
Ubuntu test usually fails. No worries. It's not caused by your code. |
Member
|
LGTM |
This was referenced Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is my first PR for NPOI, and I'm still very much a newbie when it comes to the codebase. But this was a function that we needed, and it seemed like this was the easiest way to get it done.
Please let me know if there's anything I could/should be doing differently or better, or if there's anything I missed.
Copilot Description
This pull request introduces changes to the codebase to implement the Excel FORECAST function in the
NPOI.SS.Formula.Functionsnamespace. The most significant changes include the addition of theForecastclass, a modification to theProduceFunctionsmethod in theFunctionEvalclass to use this newForecastclass, and the addition of unit tests to verify the functionality of theForecastclass.Here are the top five most important changes:
Codebase expansion:
main/SS/Formula/Functions/Forecast.cs: Added theForecastclass which represents the Excel FORECAST function. This function predicts a future value along a linear trend line based on existing historical data. The class includes methods for convertingValueEvalobjects to numeric arrays and for creatingValueVectors.Codebase modification:
main/SS/Formula/Eval/FunctionEval.cs: Modified theProduceFunctionsmethod to use the newForecastclass instead of theNotImplementedFunctionfor the FORECAST function.Codebase configuration:
build/_build.csproj.DotSettings: Added user rules for C# naming conventions and updated the settings migration to reflect these changes. [1] [2]Testing:
testcases/main/SS/Formula/Functions/TestForecast.cs: Added a new test classTestForecastfor theForecastfunction. This class includes tests for basic functionality, handling of large numbers and arrays, error propagation, and a test replicating an example from the Microsoft support website.