Proposal for Interpolation and Extrapolation Interfaces in System.Numerics #8463
Replies: 1 comment 2 replies
-
API requests go in @dotnet/runtime. This repository is just for the language syntax and semantics. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I apologize in advance if this post has landed in the wrong category.
I propose the introduction of generic interfaces for interpolation and extrapolation in the
System.Numerics
namespace. While the immediate use cases may seem limited, these interfaces can provide consistency and flexibility across numeric types.Currently, handling interpolation and extrapolation in numeric operations lacks a standardized approach, which can lead to code duplication and inconsistencies.
The following interfaces could be implemented to streamline interpolation and extrapolation for numeric types:
An example implementation for the Single type (I am going to only post the code relevant to the operations at hand):
By adding these interfaces to the definition of numeric types in C#, we can provide a consistent approach to fairly common operations. Much like how the
ITrigonometricFunctions<T>
interface standardizes handling trigonometric operations with generic types, these interfaces will enhance the flexibility of generic math operations.While the immediate utility might not be apparent, I believe this proposal will open the door for more robust and maintainable code in the future.
Beta Was this translation helpful? Give feedback.
All reactions