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

Handling fibonacci for negative numbers and 0 #42

Closed
PoojaKhandhadia opened this issue Oct 7, 2019 · 7 comments · Fixed by #55
Closed

Handling fibonacci for negative numbers and 0 #42

PoojaKhandhadia opened this issue Oct 7, 2019 · 7 comments · Fixed by #55
Assignees
Labels
beginner friendly bug Something isn't working

Comments

@PoojaKhandhadia
Copy link

PoojaKhandhadia commented Oct 7, 2019

Function fibonacciTabular is not handled if a negative number is provided. It returns undefined as output.

If 0 is given as index in fibonacciTabular it returns 0 instead of 1.

@ashokdey For the functions fibonacci and fibonacciMemoized if negative numbers are provided the output is coming as 1. Is it correct to handle in such a way that the output should be 1 or it should be handled that the output comes as 0?

@PoojaKhandhadia PoojaKhandhadia changed the title Handling fibonacci for negative numbers Handling fibonacci for negative numbers and 0 Oct 7, 2019
@SumeetHaryani
Copy link
Contributor

@ashokdey I would like to work on this issue.

@ashokdey
Copy link
Member

ashokdey commented Oct 7, 2019

Thanks @PoojaKhandhadia, I really appreciate your skills and efforts. I would also like to know whether you are interested to be a full-time maintainer of this project putting more stress on Unit Tests?

Also thank you @SumeetHaryani, your PR #33 has fixed this. I am looping in @TheSTL for cross-validation before I close this.

@TheSTL
Copy link
Member

TheSTL commented Oct 7, 2019

It should throw error if index is negative.
And Fibonacci series start from 0,1,1,2,3........

@PoojaKhandhadia
Copy link
Author

@ashokdey Sounds great!! Thanks for this. I would love to take this up!!!

@ashokdey
Copy link
Member

ashokdey commented Oct 8, 2019

Great @PoojaKhandhadia, please drop me a mail with your contact details and availability for this task here: ad@ashokdey.in 🎉

@PoojaKhandhadia
Copy link
Author

@ashokdey @TheSTL I was just going through this.... the current change returns the negative number itself instead of error.

@SumeetHaryani
Copy link
Contributor

@PoojaKhandhadia working on it, will raise PR soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginner friendly bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants