KirkMcDonald / satisfactory-calculator

A ratio calculator for the game Satisfactory.
Apache License 2.0
68 stars 82 forks source link

Overclocking #7

Closed KirkMcDonald closed 5 years ago

KirkMcDonald commented 5 years ago

The calculator should support modeling overclocking of buildings.

For reference, the formula for power consumption while overclocking is:

(base power usage) × (overclock coefficient) ^ 1.6

KirkMcDonald commented 5 years ago

It should be noted that applying an exponent of 1.6 will (usually) result in a value which is irrational, which means that squaring this feature with the calculator's Rational type will be an adventure.

KirkMcDonald commented 5 years ago

Specifically, there are two ways to take this exponent:

  1. Calculate power usage using floats.
  2. Use Newton's method to approximate the value using rationals.

Option 1 is the simplest and probably the most sensible. However, the absurdity of option 2 appeals to me, and it would not actually be that difficult. All that would be required is computing the solution out to a greater precision than will be displayed.

KirkMcDonald commented 5 years ago

Newton's method with rationals turned out to be computationally impractical. Taking a round-trip through a float was immeasurably simpler.

Added in a5305e6cc570fa8ba648986fbca0cf4f1f0fdfcb.