Fxpmath Versions Save

A python library for fractional fixed-point (base 2) arithmetic and binary manipulation with Numpy compatibility.

v0.4.9

3 months ago

version 0.4.9

  • Fix wrap fuction over n_word_max (issue #41).
  • Inaccuracy flag is propagated to a new Fxp or resulting Fxp if one or more input Fxp are inaccurate (issue #48).
  • New from_bin method and function. Set value or create new Fxp from a binary string (issue #49).
  • Support to complex binary strings as input format.
  • Force to config.op_input_size='best' when power operation has an constant operator (non-Fxp). Add warning message. (issue #89).
  • Selection of prefix for binary and hexadecimal representations.
  • Fix cumsum function bug when dealing with sizes bigger than 32 bits (windows) / 64 bits (linux) (issue #76).
  • Fix numpy.reshape function handling. This function was returning optimal size instead of same by default (issue #77).
  • Fix negative number parsing in dtype string (issue #80).

Solved issues

#41 #48 #49 #76 #77 #80 #89

Thanks to

@desvdp @edschofield @nfrancque @Ethan-lsh @alb-pol @jrmoserbaltimore for reporting fixed issues and everyone else whose issues are still open.

v0.4.8

2 years ago

version 0.4.8

  • Fix value dtype handling for windows OS and uint as 32 bits (issue #60).
  • __getitem__ method return a Fxp with raw value as view (issue #62).
  • Add tests for issues #60 and #62.

Thanks to:

@DanChianucci , @lucacutrignelli

v0.4.7

2 years ago

version 0.4.7

  • Keep val as original_vdtype and not as object when it is convenient (solve issue #60).
  • Convert vdtype to float when scaling transformation is applied.
  • Add abs method.

Thanks to: @DanChianucci for issue #60

v0.4.6

2 years ago

version 0.4.6

  • Fix complex truediv and floordiv methods (issue #53).
  • Fix complex binary, hexadecimal and base representation for arrays (issue #56).
  • Tests updates for complex representations.
  • Solve init by dtype when it is complex (issue #58).

Thanks to: @ruoting0103 , @mousecat98

v0.4.5

2 years ago

version 0.4.5

  • Fix FutureWarning in subdtype 'str' comparison (issue #45).
  • dtype argument added to resize method.
  • new method get_dtype to get dtype using argument notation.
  • Docstring of get_dtype, resize, reshape, flatten, set_val, astype, get_val, raw, uraw, equal
  • Order parameter for reshape and flatten methods.

Thanks to

@qarlosalberto (issue #45)

v0.4.4

2 years ago

version 0.4.4

  • Fix wrapping and scaling issue #44.

thanks to @desvdp

v0.4.3

2 years ago

version 0.4.3

  • Fxp adds config as optional init parameter (kwarg).
  • Functions (operators) over one and two variables copy first operator configuration by default.
  • Changes above fixed wrap overflowing bug after operation (issue #42 solved).
  • Wrap function of utils fix bug when data has more than n_word_max (64 bits in the most of cases) (issue #41 soved).
  • Config new methods: copy, deepcopy.
  • Fix warning about internal complex check (issue #39).
  • Add link implementation between functions.truediv with numpy.divide.
  • Add axes parameter to transpose method.

v0.4.2

2 years ago

version 0.4.2

  • Add template to Config object.
  • Fix config update from Fxp's template.

0.4.1

2 years ago

changelog

  • Test Numpy precision at init.
  • Independent definition of n_word_max and error for config.
  • Fix astype casting when dtype and vdtype is None.
  • Fix casting to object in extended cumprod function.
  • Independent definition of n_word_max and error for config.
  • Fix astype casting when dtype and vdtype is None.
  • Fix casting to object in extended cumprod function.
  • Fix casting to object in extended precision multiply.
  • Fix casting to object inside constructor.
  • fix integer repr
  • support numpy array of strings

Issues fixed: #26, #31

0.4.0

3 years ago

version 0.4.0

changelog

  • Extended precision (beyond 64 bits) in add, sub, mult, truediv, floordiv, mod and pow functions and methods (operators).
  • Support new input formats for values: tuples, Decimal type from decimal module.
  • dtype can be specified at init if fxp format or Q format (it replaces explicit sizing by signed, n_word, and n_frac parameters).
  • Template functionality added. It allows define default format for new Fxp objects.
  • Config class created to manage low level configuration of Fxp object's behavior.
    • size limits: max_error, n_word_max. Parameters to define n_word and n_frac of a new Fxp.
    • behavior: op_method (defines calculation method for ALU operators).
    • inputs: op_input_size (defines sizing of constant conversion to Fxp in math operations).
    • alu ops outpus: op_out, op_out_like, op_sizing (define the sizing method or type for results of ALU operations).
    • alu ops with a constant operand: const_op_sizing (alternative of op_sizing when one of ALU operands is a constant).
    • array ops: array_output_type (defines the object type when use Numpy functions: Numpy Array or Fxp), array_op_out, array_op_out_like (define the output's size), array_op_method (defines calculation method for ALU operators).
  • Several core calculations/methods mirgrated from float to int to support extended precision.
  • Extended precision flag in status (extended_prec).
  • Results of ALU operations with constants keep same size than Fxp object (by default).
  • like initialization supports overwrite of size parameters.
  • Numpy functions dispatch. You can use Fxp as arguments (inputs) of Numpy functions and get Fxp as outputs of them.
  • New Fxp properties: size, shape, ndim, T.
  • New Fxp methods: reshape, flatten, raw, uraw.
  • New Fxp methods from Numpy array methods: all, any, argmax, argmin, argpartition, argsort, max, min, mean, std, var, sum, cumsum, cumprod, ravel, tolist, sort, conjugate, conj, transpose, item, clip, diagonal, trace, prod, dot, nonzero.
  • Support for bool, int, float and complex casting.
  • dtype included in Fxp's representation (repr).
  • Callbacks (basic) functionality added: on_value_change, on_status_overflow, on_status_underflow, on_status_inaccuracy.
  • Some performance improvements.

Notes:

It is recommended use Numpy version >= 1.17.x to enable functions dispatch by default. If it's not the case, it is recommended import fxpmath before numpy or set OS envirnment variable "NUMPY_EXPERIMENTAL_ARRAY_FUNCTION" = "1" before import numpy.


Thanks to: @MaenMallah, @FredKellerman, @arnfol, @JoachimKoenigslieb, @masan4444, @NJDFan for all issues and contributions.