Functions

The fixedpoint module functions provide the same functionality as the FixedPoint methods of the same name, but make a copy of the FixedPoint object and operate on it, instead of modifying the object itself.

Examples are just a click away

Boxes like this link to example code.

fixedpoint.resize(fp, m, n, /, rounding=None, overflow=None, alert=None)
Parameters
  • fp (FixedPoint) – Object to copy and operate on

  • m (int) – Number of integer bits to resize to.

  • n (int) – Number of fractional bits to resize to

  • rounding (str) – Temporary rounding scheme to use. Can be keyworded.

  • overflow (str) – Temporary overflow scheme to use. Can be keyworded.

  • alert (str) – Temporary overflow_alert scheme to use. Can be keyworded.

Return type

FixedPoint

Raises

FixedPointOverflowError – if resizing causes overflow (raised only if alert - or overflow_alert if alert is not specified - is 'error').

Refer to FixedPoint.resize() for more details.

Jump to Examples

fixedpoint.trim(fp, /, ints=None, fracs=None)
Parameters
  • fp (FixedPoint) – Object to copy and operate on

  • ints (bool) – Set to True to trim off superfluous integer bits

  • fracs (bool) – Set to True to trim off superfluous fractional bits

Return type

FixedPoint

Refer to FixedPoint.trim() for more details.

Jump to Examples

fixedpoint.convergent(fp, n, /)
fixedpoint.round_convergent(fp, n, /)
Parameters
  • fp (FixedPoint) – Object to copy and operate on

  • n (int) – Number of fractional bits remaining after rounding

Return type

FixedPoint

Raises

FixedPointOverflowError – if rounding causes overflow (raised only if overflow_alert is 'error')

Refer to FixedPoint.convergent() for more details.

fixedpoint.round_nearest(fp, n, /)
Parameters
  • fp (FixedPoint) – Object to copy and operate on

  • n (int) – Number of fractional bits remaining after rounding

Return type

FixedPoint

Raises

FixedPointOverflowError – if rounding causes overflow (raised only if overflow_alert is 'error')

Refer to FixedPoint.round_nearest() for more details.

fixedpoint.round_in(fp, n, /)
Parameters
  • fp (FixedPoint) – Object to copy and operate on

  • n (int) – Number of fractional bits remaining after rounding

Return type

FixedPoint

Refer to FixedPoint.round_in() for more details.

fixedpoint.round_out(fp, n, /)
Parameters
  • fp (FixedPoint) – Object to copy and operate on

  • n (int) – Number of fractional bits remaining after rounding

Return type

FixedPoint

Raises

FixedPointOverflowError – if rounding causes overflow (raised only if overflow_alert is 'error')

Refer to FixedPoint.round_out() for more details.

fixedpoint.round_up(fp, n, /)
Parameters
  • fp (FixedPoint) – Object to copy and operate on

  • n (int) – Number of fractional bits remaining after rounding

Return type

FixedPoint

Raises

FixedPointOverflowError – if rounding causes overflow (raised only if overflow_alert is 'error')

Refer to FixedPoint.round_up() for more details.

fixedpoint.round_down(fp, n, /)
Parameters
  • fp (FixedPoint) – Object to copy and operate on

  • n (int) – Number of fractional bits remaining after rounding

Return type

FixedPoint

Refer to FixedPoint.round_down() for more details.

fixedpoint.keep_msbs(fp, m, n, /, rounding=None, overflow=None, alert=None)
Parameters
  • fp (FixedPoint) – Object to copy and operate on

  • m (int) – Number of integer bits in the result

  • n (int) – Number of fractional bits in the result

  • rounding (str) – Temporary rounding scheme to use. Can be keyworded.

  • overflow (str) – Temporary overflow scheme to use. Can be keyworded.

  • alert (str) – Temporary overflow_alert scheme touse. Can be keyworded.

Return type

FixedPoint

Raises

FixedPointOverflowError – if rounding causes overflow (raised only if alert - or overflow_alert if alert is not specified - is 'error')

Refer to FixedPoint.keep_msbs() for more details.

fixedpoint.clamp(fp, m, /, alert=None)
Parameters
  • fp (FixedPoint) – Object to copy and operate on

  • m (int) – Number of integer bits remaining after clamping

  • alart (str) – Temporary overflow_alert scheme to use. Can be keyworded.

Return type

FixedPoint

Raises

FixedPointOverflowError – if reducing integer bit width causes overflow (raised only if alert - or overflow_alert if alert is not specified - is 'error')

Refer to FixedPoint.clamp() for more details.

fixedpoint.wrap(fp, m, /, alert=None)
Parameters
  • fp (FixedPoint) – Object to copy and operate on

  • m (int) – Number of integer bits remaining after wrapping

  • alart (str) – Temporary overflow_alert scheme to use. Can be keyworded.

Return type

FixedPoint

Raises

FixedPointOverflowError – if reducing integer bit width causes overflow (raised only if alert - or overflow_alert if alert is not specified - is 'error')

Refer to FixedPoint.wrap() for more details.

fixedpoint.keep_lsbs(fp, m, n, /, overflow=None, alert=None)
Parameters
  • fp (FixedPoint) – Object to copy and operate on

  • m (int) – Number of integer bits in the result

  • n (int) – Number of fractional bits in the result

  • overflow (str) – Temporary overflow scheme to use. Can be keyworded.

  • alert (str) – Temporary overflow_alert scheme to use. Can be keyworded.

Return type

FixedPoint

Raises

FixedPointOverflowError – if reducing integer bit width causes overflow (raised only if alert - or overflow_alert if alert is not specified - is 'error')

Refer to FixedPoint.keep_lsbs() for more details.