Skip to content

Support formatting mpf/mpc in binary #866

Description

@skirpichev

This already supported by to_str(), but probably could be done more efficiently:

>>> f'{gmpy2.mpfr(1.1):.15b}'
'1.000110011001101p+0'
>>> mpmath.libmp.to_str(x._mpf_, 16, base=2, show_zero_exponent=True, binary_exp=True)[2:]
'1.000110011001101p+0'

For compatibility with gmpy2/MPFR we could utilize same "b" format type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementnew feature requests (or implementation)

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions