Skip to content

Floating point operation is very inaccurate #98

Open
@elvin-du

Description

`
C standard library referenced by POW function < math. H >,result as follows:

double ww = pow(3.0, 0.3) = 1.1293469354568555
double xx = pow(2.2, 0.3) = 1.029005759421095
float yy = powf(2, 0.3) = 1.2311444
float yy = powf(2.4, 0.3) = 1.3003594
long double zz = powl(2, 0.3) = 1
long double mm = powl(2.3, 0.3) = 1.04282000071553305
double aa = pow(1.12, 0.5) = 1.0583005244258363

result using Calculator as follows:

pow(3.0, 0.3) = 1.3903891703159093404852542946161
pow(2.2, 0.3) = 1.2668546920110241257762468650659
powf(2, 0.3) = 1.2311444133449162844993930691677
powf(2.4, 0.3) = 1.3003593134073364931694839670248‬
powl(2, 0.3) = 1.2311444133449162844993930691677
powl(2.3, 0.3) = 1.2838620180052701355554021438659‬
pow(1.12, 0.5) = 1.0583005244258362362006463014557
`

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions