Skip to content

Instantly share code, notes, and snippets.

@Iruyan-Zak
Last active October 20, 2017 05:00
Show Gist options
  • Save Iruyan-Zak/ecaa63d462cc0572782d9b343579cbd8 to your computer and use it in GitHub Desktop.
Save Iruyan-Zak/ecaa63d462cc0572782d9b343579cbd8 to your computer and use it in GitHub Desktop.
入力は-1
0: -1.000000
1: 0.000000
2: inf
3: 1.000000
4: 2.000000
5: 1.500000
6: 1.666667
7: 1.600000
8: 1.625000
9: 1.615385
10: 1.619048
11: 1.617647
12: 1.618182
13: 1.617978
1.1: x = 1.618056
0: -1.000000
1: -0.666667
2: -0.619048
3: -0.618034
1.2: x = -0.618034
2: The answer is -0.003025
3.1: The answer is 0.000000
3.2: The answer is 0.000005
3.3: The answer is 0.000005
@kamuiroeru
Copy link

should be

printf("2: The answer is %0.3lf", ans2);

@Iruyan-Zak
Copy link
Author

引き算の有効数字桁数のルール的にその通りだと思うので内容を更新します。

@Iruyan-Zak
Copy link
Author

いや、教員いわくそうではないらしい
ちゃんと6桁出力しましょう。
答えは0.003000でも良い気がします。(問題で値が定まっているため)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment