Widget talk:PriceCalculator: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(reply) |
||
Line 12: | Line 12: | ||
::The formula is correct now, but there's a rounding error. Using the numbers from the test case above, the widget gives 53 and 16 instead of 54 and 17. The in-game sell price of 17 is a rounding of 16.666... but the widget uses a "floor" command. The buy price discrepancy puzzles me. 54 is the exact value (30*1.8). You'd think the calculations must have some intermediary steps where rounding takes place, but I don't see it in the code. A similar error happens with persuasion 12, where it gives a buy price of 38 instead of 39. Even more weirdly, using a persuasion value of 11.99999 gives 39, as one would expect, but entering 12 makes it drop to 38. {{unsigned2| 22:28, 22 November 2023|81.82.46.46}} | ::The formula is correct now, but there's a rounding error. Using the numbers from the test case above, the widget gives 53 and 16 instead of 54 and 17. The in-game sell price of 17 is a rounding of 16.666... but the widget uses a "floor" command. The buy price discrepancy puzzles me. 54 is the exact value (30*1.8). You'd think the calculations must have some intermediary steps where rounding takes place, but I don't see it in the code. A similar error happens with persuasion 12, where it gives a buy price of 38 instead of 39. Even more weirdly, using a persuasion value of 11.99999 gives 39, as one would expect, but entering 12 makes it drop to 38. {{unsigned2| 22:28, 22 November 2023|81.82.46.46}} | ||
::: Ah... one of the great problems of programming. I swapped math.floor with math.round which seems to provide exact values now with the given test case. -[[User:Sky|Sky]] ([[User talk:Sky|talk]]) 22:37, 22 November 2023 (CET) |
Latest revision as of 22:37, 22 November 2023
this calculator's math is wrong.
both the effect of persuasion and attitude is half of what it should be.
the correct math is: persuasion *0.1, attitude * 0.005
just did a test to be sure. potion of flying: value 30, tactician difficulty, persuasion modifier 7, 100 attitude. according to "my math" the total modifier is 2.5+0.5-0.7-0.5=1.8. predicted sell price: 30/1.8=17, predicted buy price. 30*1.8=54. matches with in-game numbers.
— unsigned comment by 81.82.46.46 (talk) 21:26, 22 November 2023
- The formula is correct now, but there's a rounding error. Using the numbers from the test case above, the widget gives 53 and 16 instead of 54 and 17. The in-game sell price of 17 is a rounding of 16.666... but the widget uses a "floor" command. The buy price discrepancy puzzles me. 54 is the exact value (30*1.8). You'd think the calculations must have some intermediary steps where rounding takes place, but I don't see it in the code. A similar error happens with persuasion 12, where it gives a buy price of 38 instead of 39. Even more weirdly, using a persuasion value of 11.99999 gives 39, as one would expect, but entering 12 makes it drop to 38. — unsigned comment by 81.82.46.46 (talk) 22:28, 22 November 2023