fibonacci/solution.c: prints negative numbers for n of 47 or more (F(90) prints -1581614984)
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 25/100
Direção de pesquisa
Start in problems/fibonacci/solution.c, where the value is computed in a type too narrow for F(47) and above, and compare with the Go, C++ and Python solutions. Add the failing inputs (47, 79, 90) to problems/fibonacci/cases.txt, then run python3 run.py fibonacci. Done when those inputs print 2971215073, 14472334024676221 and 2880067194370816120. Pull request #31 is already open against this, so check it before starting.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
What I did
- Fresh checkout of
main, a C compiler. - Compile and run the C solution:
cd problems/fibonacci
gcc solution.c -o fib
echo 46 | ./fib
echo 47 | ./fib
echo 79 | ./fib
echo 90 | ./fib
What I expected
The problem README says: "Read n (0 <= n <= 90) and print the nth Fibonacci number ... F(90) is 2880067194370816120, so think about which number type can hold it." (problems/fibonacci/README.md)
So 47 should print 2971215073, 79 should print 14472334024676221, and 90 should print 2880067194370816120.
What happened instead
46 -> 1836311903 (correct)
47 -> -1323752223
79 -> -660827267
90 -> -1581614984
Every n from 47 to 90 is wrong. The Go, C++ and Python solutions print the correct values. python3 run.py fibonacci passes today because cases.txt has no input above 46.
Environment
code-corner main @ 0c95800, gcc 16.2, Windows 11.
I'd like to work on the fix for this, and add the failing inputs to cases.txt as the Contributing section asks.
- Linguagem predominante
- Python
- Estrelas
- 1
- Forks
- 6
- Merge médio
- 12h 42min
- PRs com merge (30d)
- 10
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Sem guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de techcsispit/code-corner
-
prime/solution.java doesn't compile: public class PrimeCheck in solution.java, README requires Solution.java with a Solution classTalvez já em andamento @tanujb03 assumiu hoje. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 82/100
techcsispit/code-corner#35 ·
Mantenedores costumam responder em até 1 dia
-
run.py: Python solutions are skipped on Windows when run via python instead of python3Talvez já em andamento @tanujb03 assumiu hoje. Abertabug good first issue
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 15/100
techcsispit/code-corner#29 ·
Mantenedores costumam responder em até 1 dia
-
binary-search/Solution.java: prints -1 when the target is the last element (`9 1 3 5 7 9`) or in a 1-element list (`5 5`)Talvez já em andamento @tanujb03 assumiu hoje. Abertabug good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 22/100
techcsispit/code-corner#26 ·
Mantenedores costumam responder em até 1 dia
-
roman-numerals/solution.go: 4 prints IIII and 1994 prints MDCCCCLXXXXIIII (no subtractive forms)Talvez já em andamento @tanujb03 assumiu há 1 dia. Abertabug good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 25/100
techcsispit/code-corner#25 ·
Mantenedores costumam responder em até 1 dia
-
Solution runner ignores non-zero exit codesTalvez já em andamento @jay23606 assumiu hoje. Abertabug good first issue
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 62/100
techcsispit/code-corner#18 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de techcsispit/code-corner
Issues semelhantes
-
[BUG] Container scenario crashes without expected_recovery_time, kube DNS example uses retry_waitAbertaneeds-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
krkn-chaos/krkn#1627 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
NousResearch/hermes-agent#136483 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
Mantenedores costumam responder em até 1 dia
-
[BUG] LazyStackedTensorDictStore zeroes the last byte of a new key set on the last elementTalvez já em andamento @peterdsharpe assumiu hoje. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
pytorch/tensordict#2307 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia