fibonacci/solution.c: prints negative numbers for n of 47 or more (F(90) prints -1581614984)
維護者通常 1 天內回覆
評估
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- Python
- 星號
- 1
- 分支
- 6
- 平均合併
- 23 小時 30 分鐘
- 30 天內合併 PR
- 20
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 沒有貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
techcsispit/code-corner 的其他 Issue
-
prime/solution.java doesn't compile: public class PrimeCheck in solution.java, README requires Solution.java with a Solution class可能已有人在做 @tanujb03 於 5 天前認領。 未關閉bug good first issue
難度 1/5 1 小時以內 新手友好度 82/100
techcsispit/code-corner#35 ·
維護者通常 1 天內回覆
-
Failed compilations always report 0.000 seconds可能已有人在做 @Nik-2208 於 3 天前認領。 未關閉bug good first issue
難度 2/5 1-3 小時 新手友好度 35/100
techcsispit/code-corner#37 · 1 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Add test cases to a problem可能已有人在做 @25crns 於 12 天前認領。 未關閉good first issue tests
techcsispit/code-corner#2 · 3 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
查看 techcsispit/code-corner 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
huggingface/sentence-transformers#4186 ·
維護者通常 5 天內回覆
-
documentation good first issue
難度 2/5 半天 新手友好度 72/100
sujithputta02/Esapay#13 ·
-
bot-triaged module: correctness (silent) module: mps module: NaNs and Infs triage review
難度 2/5 半天 新手友好度 62/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
SCIInstitute/SCIRun#2842 ·
維護者通常 3 天內回覆