fxpmath | python library for fractional fixed | Data Manipulation library

 by   francof2a Python Version: 0.4.9 License: MIT

kandi X-RAY | fxpmath Summary

kandi X-RAY | fxpmath Summary

fxpmath is a Python library typically used in Utilities, Data Manipulation, Numpy applications. fxpmath has no vulnerabilities, it has build file available, it has a Permissive License and it has low support. However fxpmath has 1 bugs. You can install using 'pip install fxpmath' or download it from GitHub, PyPI.

A python library for fractional fixed-point (base 2) arithmetic and binary manipulation with Numpy compatibility. visit documentation for more information. See some examples in the examples folder.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              fxpmath has a low active ecosystem.
              It has 91 star(s) with 15 fork(s). There are 5 watchers for this library.
              There were 1 major release(s) in the last 12 months.
              There are 5 open issues and 42 have been closed. On average issues are closed in 37 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of fxpmath is 0.4.9

            kandi-Quality Quality

              fxpmath has 1 bugs (0 blocker, 0 critical, 1 major, 0 minor) and 70 code smells.

            kandi-Security Security

              fxpmath has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              fxpmath code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              fxpmath is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              fxpmath releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              It has 3488 lines of code, 294 functions and 18 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed fxpmath and discovered the below as its top functions. This is intended to give you an instant insight into fxpmath implemented functionality, and help decide if they suit your requirements.
            • Set the value of the word .
            • Sum values along axis .
            • r Pow .
            • Convert a string to a number .
            • Compute a function over two variables .
            • Evaluate a function over a single variable .
            • Compute the polynomial .
            • Calculate the size of the given variables .
            • Initialize parameters .
            • Compute the truediv derivative .
            Get all kandi verified functions for this library.

            fxpmath Key Features

            No Key Features are available at this moment for fxpmath.

            fxpmath Examples and Code Snippets

            copy
            Pythondot img1Lines of Code : 32dot img1License : Permissive (MIT)
            copy iconCopy
            y = x.copy()        # copy also the value stored
            # or
            y = x.deepcopy()
            
            # if you want to preserve a value previously stored in `y` and only copy the properties from `x`:
            y = y.like(x)
            
            y = x.copy()(-1.25)     # where -1.25 y the new value for `y` aft  
            arithmetic
            Pythondot img2Lines of Code : 30dot img2License : Permissive (MIT)
            copy iconCopy
            0.75 + x    # add a constant
            x - 0.125   # substract a constant
            3 * x       # multiply by a constant
            x / 1.5     # division by a constant
            x // 1.5    # floor division by a constant
            x % 2       # modulo
            x ** 3      # power
            
            y = 3.25 * (x - 0.5)    # y  
            behaviors,rounding
            Pythondot img3Lines of Code : 14dot img3License : Permissive (MIT)
            copy iconCopy
            # at instantiation
            x = Fxp(3.25, True, 16, 8, rounding='floor')
            
            # after ...
            x.rounding = 'trunc'
            # or ...
            x.rounding = 'around'
            x.rounding = 'floor'
            x.rounding = 'ceil'
            x.rounding = 'fix'
            
            print(x.precision)              # print the precision of x
            
              

            Community Discussions

            QUESTION

            How to use pow() in fxpmath library
            Asked 2021-Aug-25 at 16:46

            I'm using the fxpmath library but basic arithmetic doesn't seem to work. Are values getting corrupted or am I using powers that should not be computed?

            ...

            ANSWER

            Answered 2021-Aug-20 at 15:25

            The documentation says:

            The constant is converted into a new Fxp object before math operation, where the Fxp size for the constant operand is defined by x.config.op_input_size in examples above. The default value for op_input_size is 'best' (best enoguh precision to represent the constant value), but it could be used 'same' to force the constant's size equals to Fxp object size (x in the examples).

            If you enter x.config.op_input_size, it prints 'same' rather than 'best'. So, try changing the config by entering x.config.op_input_size='best'.

            The code looks something like this:

            Source https://stackoverflow.com/questions/68863772

            QUESTION

            Properly converting float64 to 16bit fixed point for PYNQ
            Asked 2021-May-06 at 13:04

            I need to convert a float64 value into a fixed point <16,15> (16 bit with 15 bit in the fractional part and 1 in the integer part).

            I have already read many solutions:

            1. Convert floating point to fixed point
            2. Simple Fixed-Point Conversion in C
            3. The fxpmath library

            However I have not really understood the "type" I need in my specific case.

            To explain this better, I have implemented a code that generates a simple sine wave inside PYNQ (the Xilinx framework based on Python):

            ...

            ANSWER

            Answered 2021-May-06 at 13:04

            I suppose that FFT expects ap_fixed<16,15>, where MSB is the sign bit. In your example you have signed samples (because sinusoidal between -1.0 and 1.0), so your casting must be int (signed int). But if you need a two-complement representation of signed int, it's right if you cast with uint. In both cases, cast with 16 bits is enough.

            Source https://stackoverflow.com/questions/66852594

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install fxpmath

            To install from pip just do the next:.

            Support

            Fxp can handle following input data types:.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • PyPI

            pip install fxpmath

          • CLONE
          • HTTPS

            https://github.com/francof2a/fxpmath.git

          • CLI

            gh repo clone francof2a/fxpmath

          • sshUrl

            git@github.com:francof2a/fxpmath.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link