smlgit / fpbinary Goto Github PK
View Code? Open in Web Editor NEWFixed point package for Python.
License: GNU General Public License v2.0
Fixed point package for Python.
License: GNU General Public License v2.0
Current OverflowEnum and RoundEnum are instances of classes. It makes more sense for these to be types with static fields. This will also make documentation easier.
Hello,
First of all, thanks for this awesome library. I've working a lot with it on linux.
But now, I'd need to install it on Windows 10. And in Windows it's a problem. I've already installed pip 20 and wheel, and I've installed the following Visual Studio Build tools for C++:
But I still get errors when I try to install fpbinary:
pip install git+https://github.com/smlgit/fpbinary.git
Collecting git+https://github.com/smlgit/fpbinary.git
Cloning https://github.com/smlgit/fpbinary.git to c:\users\user\appdata\local\temp\pip-req-build-sy5d5jbv
Running command git clone -q https://github.com/smlgit/fpbinary.git 'C:\Users\User\AppData\Local\Temp\pip-req-build-sy5d5jbv'
Building wheels for collected packages: FpBinary
Building wheel for FpBinary (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\User\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\User\AppData\Local\Temp\pip-req-build-sy5d5jbv\setup.py'"'"'; file='"'"'C:\Users\User\AppData\Local\Temp\pip-req-build-sy5d5jbv\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\User\AppData\Local\Temp\pip-wheel-3zorn_su'
cwd: C:\Users\User\AppData\Local\Temp\pip-req-build-sy5d5jbv
Complete output (47 lines):
running bdist_wheel
running build
running build_ext
building 'fpbinary' extension
creating build
creating build\temp.win-amd64-3.8
creating build\temp.win-amd64-3.8\Release
creating build\temp.win-amd64-3.8\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMAJOR_VERSION=1 -DMINOR_VERSION=3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/fpbinarymodule.c /Fobuild\temp.win-amd64-3.8\Release\src/fpbinarymodule.obj
fpbinarymodule.c
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMAJOR_VERSION=1 -DMINOR_VERSION=3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/fpbinaryglobaldoc.c /Fobuild\temp.win-amd64-3.8\Release\src/fpbinaryglobaldoc.obj
fpbinaryglobaldoc.c
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMAJOR_VERSION=1 -DMINOR_VERSION=3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/fpbinarycommon.c /Fobuild\temp.win-amd64-3.8\Release\src/fpbinarycommon.obj
fpbinarycommon.c
src/fpbinarycommon.c(306): warning C4244: 'function': conversion from 'unsigned __int64' to 'int', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMAJOR_VERSION=1 -DMINOR_VERSION=3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/fpbinarysmall.c /Fobuild\temp.win-amd64-3.8\Release\src/fpbinarysmall.obj
fpbinarysmall.c
src/fpbinarysmall.c(361): warning C4244: 'function': conversion from '__int64' to 'int', possible loss of data
src/fpbinarysmall.c(571): warning C4244: 'function': conversion from '__int64' to 'int', possible loss of data
src/fpbinarysmall.c(575): warning C4244: 'function': conversion from '__int64' to 'int', possible loss of data
src/fpbinarysmall.c(585): warning C4244: 'function': conversion from '__int64' to 'long', possible loss of data
src/fpbinarysmall.c(586): warning C4244: 'function': conversion from '__int64' to 'long', possible loss of data
src/fpbinarysmall.c(638): warning C4244: '=': conversion from '__int64' to 'long', possible loss of data
src/fpbinarysmall.c(639): warning C4244: '=': conversion from '__int64' to 'long', possible loss of data
src/fpbinarysmall.c(1151): warning C4244: 'function': conversion from '__int64' to 'long', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMAJOR_VERSION=1 -DMINOR_VERSION=3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/fpbinarylarge.c /Fobuild\temp.win-amd64-3.8\Release\src/fpbinarylarge.obj
fpbinarylarge.c
src/fpbinarylarge.c(549): warning C4244: '=': conversion from '__int64' to 'long', possible loss of data
src/fpbinarylarge.c(551): warning C4244: '=': conversion from '__int64' to 'long', possible loss of data
src/fpbinarylarge.c(1559): warning C4244: 'function': conversion from '__int64' to 'long', possible loss of data
src/fpbinarylarge.c(1560): warning C4244: 'function': conversion from '__int64' to 'long', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMAJOR_VERSION=1 -DMINOR_VERSION=3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/fpbinaryobject.c /Fobuild\temp.win-amd64-3.8\Release\src/fpbinaryobject.obj
fpbinaryobject.c
src/fpbinaryobject.c(401): warning C4244: '=': conversion from '__int64' to 'long', possible loss of data
src/fpbinaryobject.c(402): warning C4244: '=': conversion from '__int64' to 'long', possible loss of data
src/fpbinaryobject.c(665): warning C4244: '=': conversion from '__int64' to 'long', possible loss of data
src/fpbinaryobject.c(666): warning C4244: '=': conversion from '__int64' to 'long', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMAJOR_VERSION=1 -DMINOR_VERSION=3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/fpbinaryswitchable.c /Fobuild\temp.win-amd64-3.8\Release\src/fpbinaryswitchable.obj
fpbinaryswitchable.c
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMAJOR_VERSION=1 -DMINOR_VERSION=3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/fpbinaryenums.c /Fobuild\temp.win-amd64-3.8\Release\src/fpbinaryenums.obj
fpbinaryenums.c
creating C:\Users\User\AppData\Local\Temp\pip-req-build-sy5d5jbv\build\lib.win-amd64-3.8
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\libs" "/LIBPATH:C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\PCbuild\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64" /EXPORT:PyInit_fpbinary build\temp.win-amd64-3.8\Release\src/fpbinarymodule.obj build\temp.win-amd64-3.8\Release\src/fpbinaryglobaldoc.obj build\temp.win-amd64-3.8\Release\src/fpbinarycommon.obj build\temp.win-amd64-3.8\Release\src/fpbinarysmall.obj build\temp.win-amd64-3.8\Release\src/fpbinarylarge.obj build\temp.win-amd64-3.8\Release\src/fpbinaryobject.obj build\temp.win-amd64-3.8\Release\src/fpbinaryswitchable.obj build\temp.win-amd64-3.8\Release\src/fpbinaryenums.obj /OUT:build\lib.win-amd64-3.8\fpbinary.cp38-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.8\Release\src\fpbinary.cp38-win_amd64.lib
Creating library build\temp.win-amd64-3.8\Release\src\fpbinary.cp38-win_amd64.lib and object build\temp.win-amd64-3.8\Release\src\fpbinary.cp38-win_amd64.exp
fpbinaryobject.obj : error LNK2001: unresolved external symbol check_supported_builtin
build\lib.win-amd64-3.8\fpbinary.cp38-win_amd64.pyd : fatal error LNK1120: 1 unresolved externals
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\link.exe' failed with exit status 1120ERROR: Failed building wheel for FpBinary
Running setup.py clean for FpBinary
Failed to build FpBinary
Installing collected packages: FpBinary
Running setup.py install for FpBinary ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\User\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\User\AppData\Local\Temp\pip-req-build-sy5d5jbv\setup.py'"'"'; file='"'"'C:\Users\User\AppData\Local\Temp\pip-req-build-sy5d5jbv\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\User\AppData\Local\Temp\pip-record-34dtpb9r\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Include\FpBinary'
cwd: C:\Users\User\AppData\Local\Temp\pip-req-build-sy5d5jbv
Complete output (47 lines):
running install
running build
running build_ext
building 'fpbinary' extension
creating build
creating build\temp.win-amd64-3.8
creating build\temp.win-amd64-3.8\Release
creating build\temp.win-amd64-3.8\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMAJOR_VERSION=1 -DMINOR_VERSION=3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/fpbinarymodule.c /Fobuild\temp.win-amd64-3.8\Release\src/fpbinarymodule.obj
fpbinarymodule.c
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMAJOR_VERSION=1 -DMINOR_VERSION=3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/fpbinaryglobaldoc.c /Fobuild\temp.win-amd64-3.8\Release\src/fpbinaryglobaldoc.obj
fpbinaryglobaldoc.c
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMAJOR_VERSION=1 -DMINOR_VERSION=3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/fpbinarycommon.c /Fobuild\temp.win-amd64-3.8\Release\src/fpbinarycommon.obj
fpbinarycommon.c
src/fpbinarycommon.c(306): warning C4244: 'function': conversion from 'unsigned __int64' to 'int', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMAJOR_VERSION=1 -DMINOR_VERSION=3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/fpbinarysmall.c /Fobuild\temp.win-amd64-3.8\Release\src/fpbinarysmall.obj
fpbinarysmall.c
src/fpbinarysmall.c(361): warning C4244: 'function': conversion from '__int64' to 'int', possible loss of data
src/fpbinarysmall.c(571): warning C4244: 'function': conversion from '__int64' to 'int', possible loss of data
src/fpbinarysmall.c(575): warning C4244: 'function': conversion from '__int64' to 'int', possible loss of data
src/fpbinarysmall.c(585): warning C4244: 'function': conversion from '__int64' to 'long', possible loss of data
src/fpbinarysmall.c(586): warning C4244: 'function': conversion from '__int64' to 'long', possible loss of data
src/fpbinarysmall.c(638): warning C4244: '=': conversion from '__int64' to 'long', possible loss of data
src/fpbinarysmall.c(639): warning C4244: '=': conversion from '__int64' to 'long', possible loss of data
src/fpbinarysmall.c(1151): warning C4244: 'function': conversion from '__int64' to 'long', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMAJOR_VERSION=1 -DMINOR_VERSION=3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/fpbinarylarge.c /Fobuild\temp.win-amd64-3.8\Release\src/fpbinarylarge.obj
fpbinarylarge.c
src/fpbinarylarge.c(549): warning C4244: '=': conversion from '__int64' to 'long', possible loss of data
src/fpbinarylarge.c(551): warning C4244: '=': conversion from '__int64' to 'long', possible loss of data
src/fpbinarylarge.c(1559): warning C4244: 'function': conversion from '__int64' to 'long', possible loss of data
src/fpbinarylarge.c(1560): warning C4244: 'function': conversion from '__int64' to 'long', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMAJOR_VERSION=1 -DMINOR_VERSION=3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/fpbinaryobject.c /Fobuild\temp.win-amd64-3.8\Release\src/fpbinaryobject.obj
fpbinaryobject.c
src/fpbinaryobject.c(401): warning C4244: '=': conversion from '__int64' to 'long', possible loss of data
src/fpbinaryobject.c(402): warning C4244: '=': conversion from '__int64' to 'long', possible loss of data
src/fpbinaryobject.c(665): warning C4244: '=': conversion from '__int64' to 'long', possible loss of data
src/fpbinaryobject.c(666): warning C4244: '=': conversion from '__int64' to 'long', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMAJOR_VERSION=1 -DMINOR_VERSION=3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/fpbinaryswitchable.c /Fobuild\temp.win-amd64-3.8\Release\src/fpbinaryswitchable.obj
fpbinaryswitchable.c
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMAJOR_VERSION=1 -DMINOR_VERSION=3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/fpbinaryenums.c /Fobuild\temp.win-amd64-3.8\Release\src/fpbinaryenums.obj
fpbinaryenums.c
creating C:\Users\User\AppData\Local\Temp\pip-req-build-sy5d5jbv\build\lib.win-amd64-3.8
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\libs" "/LIBPATH:C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\PCbuild\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64" /EXPORT:PyInit_fpbinary build\temp.win-amd64-3.8\Release\src/fpbinarymodule.obj build\temp.win-amd64-3.8\Release\src/fpbinaryglobaldoc.obj build\temp.win-amd64-3.8\Release\src/fpbinarycommon.obj build\temp.win-amd64-3.8\Release\src/fpbinarysmall.obj build\temp.win-amd64-3.8\Release\src/fpbinarylarge.obj build\temp.win-amd64-3.8\Release\src/fpbinaryobject.obj build\temp.win-amd64-3.8\Release\src/fpbinaryswitchable.obj build\temp.win-amd64-3.8\Release\src/fpbinaryenums.obj /OUT:build\lib.win-amd64-3.8\fpbinary.cp38-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.8\Release\src\fpbinary.cp38-win_amd64.lib
Creating library build\temp.win-amd64-3.8\Release\src\fpbinary.cp38-win_amd64.lib and object build\temp.win-amd64-3.8\Release\src\fpbinary.cp38-win_amd64.exp
fpbinaryobject.obj : error LNK2001: unresolved external symbol check_supported_builtin
build\lib.win-amd64-3.8\fpbinary.cp38-win_amd64.pyd : fatal error LNK1120: 1 unresolved externals
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\link.exe' failed with exit status 1120
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\User\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\User\AppData\Local\Temp\pip-req-build-sy5d5jbv\setup.py'"'"'; file='"'"'C:\Users\User\AppData\Local\Temp\pip-req-build-sy5d5jbv\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\User\AppData\Local\Temp\pip-record-34dtpb9r\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Include\FpBinary' Check the logs for full command output.
=============================================================
What should I do to make it work on W10?
Thank you a lot!
If an FpBinary instance is unpickled on a machine with a different word length than it was pickled on, it may result in the wrong value. This is unlikely to occur because the long long type should always be 64 bits, even on 32 bit machines, but there still needs to be a check for unusual long long type lengths.
Found when looking at #4 .
If a user instantiates an FpBinary instance with 0 int bits and the architecture word length for frac bits (e.g (0, 64) on a 64 bit system), the value the user specifies will not be preserved.
For example:
>>> FpBinary(0, 64, signed=True, value=0.25)
0.0
This issue has always been present.
Add support for casting FpBinaryComplex to complex.
The following results in a Dead kernel when executed in a Jupyter Notebook or the Spyder IDE (but appeared to work fine from a Python console directly).
import numpy as np
import fpbinary as fpb
fp_mode= False
test = np.float64(5)
node = fpb.FpBinarySwitchable(fp_mode=fp_mode, fp_value=fpb.FpBinary(4,0, True, test), float_value=test)
Sometimes there will be a delay, but subsequent cells in the notebook won't execute and eventually "Dead kernel" results. The solution is to use float(test) to ensure it is a standard float data type, but I am submitting this as fpBinarySwitchable would be more robust if it did this internally for its float parameter type. I am using the numpy float datatype as I am using the fpbinary library with numpy arrays which are set to float64 by default.
A segfault may occur when doing a division operation on FpBinary objects. This will occur if:
(op1.total_bits + op2.total_bits) > (native word length / 2) AND (op1.total_bits + op2.total_bits) <= native word length
For example, on a 64 bit system, if the total number of bits in operand 1 and operand 2 is between 32 and 64 (say int_bits and frac_bits both equal 10 for both operands), a division will result in a segfault.
The reason for this is the total bits calculation for a division result erroneously uses the rules for multiplication, not division.
There are memory leaks in the following FpBinaryComplex functions:
resize()
conjugate()
divide operation
The near_zero rounding type is supposed to round to the nearest bit, and ties are rounded towards zero. But it has been implemented to truncate (or direct) round towards zero. E.g. :
when resizing to 0 frac bits:
1.5 goes to 1 : this is correct
1.6 goes to 1 : this is WRONG (should be 2)
-1.5 goes to -1 : this is correct
-1.6 goes to -1 : this is WRONG (should be -2)
This mode is useful (it is what python does when converting floats to ints) but the terminology is incorrect and, therefore, confusing.
Hi!
I am not sure if posting an issue to send this message is best practice (and if not I apologize). I would like to get in touch with the primary contributors for fpbinary. I have reviewed several options for implementing fixedpoint datatypes in Python and this one is by far my favorite. I am giving a presentation at the end of this month on implementing IIR/FIR filters in fixed point, demonstrated using this package. I would like to talk with you briefly about what I am doing and will be showing. I would be grateful if you could send me an email at boschen at loglin dot com. Thank you!
Using the invalid condition of a the total bits being negative for the FpBinary.resize method results in a dead kernel:
# Creating a new FpBinary object properly creates a ValueError if integer_bits + fractional_bits is negative
# this will properly raise a ValueError exception
try:
test = fpb.FpBinary(4, -5, value=12)
except ValueError:
print("Nice Work!")
# this will crash the kernel (memory leak?)
test = fpb.FpBinary(4, 5, value=12)
test.resize((4,-5))
Tested using:
Python 3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:50:36) [MSC v.1929 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.33.0 -- An enhanced Interactive Python. Type '?' for help.
I've been using the function below to generate arrays of FpBinary numbers. It works, but is a bit slower than it could be as unless I use the for loop all of the FpBinary numbers get cast to bool (see the commented lines).
An simpler example is to look at the result of
gen=lambda x: FpBinary(int_bits=1, frac_bits=15, signed=True, value=x)
np.array([FP16_15(.4)], dtype=object)
It looks like the FpBinary object is getting expanded into its bits!
I'm not sure what would work useres of this library. I do find I'm generating large numpy arrays of FP numbers (100k-a few million).
def fparray(a, fpgen=None):
"""
Convert a numpy array to a numpy object array of FpBinary numbers.
Complex numbers gain an additional axis of length 2.
if fpgen is None 16wide 1integer signed is used
"""
if fpgen is None:
fpgen = lambda x: FpBinary(int_bits=1, frac_bits=15, signed=True, value=x)
if a.dtype in (np.complex, np.complex128, np.complex64):
out = np.empty(tuple(list(a.shape)+[2]), dtype=object)
b = [(fpgen(x.real), fpgen(x.imag)) for x in a.flat]
for i in range(out.size):
out.flat[i] = b[i//2][i % 2]
#You'd think this would work, but it doesn't as the FP types get cast to bool
#out.flat = [(fpgen(x.real), fpgen(x.imag)) for x in a.flat]
else:
out = np.empty_like(a, dtype=object)
b = [fpgen(x) for x in a.flat]
for i in range(out.size):
out.flat[i] = b[i]
#out.flat = [fpgen(x) for x in a.flat]
return out
I'm trying to use this library to verify an FIR that has 16_15 signed samples with -10_26 signed coefficients (16 bit width, quantized by Xilinx's to 26 fractional bits as they are all quite small).
x=FpBinary(int_bits=-10,frac_bits=26,signed=True)
Takes a long time to execute and allows for values >1. Looking at the code it looks like the FpBinary constructor accepts signed values for int_bits but then fp small uses FP_UINT_TYPE for in_bits, so I'm guessing my request is being interpreted as for a VERY large integer part. the result of .format ((4294967287, 26)) seems to suggest this!
Is there a way for me to do this math with your library?
Currently the build system will create alpha numbers based on a build number that is initialised per branch. This may cause conflicts with test.pypi (because test.pypi doesn't allow the complete overwrite of packages which means versions can't be reused).
The proposed scheme is to version non-release packages (i.e. test packages) as {base_version}a{global_build_number}. Appveyor build names will be {branch}-{base_version}a{global_build_number} for non-release builds and {branch}-{base_version}rc{global_build_number} for release builds.
(Minor clerical error). The doc string for RoundingEnum describes Python as using 'near_zero' when converting floats to ints. I believe Python uses 'near_even' (as given by 'round()' as well as numpy 'np.round() ).
Is there an undocumented method to get and set the raw bits? An example use case could be as follows:
x=sin(np.random.uniform(size=1000)*2*np.pi)
fp_bitarray = np.zeros(1000, dtype=np.uint16)
for i in range(1000):
fp_bitarray[i] = FPBinary(16,15, True, x[i]).bits
...
Do stuff with data, eg on an FPGA, get a return array of bits, result_bitarray
...
result = np.array([float(FPBinary(16,15, True, from_bits=bits)) for bits in result_bitarray])
I'm not sure if this is a common use case, but I'm going to add it to make the format functionality complete (we already support negative int_bits).
Negative format bits (either int_bits OR fract_bits) indicates the instance represents a number that only has bits below or above the value zero.
Add support for create and resize of fixed point objects in lists and arrays without needing to use the map/vectorize functions. This is a quick way to speed up these operations (mainly) on numpy arrays of FpBinary and FpBinaryComplex objects.
Add support for squaring fixed point numbers. I.e. support:
fp_num ** 2
fp_num ** 2.0
The comparison functions (==, !=, < etc) for FpBinary instances of length <= the system word length (usually 64 bits) use shift operations that aren't safe for shifts of the system word length. This may result in erroneous comparison operations.
Converting an FpBinary instance to an int via the int() method may result the wrong value if there is a difference between the native word length and the python runtime word length. That is, if you are using 32 bit python on a 64 bit machine.
Copying FpBinarySwitchable instances via copy.copy() does not copy the min_value and max_value fields correctly. It will set these to the current value:
>>> fs = FpBinarySwitchable(fp_mode=False, float_value=0.0)
>>> fs.value = -5.0
>>> fs.value = 5.0
>>> fs.value = 1.0
>>> fs.value, fs.min_value, fs.max_value
(1.0, -5.0, 5.0)
>>> fs2 = copy.copy(fs)
>>> fs2.value, fs2.min_value, fs2.max_value
(1.0, 1.0, 1.0)
Modify the build system to produce macOS binaries.
Add PyPi and readthedocs support.
Hi!
I'm having this problem:
>>> fp_num = FpBinary(int_bits=0, frac_bits=15, signed=True, value=-0.501)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: Applied value is too large for int representation on this CPU.
My CPU is Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Given the long creation time for large arrays and involved FP operations it would be nice to be able to cache arrays of FpBinary objects to disk. Presently any attempt to pickle results in: TypeError: can't pickle fpbinary.FpBinary objects
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.