-
Notifications
You must be signed in to change notification settings - Fork 3
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
Way to indicate out of range? #2
Comments
Hey, thanks for getting in touch! Personally I'd prefer keeping the signature for
I actually find it useful that the function is well-defined outside the X domain - this way it can be used wherever a |
That would work for me. Do you want me to submit a pr to do that with tests?
Chris
…On Sun, Oct 13, 2019 at 9:24 PM Sergey Grebenshchikov < ***@***.***> wrote:
Hey, thanks for getting in touch! Would something like func (f Function)
IsInterpolatedAt(x float64) bool perhaps also cover your use-case? So you
could then do
if !f.IsInterpolatedAt(x) {
// x is not within domain X, f.At(x) is guaranteed to be zero
return
}
// x is within domain X, f.At(x) might be non-zero
I actually find it useful that the function is well-defined outside the X
domain - this way it can be used wherever a ´f(float)float´ is expected. So
personally I'd prefer keeping the signature for At. Open to discussion
though :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2?email_source=notifications&email_token=AAJH4AGGLGZCKO4EVEAB64LQOPC5ZA5CNFSM4JAJPLLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBDFDUI#issuecomment-541479377>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJH4AFG4IUKVEIDBYURUKTQOPC5ZANCNFSM4JAJPLLA>
.
|
Yes, please! And if you have a better idea for the name than I did ( Sergey |
Hi @sgreben I opened a PR and commented about the implementation. I wasn't sure there was a clean way to figure out if the value was out of range so went the route of extending the existing At() function. I would appreciate feedback and can adjust if necessary. |
Addressed in #3 Thanks! |
Would a pull request to modify At() to return (float64, error) be accepted? In my use case I'd prefer not to rely on a magic value of 0 to indicate not found but would propose instead we returned something like 0, fmt.Errorf("value out of range") so the user could decide how to handle those cases?
The text was updated successfully, but these errors were encountered: