-
Notifications
You must be signed in to change notification settings - Fork 1
Labels
C-C++Code - Pull requests that update C++ code.Code - Pull requests that update C++ code.T-FeatureType - New feature or requestType - New feature or requestT-ImprovementType - Improvements to components.Type - Improvements to components.
Milestone
Description
Is your feature request related to a problem? Please describe.
Currently, the power method takes roots to find out the power, if the exponent is a decimal.
Steppable/src/calc/power/power.cpp
Lines 67 to 79 in bd0b575
| if (isDecimal(raiseTo)) | |
| { | |
| // Raising to decimal power. | |
| // Steps: | |
| // 1. Convert the decimal to a fraction. | |
| // 2. Raise the number to the numerator of the fraction. | |
| // 3. Take the root of the number to the denominator of the fraction. | |
| const auto& fraction = Fraction(raiseTo); | |
| const auto& [top, bottom] = fraction.asArray(); | |
| const auto& powerResult = power(_number, top, 0); | |
| const auto rootResult = root(powerResult, bottom, 8); | |
| return reportPowerRoot(number, raiseTo, fraction, rootResult, steps); | |
| } |
However, on line 77...
Steppable/src/calc/power/power.cpp
Line 77 in bd0b575
| const auto rootResult = root(powerResult, bottom, 8); |
The root function is being called without specifying the number of decimals, so the default 8 decimal places is used. This causes a huge loss in precision.
Describe the solution you'd like
- Add a parameter
decimalstopower.
Describe alternatives you've considered
None yet
Additional context
Add any other context or screenshots about the feature request here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-C++Code - Pull requests that update C++ code.Code - Pull requests that update C++ code.T-FeatureType - New feature or requestType - New feature or requestT-ImprovementType - Improvements to components.Type - Improvements to components.
Projects
Status
Done