[EXT_EP-7591] pow(2,x) has fairly significant rounding error Created: 29/Oct/02  Updated: 24/Jun/22

Status: New
Project: Embedded Software & Tools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Low
Reporter: TI User Assignee: TI User
Resolution: Unresolved Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Product: Code Generation Tools
Internal ID: CODEGEN-62
OldID: SDSCM00008652
Found In Release: C2000_16.9.0.LTS
C2000_18.1.0.LTS
C2000_6.4.0B1
MSP430_20.2.0.LTS
MSP430_21.6.0.LTS
C2000_21.6.0.LTS
MSP430_15.12.0.LTS
C2000_20.2.0.LTS
MSP430_18.1.0.LTS
C2000_22.6.0.LTS
C2000_15.12.0.LTS
MSP430_4.4.0B1
MSP430_18.12.0.LTS
MSP430_16.9.0.LTS
C2000_18.12.0.LTS
C2000_22.6.0.B1
Workaround:
Please describe the workaround for this problem.



 Description   

Description:
The algorithm used for pow [exp(log(x),y)] is correct but sometimes leads to a precision error for some inputs, due to rounding bugs in floating-point handling.

==========================================================

Additional Fields:

StepsToReproduce:

All of these results are exactly representable (powers of two)

% cl2000 -v28 SDSsq34243.c -z -llnk2800.cmd -lrts2800.lib
% load2000 -v28 a.out
pow(2,12) == 45800000 == 4.096000e+03
pow(2,13) == 45fffff8 == 8.191996e+03
pow(2,14) == 46800000 == 1.638400e+04
pow(2,15) == 46fffff8 == 3.276798e+04
pow(2,16) == 47800000 == 6.553600e+04
pow(2,17) == 48000004 == 1.310721e+05
pow(2,18) == 48800000 == 2.621440e+05
pow(2,19) == 49000004 == 5.242882e+05
pow(2,20) == 49800000 == 1.048576e+06
pow(2,21) == 4a000004 == 2.097153e+06
pow(2,22) == 4a800000 == 4.194304e+06
pow(2,23) == 4b000004 == 8.388612e+06
pow(2,24) == 4b800000 == 1.67772

FoundInBuildVersion:

IntegratedBuildState:

IntegratedBuildType:

IntegrationBuildType:

IntegrationBuildVersion:

IntegrationEngineer:

IntegrationEngineerName:

Phase Found In:

Environment:

Host:
Solaris 7

Target :

Custom List :

Custom Data:
DAYS OF EFFORT : 10

CCB Data:


Generated at Mon Apr 07 21:10:11 CDT 2025 using Jira 9.12.17#9120017-sha1:aba4002bcd633f188b6a4bb5dd8a0e1f20b79ee4.