Skip to content

ENH: Bitwise reproducible np.log #26117

@zmbc

Description

@zmbc

Proposed new feature or change:

I was quite surprised to not find a way to make the following result bitwise reproducible:

>> import np
>> np.log(0.04048147466152369)
-3.206910825280994

I got the above result on a Intel(R) Xeon(R) Gold 6130 CPU @ 2.10GHz; on a Intel(R) Xeon(R) CPU E5-2660 v4 @ 2.00GHz I get:

>> import np
>> np.log(0.04048147466152369)
-3.2069108252809944

I understand that this is due to floating-point imprecision; I am not asking for the result to be more precise, but just to have a way to make it imprecise in the same way across CPUs. For even very complicated BLAS operations I can do this with MKL's CNR, but I have yet to find a way to do so in this case.

The simple workaround of manually defining an approximation of e seems to work, so it seems like this should be possible to support in Numpy.

Metadata

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