mirror of
https://github.com/Z3Prover/z3
synced 2025-04-16 05:48:44 +00:00
Merge pull request #398 from wintersteiger/jan4
Improvements for the FPA API.
This commit is contained in:
commit
8b8dc95986
File diff suppressed because it is too large
Load diff
|
@ -19,15 +19,15 @@ def has_cr(file):
|
||||||
lines = 0
|
lines = 0
|
||||||
line = ins.readline()
|
line = ins.readline()
|
||||||
while line and lines < 20:
|
while line and lines < 20:
|
||||||
m = cr.search(line)
|
m = cr.search(line)
|
||||||
if m:
|
if m:
|
||||||
ins.close()
|
ins.close()
|
||||||
return True
|
return True
|
||||||
m = aut.search(line)
|
m = aut.search(line)
|
||||||
if m:
|
if m:
|
||||||
ins.close()
|
ins.close()
|
||||||
return True
|
return True
|
||||||
line = ins.readline()
|
line = ins.readline()
|
||||||
ins.close()
|
ins.close()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -38,20 +38,20 @@ def add_cr(file):
|
||||||
ous.write(cr_notice)
|
ous.write(cr_notice)
|
||||||
line = ins.readline()
|
line = ins.readline()
|
||||||
while line:
|
while line:
|
||||||
ous.write(line)
|
ous.write(line)
|
||||||
line = ins.readline()
|
line = ins.readline()
|
||||||
ins.close()
|
ins.close()
|
||||||
ous.close()
|
ous.close()
|
||||||
os.system("move %s %s" % (tmp, file))
|
os.system("move %s %s" % (tmp, file))
|
||||||
|
|
||||||
def add_missing_cr(dir):
|
def add_missing_cr(dir):
|
||||||
for root, dirs, files in os.walk(dir):
|
for root, dirs, files in os.walk(dir):
|
||||||
for f in files:
|
for f in files:
|
||||||
if f.endswith('.cpp') or f.endswith('.h') or f.endswith('.c') or f.endswith('.cs'):
|
if f.endswith('.cpp') or f.endswith('.h') or f.endswith('.c') or f.endswith('.cs'):
|
||||||
path = "%s\\%s" % (root, f)
|
path = "%s\\%s" % (root, f)
|
||||||
if not has_cr(path):
|
if not has_cr(path):
|
||||||
print("Missing CR for %s" % path)
|
print("Missing CR for %s" % path)
|
||||||
add_cr(path)
|
add_cr(path)
|
||||||
|
|
||||||
add_missing_cr('src')
|
add_missing_cr('src')
|
||||||
add_missing_cr('examples')
|
add_missing_cr('examples')
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
############################################
|
############################################
|
||||||
# Copyright (c) 2012 Microsoft Corporation
|
# Copyright (c) 2012 Microsoft Corporation
|
||||||
#
|
#
|
||||||
# Scripts for generating Makefiles and Visual
|
# Scripts for generating Makefiles and Visual
|
||||||
# Studio project files.
|
# Studio project files.
|
||||||
#
|
#
|
||||||
# Author: Leonardo de Moura (leonardo)
|
# Author: Leonardo de Moura (leonardo)
|
||||||
|
@ -17,6 +17,7 @@ update_version()
|
||||||
mk_auto_src()
|
mk_auto_src()
|
||||||
mk_bindings(API_files)
|
mk_bindings(API_files)
|
||||||
mk_vs_proj('z3', ['shell'])
|
mk_vs_proj('z3', ['shell'])
|
||||||
|
mk_vs_proj_dll('libz3', ['api_dll'])
|
||||||
mk_makefile()
|
mk_makefile()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -559,7 +559,7 @@ def dos2unix_tree():
|
||||||
for root, dirs, files in os.walk('src'):
|
for root, dirs, files in os.walk('src'):
|
||||||
for f in files:
|
for f in files:
|
||||||
dos2unix(os.path.join(root, f))
|
dos2unix(os.path.join(root, f))
|
||||||
|
|
||||||
|
|
||||||
def check_eol():
|
def check_eol():
|
||||||
if not IS_WINDOWS:
|
if not IS_WINDOWS:
|
||||||
|
@ -1372,8 +1372,8 @@ class PythonInstallComponent(Component):
|
||||||
"Python package directory." % (PYTHON_PACKAGE_DIR, PREFIX))
|
"Python package directory." % (PYTHON_PACKAGE_DIR, PREFIX))
|
||||||
|
|
||||||
def main_component(self):
|
def main_component(self):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def mk_install(self, out):
|
def mk_install(self, out):
|
||||||
if not is_python_install_enabled():
|
if not is_python_install_enabled():
|
||||||
return
|
return
|
||||||
|
@ -1729,7 +1729,7 @@ class JavaDLLComponent(Component):
|
||||||
MakeRuleCmd.remove_installed_files(out, os.path.join(INSTALL_LIB_DIR, jarfile))
|
MakeRuleCmd.remove_installed_files(out, os.path.join(INSTALL_LIB_DIR, jarfile))
|
||||||
|
|
||||||
class MLComponent(Component):
|
class MLComponent(Component):
|
||||||
|
|
||||||
def __init__(self, name, lib_name, path, deps):
|
def __init__(self, name, lib_name, path, deps):
|
||||||
Component.__init__(self, name, path, deps)
|
Component.__init__(self, name, path, deps)
|
||||||
if lib_name is None:
|
if lib_name is None:
|
||||||
|
@ -1747,14 +1747,14 @@ class MLComponent(Component):
|
||||||
out.write('CXXFLAGS_OCAML=$(CXXFLAGS:/GL=)\n') # remove /GL; the ocaml tools don't like it.
|
out.write('CXXFLAGS_OCAML=$(CXXFLAGS:/GL=)\n') # remove /GL; the ocaml tools don't like it.
|
||||||
|
|
||||||
if IS_WINDOWS:
|
if IS_WINDOWS:
|
||||||
prefix_lib = '-L' + os.path.abspath(BUILD_DIR).replace('\\', '\\\\')
|
prefix_lib = '-L' + os.path.abspath(BUILD_DIR).replace('\\', '\\\\')
|
||||||
else:
|
else:
|
||||||
prefix_lib = '-L' + PREFIX + '/lib'
|
prefix_lib = '-L' + PREFIX + '/lib'
|
||||||
substitutions = { 'LEXTRA': prefix_lib,
|
substitutions = { 'LEXTRA': prefix_lib,
|
||||||
'VERSION': "{}.{}.{}.{}".format(VER_MAJOR, VER_MINOR, VER_BUILD, VER_REVISION) }
|
'VERSION': "{}.{}.{}.{}".format(VER_MAJOR, VER_MINOR, VER_BUILD, VER_REVISION) }
|
||||||
|
|
||||||
configure_file(os.path.join(self.src_dir, 'META.in'),
|
configure_file(os.path.join(self.src_dir, 'META.in'),
|
||||||
os.path.join(BUILD_DIR, self.sub_dir, 'META'),
|
os.path.join(BUILD_DIR, self.sub_dir, 'META'),
|
||||||
substitutions)
|
substitutions)
|
||||||
|
|
||||||
mlis = ''
|
mlis = ''
|
||||||
|
@ -1766,7 +1766,7 @@ class MLComponent(Component):
|
||||||
z3dllso = get_component(Z3_DLL_COMPONENT).dll_name + '$(SO_EXT)'
|
z3dllso = get_component(Z3_DLL_COMPONENT).dll_name + '$(SO_EXT)'
|
||||||
out.write('%s: %s %s\n' % (stubso, stubsc, z3dllso))
|
out.write('%s: %s %s\n' % (stubso, stubsc, z3dllso))
|
||||||
out.write('\t%s -ccopt "$(CXXFLAGS_OCAML) -I %s -I %s -I %s $(CXX_OUT_FLAG)%s" -c %s\n' %
|
out.write('\t%s -ccopt "$(CXXFLAGS_OCAML) -I %s -I %s -I %s $(CXX_OUT_FLAG)%s" -c %s\n' %
|
||||||
(OCAMLC, OCAML_LIB, api_src, src_dir, stubso, stubsc))
|
(OCAMLC, OCAML_LIB, api_src, src_dir, stubso, stubsc))
|
||||||
|
|
||||||
cmis = ''
|
cmis = ''
|
||||||
for m in self.modules:
|
for m in self.modules:
|
||||||
|
@ -1776,7 +1776,7 @@ class MLComponent(Component):
|
||||||
out.write('\t%s -I %s -o %s -c %s\n' % (OCAMLC, self.sub_dir, ft, ff))
|
out.write('\t%s -I %s -o %s -c %s\n' % (OCAMLC, self.sub_dir, ft, ff))
|
||||||
cmis = cmis + ' ' + ft
|
cmis = cmis + ' ' + ft
|
||||||
|
|
||||||
cmos = ''
|
cmos = ''
|
||||||
for m in self.modules:
|
for m in self.modules:
|
||||||
ff = os.path.join(src_dir, m + '.ml')
|
ff = os.path.join(src_dir, m + '.ml')
|
||||||
ft = os.path.join(self.sub_dir, m + '.cmo')
|
ft = os.path.join(self.sub_dir, m + '.cmo')
|
||||||
|
@ -1802,7 +1802,7 @@ class MLComponent(Component):
|
||||||
out.write('\tocamlmklib -o %s -I %s %s %s -L. -lz3\n' % (z3mls, self.sub_dir, stubso, cmxs))
|
out.write('\tocamlmklib -o %s -I %s %s %s -L. -lz3\n' % (z3mls, self.sub_dir, stubso, cmxs))
|
||||||
out.write('%s.cmxs: %s.cmxa\n' % (z3mls, z3mls))
|
out.write('%s.cmxs: %s.cmxa\n' % (z3mls, z3mls))
|
||||||
out.write('\t%s -shared -o %s.cmxs -I %s %s.cmxa\n' % (OCAMLOPT, z3mls, self.sub_dir, z3mls))
|
out.write('\t%s -shared -o %s.cmxs -I %s %s.cmxa\n' % (OCAMLOPT, z3mls, self.sub_dir, z3mls))
|
||||||
|
|
||||||
out.write('\n')
|
out.write('\n')
|
||||||
out.write('ml: %s.cma %s.cmxa %s.cmxs\n' % (z3mls, z3mls, z3mls))
|
out.write('ml: %s.cma %s.cmxa %s.cmxs\n' % (z3mls, z3mls, z3mls))
|
||||||
out.write('\n')
|
out.write('\n')
|
||||||
|
@ -1816,7 +1816,7 @@ class MLComponent(Component):
|
||||||
out.write('ocamlfind_uninstall:\n')
|
out.write('ocamlfind_uninstall:\n')
|
||||||
self.mk_uninstall(out)
|
self.mk_uninstall(out)
|
||||||
out.write('\n')
|
out.write('\n')
|
||||||
|
|
||||||
def mk_install_deps(self, out):
|
def mk_install_deps(self, out):
|
||||||
if is_ml_enabled() and OCAMLFIND != '':
|
if is_ml_enabled() and OCAMLFIND != '':
|
||||||
out.write(get_component(Z3_DLL_COMPONENT).dll_name + '$(SO_EXT) ')
|
out.write(get_component(Z3_DLL_COMPONENT).dll_name + '$(SO_EXT) ')
|
||||||
|
@ -1885,8 +1885,8 @@ class CppExampleComponent(ExampleComponent):
|
||||||
out.write(' -I%s' % get_component(API_COMPONENT).to_src_dir)
|
out.write(' -I%s' % get_component(API_COMPONENT).to_src_dir)
|
||||||
out.write(' -I%s' % get_component(CPP_COMPONENT).to_src_dir)
|
out.write(' -I%s' % get_component(CPP_COMPONENT).to_src_dir)
|
||||||
out.write(' %s' % os.path.join(self.to_ex_dir, cppfile))
|
out.write(' %s' % os.path.join(self.to_ex_dir, cppfile))
|
||||||
out.write('\n')
|
out.write('\n')
|
||||||
|
|
||||||
exefile = '%s$(EXE_EXT)' % self.name
|
exefile = '%s$(EXE_EXT)' % self.name
|
||||||
out.write('%s: %s %s\n' % (exefile, dll, objfiles))
|
out.write('%s: %s %s\n' % (exefile, dll, objfiles))
|
||||||
out.write('\t$(LINK) $(LINK_OUT_FLAG)%s $(LINK_FLAGS) %s ' % (exefile, objfiles))
|
out.write('\t$(LINK) $(LINK_OUT_FLAG)%s $(LINK_FLAGS) %s ' % (exefile, objfiles))
|
||||||
|
@ -3305,15 +3305,18 @@ def mk_z3consts_ml(api_files):
|
||||||
def mk_gui_str(id):
|
def mk_gui_str(id):
|
||||||
return '4D2F40D8-E5F9-473B-B548-%012d' % id
|
return '4D2F40D8-E5F9-473B-B548-%012d' % id
|
||||||
|
|
||||||
def mk_vs_proj(name, components):
|
def get_platform_toolset_str():
|
||||||
if not VS_PROJ:
|
default = 'v110';
|
||||||
return
|
vstr = check_output(['msbuild', '/ver'])
|
||||||
proj_name = '%s.vcxproj' % os.path.join(BUILD_DIR, name)
|
lines = vstr.split('\n')
|
||||||
modes=['Debug', 'Release']
|
lline = lines[-1]
|
||||||
PLATFORMS=['Win32']
|
tokens = lline.split('.')
|
||||||
f = open(proj_name, 'w')
|
if len(tokens) < 2:
|
||||||
f.write('<?xml version="1.0" encoding="utf-8"?>\n')
|
return default
|
||||||
f.write('<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\n')
|
else:
|
||||||
|
return 'v' + tokens[0] + tokens[1]
|
||||||
|
|
||||||
|
def mk_vs_proj_property_groups(f, name, target_ext, type):
|
||||||
f.write(' <ItemGroup Label="ProjectConfigurations">\n')
|
f.write(' <ItemGroup Label="ProjectConfigurations">\n')
|
||||||
f.write(' <ProjectConfiguration Include="Debug|Win32">\n')
|
f.write(' <ProjectConfiguration Include="Debug|Win32">\n')
|
||||||
f.write(' <Configuration>Debug</Configuration>\n')
|
f.write(' <Configuration>Debug</Configuration>\n')
|
||||||
|
@ -3324,35 +3327,46 @@ def mk_vs_proj(name, components):
|
||||||
f.write(' <Platform>Win32</Platform>\n')
|
f.write(' <Platform>Win32</Platform>\n')
|
||||||
f.write(' </ProjectConfiguration>\n')
|
f.write(' </ProjectConfiguration>\n')
|
||||||
f.write(' </ItemGroup>\n')
|
f.write(' </ItemGroup>\n')
|
||||||
f.write(' <PropertyGroup Label="Globals">\n')
|
f.write(' <PropertyGroup Label="Globals">\n')
|
||||||
f.write(' <ProjectGuid>{%s}</ProjectGuid>\n' % mk_gui_str(0))
|
f.write(' <ProjectGuid>{%s}</ProjectGuid>\n' % mk_gui_str(0))
|
||||||
f.write(' <ProjectName>%s</ProjectName>\n' % name)
|
f.write(' <ProjectName>%s</ProjectName>\n' % name)
|
||||||
f.write(' <Keyword>Win32Proj</Keyword>\n')
|
f.write(' <Keyword>Win32Proj</Keyword>\n')
|
||||||
|
f.write(' <PlatformToolset>%s</PlatformToolset>\n' % get_platform_toolset_str())
|
||||||
f.write(' </PropertyGroup>\n')
|
f.write(' </PropertyGroup>\n')
|
||||||
f.write(' <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\n')
|
f.write(' <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\n')
|
||||||
f.write(' <PropertyGroup Condition="\'$(Configuration)|$(Platform)\'==\'Debug|Win32\'" Label="Configuration">\n')
|
f.write(' <PropertyGroup Condition="\'$(Configuration)|$(Platform)\'==\'Debug|Win32\'" Label="Configuration">\n')
|
||||||
f.write(' <ConfigurationType>Application</ConfigurationType>\n')
|
f.write(' <ConfigurationType>%s</ConfigurationType>\n' % type)
|
||||||
f.write(' <CharacterSet>Unicode</CharacterSet>\n')
|
f.write(' <CharacterSet>Unicode</CharacterSet>\n')
|
||||||
f.write(' <UseOfMfc>false</UseOfMfc>\n')
|
f.write(' <UseOfMfc>false</UseOfMfc>\n')
|
||||||
f.write(' </PropertyGroup>\n')
|
f.write(' </PropertyGroup>\n')
|
||||||
f.write(' <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\n')
|
f.write(' <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\n')
|
||||||
f.write(' <ImportGroup Label="ExtensionSettings">\n')
|
f.write(' <ImportGroup Label="ExtensionSettings" />\n')
|
||||||
f.write(' </ImportGroup>\n')
|
|
||||||
f.write(' <ImportGroup Label="PropertySheets">\n')
|
f.write(' <ImportGroup Label="PropertySheets">\n')
|
||||||
f.write(' <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists(\'$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props\')" Label="LocalAppDataPlatform" /> </ImportGroup>\n')
|
f.write(' <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists(\'$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props\')" Label="LocalAppDataPlatform" /> </ImportGroup>\n')
|
||||||
f.write(' <PropertyGroup Label="UserMacros" />\n')
|
f.write(' <PropertyGroup Label="UserMacros" />\n')
|
||||||
f.write(' <PropertyGroup>\n')
|
f.write(' <PropertyGroup>\n')
|
||||||
f.write(' <OutDir Condition="\'$(Configuration)|$(Platform)\'==\'Debug|Win32\'">$(SolutionDir)$(Configuration)\</OutDir>\n')
|
f.write(' <OutDir Condition="\'$(Configuration)|$(Platform)\'==\'Debug|Win32\'">$(SolutionDir)\$(ProjectName)\$(Configuration)\</OutDir>\n')
|
||||||
f.write(' <TargetName Condition="\'$(Configuration)|$(Platform)\'==\'Debug|Win32\'">%s</TargetName>\n' % name)
|
f.write(' <TargetName Condition="\'$(Configuration)|$(Platform)\'==\'Debug|Win32\'">%s</TargetName>\n' % name)
|
||||||
f.write(' <TargetExt Condition="\'$(Configuration)|$(Platform)\'==\'Debug|Win32\'">.exe</TargetExt>\n')
|
f.write(' <TargetExt Condition="\'$(Configuration)|$(Platform)\'==\'Debug|Win32\'">.%s</TargetExt>\n' % target_ext)
|
||||||
f.write(' <OutDir Condition="\'$(Configuration)|$(Platform)\'==\'Release|Win32\'">$(SolutionDir)$(Configuration)\</OutDir>\n')
|
f.write(' <OutDir Condition="\'$(Configuration)|$(Platform)\'==\'Release|Win32\'">$(SolutionDir)\$(ProjectName)\$(Configuration)\</OutDir>\n')
|
||||||
f.write(' <TargetName Condition="\'$(Configuration)|$(Platform)\'==\'Release|Win32\'">%s</TargetName>\n' % name)
|
f.write(' <TargetName Condition="\'$(Configuration)|$(Platform)\'==\'Release|Win32\'">%s</TargetName>\n' % name)
|
||||||
f.write(' <TargetExt Condition="\'$(Configuration)|$(Platform)\'==\'Release|Win32\'">.exe</TargetExt>\n')
|
f.write(' <TargetExt Condition="\'$(Configuration)|$(Platform)\'==\'Release|Win32\'">.%s</TargetExt>\n' % target_ext)
|
||||||
f.write(' </PropertyGroup>\n')
|
f.write(' </PropertyGroup>\n')
|
||||||
f.write(' <ItemDefinitionGroup Condition="\'$(Configuration)|$(Platform)\'==\'Debug|Win32\'">\n')
|
f.write(' <PropertyGroup Condition="\'$(Configuration)|$(Platform)\'==\'Debug|Win32\'">\n')
|
||||||
|
f.write(' <IntDir>$(ProjectName)\$(Configuration)\</IntDir>\n')
|
||||||
|
f.write(' </PropertyGroup>\n')
|
||||||
|
f.write(' <PropertyGroup Condition="\'$(Configuration)|$(Platform)\'==\'Release|Win32\'">\n')
|
||||||
|
f.write(' <IntDir>$(ProjectName)\$(Configuration)\</IntDir>\n')
|
||||||
|
f.write(' </PropertyGroup>\n')
|
||||||
|
|
||||||
|
|
||||||
|
def mk_vs_proj_cl_compile(f, name, components, debug):
|
||||||
f.write(' <ClCompile>\n')
|
f.write(' <ClCompile>\n')
|
||||||
f.write(' <Optimization>Disabled</Optimization>\n')
|
f.write(' <Optimization>Disabled</Optimization>\n')
|
||||||
f.write(' <PreprocessorDefinitions>WIN32;_DEBUG;Z3DEBUG;_TRACE;_MP_INTERNAL;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n')
|
if debug:
|
||||||
|
f.write(' <PreprocessorDefinitions>WIN32;_DEBUG;Z3DEBUG;_TRACE;_MP_INTERNAL;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n')
|
||||||
|
else:
|
||||||
|
f.write(' <PreprocessorDefinitions>WIN32;_NDEBUG;_MP_INTERNAL;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n')
|
||||||
if VS_PAR:
|
if VS_PAR:
|
||||||
f.write(' <MinimalRebuild>false</MinimalRebuild>\n')
|
f.write(' <MinimalRebuild>false</MinimalRebuild>\n')
|
||||||
f.write(' <MultiProcessorCompilation>true</MultiProcessorCompilation>\n')
|
f.write(' <MultiProcessorCompilation>true</MultiProcessorCompilation>\n')
|
||||||
|
@ -3360,8 +3374,14 @@ def mk_vs_proj(name, components):
|
||||||
f.write(' <MinimalRebuild>true</MinimalRebuild>\n')
|
f.write(' <MinimalRebuild>true</MinimalRebuild>\n')
|
||||||
f.write(' <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\n')
|
f.write(' <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\n')
|
||||||
f.write(' <WarningLevel>Level3</WarningLevel>\n')
|
f.write(' <WarningLevel>Level3</WarningLevel>\n')
|
||||||
f.write(' <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n')
|
if debug:
|
||||||
f.write(' <OpenMPSupport>true</OpenMPSupport>\n')
|
f.write(' <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n')
|
||||||
|
else:
|
||||||
|
f.write(' <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n')
|
||||||
|
if USE_OMP:
|
||||||
|
f.write(' <OpenMPSupport>true</OpenMPSupport>\n')
|
||||||
|
else:
|
||||||
|
f.write(' <OpenMPSupport>false</OpenMPSupport>\n')
|
||||||
f.write(' <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n')
|
f.write(' <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n')
|
||||||
f.write(' <AdditionalIncludeDirectories>')
|
f.write(' <AdditionalIncludeDirectories>')
|
||||||
deps = find_all_deps(name, components)
|
deps = find_all_deps(name, components)
|
||||||
|
@ -3374,63 +3394,89 @@ def mk_vs_proj(name, components):
|
||||||
f.write(get_component(dep).to_src_dir)
|
f.write(get_component(dep).to_src_dir)
|
||||||
f.write('</AdditionalIncludeDirectories>\n')
|
f.write('</AdditionalIncludeDirectories>\n')
|
||||||
f.write(' </ClCompile>\n')
|
f.write(' </ClCompile>\n')
|
||||||
f.write(' <Link>\n')
|
|
||||||
f.write(' <OutputFile>$(OutDir)%s.exe</OutputFile>\n' % name)
|
def mk_vs_proj_dep_groups(f, name, components):
|
||||||
f.write(' <GenerateDebugInformation>true</GenerateDebugInformation>\n')
|
|
||||||
f.write(' <SubSystem>Console</SubSystem>\n')
|
|
||||||
f.write(' <StackReserveSize>8388608</StackReserveSize>\n')
|
|
||||||
f.write(' <RandomizedBaseAddress>false</RandomizedBaseAddress>\n')
|
|
||||||
f.write(' <DataExecutionPrevention>\n')
|
|
||||||
f.write(' </DataExecutionPrevention>\n')
|
|
||||||
f.write(' <TargetMachine>MachineX86</TargetMachine>\n')
|
|
||||||
f.write(' <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n')
|
|
||||||
f.write('<AdditionalDependencies>psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>\n')
|
|
||||||
f.write(' </Link>\n')
|
|
||||||
f.write(' </ItemDefinitionGroup>\n')
|
|
||||||
f.write(' <ItemDefinitionGroup Condition="\'$(Configuration)|$(Platform)\'==\'Release|Win32\'">\n')
|
|
||||||
f.write(' <ClCompile>\n')
|
|
||||||
f.write(' <Optimization>Disabled</Optimization>\n')
|
|
||||||
f.write(' <PreprocessorDefinitions>WIN32;_NDEBUG;_MP_INTERNAL;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n')
|
|
||||||
if VS_PAR:
|
|
||||||
f.write(' <MinimalRebuild>false</MinimalRebuild>\n')
|
|
||||||
f.write(' <MultiProcessorCompilation>true</MultiProcessorCompilation>\n')
|
|
||||||
else:
|
|
||||||
f.write(' <MinimalRebuild>true</MinimalRebuild>\n')
|
|
||||||
f.write(' <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\n')
|
|
||||||
f.write(' <WarningLevel>Level3</WarningLevel>\n')
|
|
||||||
f.write(' <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n')
|
|
||||||
f.write(' <OpenMPSupport>true</OpenMPSupport>\n')
|
|
||||||
f.write(' <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n')
|
|
||||||
f.write(' <AdditionalIncludeDirectories>')
|
|
||||||
deps = find_all_deps(name, components)
|
|
||||||
first = True
|
|
||||||
for dep in deps:
|
|
||||||
if first:
|
|
||||||
first = False
|
|
||||||
else:
|
|
||||||
f.write(';')
|
|
||||||
f.write(get_component(dep).to_src_dir)
|
|
||||||
f.write('</AdditionalIncludeDirectories>\n')
|
|
||||||
f.write(' </ClCompile>\n')
|
|
||||||
f.write(' <Link>\n')
|
|
||||||
f.write(' <OutputFile>$(OutDir)%s.exe</OutputFile>\n' % name)
|
|
||||||
f.write(' <GenerateDebugInformation>true</GenerateDebugInformation>\n')
|
|
||||||
f.write(' <SubSystem>Console</SubSystem>\n')
|
|
||||||
f.write(' <StackReserveSize>8388608</StackReserveSize>\n')
|
|
||||||
f.write(' <RandomizedBaseAddress>false</RandomizedBaseAddress>\n')
|
|
||||||
f.write(' <DataExecutionPrevention>\n')
|
|
||||||
f.write(' </DataExecutionPrevention>\n')
|
|
||||||
f.write(' <TargetMachine>MachineX86</TargetMachine>\n')
|
|
||||||
f.write(' <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n')
|
|
||||||
f.write('<AdditionalDependencies>psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>\n')
|
|
||||||
f.write(' </Link>\n')
|
|
||||||
f.write(' </ItemDefinitionGroup>\n')
|
|
||||||
f.write(' <ItemGroup>\n')
|
f.write(' <ItemGroup>\n')
|
||||||
|
deps = find_all_deps(name, components)
|
||||||
for dep in deps:
|
for dep in deps:
|
||||||
dep = get_component(dep)
|
dep = get_component(dep)
|
||||||
for cpp in filter(lambda f: f.endswith('.cpp'), os.listdir(dep.src_dir)):
|
for cpp in filter(lambda f: f.endswith('.cpp'), os.listdir(dep.src_dir)):
|
||||||
f.write(' <ClCompile Include="%s" />\n' % os.path.join(dep.to_src_dir, cpp))
|
f.write(' <ClCompile Include="%s" />\n' % os.path.join(dep.to_src_dir, cpp))
|
||||||
f.write(' </ItemGroup>\n')
|
f.write(' </ItemGroup>\n')
|
||||||
|
|
||||||
|
def mk_vs_proj_link_exe(f, name, debug):
|
||||||
|
f.write(' <Link>\n')
|
||||||
|
f.write(' <OutputFile>$(OutDir)%s.exe</OutputFile>\n' % name)
|
||||||
|
f.write(' <GenerateDebugInformation>true</GenerateDebugInformation>\n')
|
||||||
|
f.write(' <SubSystem>Console</SubSystem>\n')
|
||||||
|
f.write(' <StackReserveSize>8388608</StackReserveSize>\n')
|
||||||
|
f.write(' <RandomizedBaseAddress>false</RandomizedBaseAddress>\n')
|
||||||
|
f.write(' <DataExecutionPrevention/>\n')
|
||||||
|
f.write(' <TargetMachine>MachineX86</TargetMachine>\n')
|
||||||
|
f.write(' <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n')
|
||||||
|
f.write(' <AdditionalDependencies>psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>\n')
|
||||||
|
f.write(' </Link>\n')
|
||||||
|
|
||||||
|
def mk_vs_proj(name, components):
|
||||||
|
if not VS_PROJ:
|
||||||
|
return
|
||||||
|
proj_name = '%s.vcxproj' % os.path.join(BUILD_DIR, name)
|
||||||
|
modes=['Debug', 'Release']
|
||||||
|
PLATFORMS=['Win32']
|
||||||
|
f = open(proj_name, 'w')
|
||||||
|
f.write('<?xml version="1.0" encoding="utf-8"?>\n')
|
||||||
|
f.write('<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\n')
|
||||||
|
mk_vs_proj_property_groups(f, name, 'exe', 'Application')
|
||||||
|
f.write(' <ItemDefinitionGroup Condition="\'$(Configuration)|$(Platform)\'==\'Debug|Win32\'">\n')
|
||||||
|
mk_vs_proj_cl_compile(f, name, components, debug=True)
|
||||||
|
mk_vs_proj_link_exe(f, name, debug=True)
|
||||||
|
f.write(' </ItemDefinitionGroup>\n')
|
||||||
|
f.write(' <ItemDefinitionGroup Condition="\'$(Configuration)|$(Platform)\'==\'Release|Win32\'">\n')
|
||||||
|
mk_vs_proj_cl_compile(f, name, components, debug=False)
|
||||||
|
mk_vs_proj_link_exe(f, name, debug=False)
|
||||||
|
f.write(' </ItemDefinitionGroup>\n')
|
||||||
|
mk_vs_proj_dep_groups(f, name, components)
|
||||||
|
f.write(' <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\n')
|
||||||
|
f.write(' <ImportGroup Label="ExtensionTargets">\n')
|
||||||
|
f.write(' </ImportGroup>\n')
|
||||||
|
f.write('</Project>\n')
|
||||||
|
f.close()
|
||||||
|
if is_verbose():
|
||||||
|
print("Generated '%s'" % proj_name)
|
||||||
|
|
||||||
|
def mk_vs_proj_link_dll(f, name, debug):
|
||||||
|
f.write(' <Link>\n')
|
||||||
|
f.write(' <OutputFile>$(OutDir)%s.dll</OutputFile>\n' % name)
|
||||||
|
f.write(' <GenerateDebugInformation>true</GenerateDebugInformation>\n')
|
||||||
|
f.write(' <SubSystem>Console</SubSystem>\n')
|
||||||
|
f.write(' <StackReserveSize>8388608</StackReserveSize>\n')
|
||||||
|
f.write(' <RandomizedBaseAddress>false</RandomizedBaseAddress>\n')
|
||||||
|
f.write(' <DataExecutionPrevention/>\n')
|
||||||
|
f.write(' <TargetMachine>MachineX86</TargetMachine>\n')
|
||||||
|
f.write(' <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n')
|
||||||
|
f.write(' <AdditionalDependencies>psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>\n')
|
||||||
|
f.write(' <ModuleDefinitionFile>%s</ModuleDefinitionFile>' % os.path.join(get_component('api_dll').to_src_dir, 'api_dll.def'))
|
||||||
|
f.write(' </Link>\n')
|
||||||
|
|
||||||
|
def mk_vs_proj_dll(name, components):
|
||||||
|
if not VS_PROJ:
|
||||||
|
return
|
||||||
|
proj_name = '%s.vcxproj' % os.path.join(BUILD_DIR, name)
|
||||||
|
modes=['Debug', 'Release']
|
||||||
|
PLATFORMS=['Win32']
|
||||||
|
f = open(proj_name, 'w')
|
||||||
|
f.write('<?xml version="1.0" encoding="utf-8"?>\n')
|
||||||
|
f.write('<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\n')
|
||||||
|
mk_vs_proj_property_groups(f, name, 'dll', 'DynamicLibrary')
|
||||||
|
f.write(' <ItemDefinitionGroup Condition="\'$(Configuration)|$(Platform)\'==\'Debug|Win32\'">\n')
|
||||||
|
mk_vs_proj_cl_compile(f, name, components, debug=True)
|
||||||
|
mk_vs_proj_link_dll(f, name, debug=True)
|
||||||
|
f.write(' </ItemDefinitionGroup>\n')
|
||||||
|
f.write(' <ItemDefinitionGroup Condition="\'$(Configuration)|$(Platform)\'==\'Release|Win32\'">\n')
|
||||||
|
mk_vs_proj_cl_compile(f, name, components, debug=False)
|
||||||
|
mk_vs_proj_link_dll(f, name, debug=False)
|
||||||
|
f.write(' </ItemDefinitionGroup>\n')
|
||||||
|
mk_vs_proj_dep_groups(f, name, components)
|
||||||
f.write(' <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\n')
|
f.write(' <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\n')
|
||||||
f.write(' <ImportGroup Label="ExtensionTargets">\n')
|
f.write(' <ImportGroup Label="ExtensionTargets">\n')
|
||||||
f.write(' </ImportGroup>\n')
|
f.write(' </ImportGroup>\n')
|
||||||
|
@ -3478,7 +3524,7 @@ class MakeRuleCmd(object):
|
||||||
@classmethod
|
@classmethod
|
||||||
def _install_root(cls, path, in_prefix, out, is_install=True):
|
def _install_root(cls, path, in_prefix, out, is_install=True):
|
||||||
if not in_prefix:
|
if not in_prefix:
|
||||||
# The Python bindings on OSX are sometimes not installed inside the prefix.
|
# The Python bindings on OSX are sometimes not installed inside the prefix.
|
||||||
install_root = "$(DESTDIR)"
|
install_root = "$(DESTDIR)"
|
||||||
action_string = 'install' if is_install else 'uninstall'
|
action_string = 'install' if is_install else 'uninstall'
|
||||||
cls.write_cmd(out, 'echo "WARNING: {}ing files/directories ({}) that are not in the install prefix ($(PREFIX))."'.format(
|
cls.write_cmd(out, 'echo "WARNING: {}ing files/directories ({}) that are not in the install prefix ($(PREFIX))."'.format(
|
||||||
|
|
|
@ -17,55 +17,55 @@ def fix_hdr(file):
|
||||||
line = ins.readline()
|
line = ins.readline()
|
||||||
found = False
|
found = False
|
||||||
while line:
|
while line:
|
||||||
m = doubleu.search(line)
|
m = doubleu.search(line)
|
||||||
if m:
|
if m:
|
||||||
ous.write("#")
|
ous.write("#")
|
||||||
ous.write(m.group(1))
|
ous.write(m.group(1))
|
||||||
ous.write(" ")
|
ous.write(" ")
|
||||||
ous.write(m.group(2))
|
ous.write(m.group(2))
|
||||||
ous.write("_H_\n")
|
ous.write("_H_\n")
|
||||||
line = ins.readline()
|
line = ins.readline()
|
||||||
found = True
|
found = True
|
||||||
continue
|
continue
|
||||||
m = ifndef.search(line)
|
m = ifndef.search(line)
|
||||||
if m:
|
if m:
|
||||||
print(m.group(1))
|
print(m.group(1))
|
||||||
ous.write("#ifndef ")
|
ous.write("#ifndef ")
|
||||||
ous.write(m.group(1))
|
ous.write(m.group(1))
|
||||||
ous.write("_H_\n")
|
ous.write("_H_\n")
|
||||||
line = ins.readline()
|
line = ins.readline()
|
||||||
found = True
|
found = True
|
||||||
continue
|
continue
|
||||||
m = defn.search(line)
|
m = defn.search(line)
|
||||||
if m:
|
if m:
|
||||||
ous.write("#define ")
|
ous.write("#define ")
|
||||||
ous.write(m.group(1))
|
ous.write(m.group(1))
|
||||||
ous.write("_H_\n")
|
ous.write("_H_\n")
|
||||||
line = ins.readline()
|
line = ins.readline()
|
||||||
found = True
|
found = True
|
||||||
continue
|
continue
|
||||||
m = endif.search(line)
|
m = endif.search(line)
|
||||||
if m:
|
if m:
|
||||||
ous.write("#endif /* ")
|
ous.write("#endif /* ")
|
||||||
ous.write(m.group(1))
|
ous.write(m.group(1))
|
||||||
ous.write("_H_ */\n")
|
ous.write("_H_ */\n")
|
||||||
line = ins.readline()
|
line = ins.readline()
|
||||||
found = True
|
found = True
|
||||||
continue
|
continue
|
||||||
ous.write(line)
|
ous.write(line)
|
||||||
line = ins.readline()
|
line = ins.readline()
|
||||||
ins.close()
|
ins.close()
|
||||||
ous.close()
|
ous.close()
|
||||||
if found:
|
if found:
|
||||||
os.system("move %s %s" % (tmp, file))
|
os.system("move %s %s" % (tmp, file))
|
||||||
else:
|
else:
|
||||||
os.system("del %s" % tmp)
|
os.system("del %s" % tmp)
|
||||||
|
|
||||||
def fixup(dir):
|
def fixup(dir):
|
||||||
for root, dirs, files in os.walk(dir):
|
for root, dirs, files in os.walk(dir):
|
||||||
for f in files:
|
for f in files:
|
||||||
if f.endswith('.h'):
|
if f.endswith('.h'):
|
||||||
path = "%s\\%s" % (root, f)
|
path = "%s\\%s" % (root, f)
|
||||||
fix_hdr(path)
|
fix_hdr(path)
|
||||||
|
|
||||||
fixup('src')
|
fixup('src')
|
||||||
|
|
|
@ -268,14 +268,14 @@ extern "C" {
|
||||||
|
|
||||||
Z3_ast Z3_API Z3_mk_fpa_fp(Z3_context c, Z3_ast sgn, Z3_ast exp, Z3_ast sig) {
|
Z3_ast Z3_API Z3_mk_fpa_fp(Z3_context c, Z3_ast sgn, Z3_ast exp, Z3_ast sig) {
|
||||||
Z3_TRY;
|
Z3_TRY;
|
||||||
LOG_Z3_mk_fpa_fp(c, sgn, sig, exp);
|
LOG_Z3_mk_fpa_fp(c, sgn, exp, sig);
|
||||||
RESET_ERROR_CODE();
|
RESET_ERROR_CODE();
|
||||||
if (!is_bv(c, sgn) || !is_bv(c, exp) || !is_bv(c, sig)) {
|
if (!is_bv(c, sgn) || !is_bv(c, exp) || !is_bv(c, sig)) {
|
||||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||||
RETURN_Z3(0);
|
RETURN_Z3(0);
|
||||||
}
|
}
|
||||||
api::context * ctx = mk_c(c);
|
api::context * ctx = mk_c(c);
|
||||||
expr * a = ctx->fpautil().mk_fp(to_expr(sgn), to_expr(sig), to_expr(exp));
|
expr * a = ctx->fpautil().mk_fp(to_expr(sgn), to_expr(exp), to_expr(sig));
|
||||||
ctx->save_ast_trail(a);
|
ctx->save_ast_trail(a);
|
||||||
RETURN_Z3(of_expr(a));
|
RETURN_Z3(of_expr(a));
|
||||||
Z3_CATCH_RETURN(0);
|
Z3_CATCH_RETURN(0);
|
||||||
|
@ -351,7 +351,7 @@ extern "C" {
|
||||||
ctx->fpautil().fm().set(tmp,
|
ctx->fpautil().fm().set(tmp,
|
||||||
ctx->fpautil().get_ebits(to_sort(ty)),
|
ctx->fpautil().get_ebits(to_sort(ty)),
|
||||||
ctx->fpautil().get_sbits(to_sort(ty)),
|
ctx->fpautil().get_sbits(to_sort(ty)),
|
||||||
sgn != 0, sig, exp);
|
sgn != 0, exp, sig);
|
||||||
expr * a = ctx->fpautil().mk_value(tmp);
|
expr * a = ctx->fpautil().mk_value(tmp);
|
||||||
ctx->save_ast_trail(a);
|
ctx->save_ast_trail(a);
|
||||||
RETURN_Z3(of_expr(a));
|
RETURN_Z3(of_expr(a));
|
||||||
|
@ -371,7 +371,7 @@ extern "C" {
|
||||||
ctx->fpautil().fm().set(tmp,
|
ctx->fpautil().fm().set(tmp,
|
||||||
ctx->fpautil().get_ebits(to_sort(ty)),
|
ctx->fpautil().get_ebits(to_sort(ty)),
|
||||||
ctx->fpautil().get_sbits(to_sort(ty)),
|
ctx->fpautil().get_sbits(to_sort(ty)),
|
||||||
sgn != 0, sig, exp);
|
sgn != 0, exp, sig);
|
||||||
expr * a = ctx->fpautil().mk_value(tmp);
|
expr * a = ctx->fpautil().mk_value(tmp);
|
||||||
ctx->save_ast_trail(a);
|
ctx->save_ast_trail(a);
|
||||||
RETURN_Z3(of_expr(a));
|
RETURN_Z3(of_expr(a));
|
||||||
|
@ -1072,18 +1072,18 @@ extern "C" {
|
||||||
|
|
||||||
Z3_ast Z3_API Z3_mk_fpa_to_fp_int_real(Z3_context c, Z3_ast rm, Z3_ast exp, Z3_ast sig, Z3_sort s) {
|
Z3_ast Z3_API Z3_mk_fpa_to_fp_int_real(Z3_context c, Z3_ast rm, Z3_ast exp, Z3_ast sig, Z3_sort s) {
|
||||||
Z3_TRY;
|
Z3_TRY;
|
||||||
LOG_Z3_mk_fpa_to_fp_int_real(c, rm, sig, exp, s);
|
LOG_Z3_mk_fpa_to_fp_int_real(c, rm, exp, sig, s);
|
||||||
RESET_ERROR_CODE();
|
RESET_ERROR_CODE();
|
||||||
api::context * ctx = mk_c(c);
|
api::context * ctx = mk_c(c);
|
||||||
fpa_util & fu = ctx->fpautil();
|
fpa_util & fu = ctx->fpautil();
|
||||||
if (!fu.is_rm(to_expr(rm)) ||
|
if (!fu.is_rm(to_expr(rm)) ||
|
||||||
!ctx->autil().is_real(to_expr(sig)) ||
|
|
||||||
!ctx->autil().is_int(to_expr(exp)) ||
|
!ctx->autil().is_int(to_expr(exp)) ||
|
||||||
|
!ctx->autil().is_real(to_expr(sig)) ||
|
||||||
!fu.is_float(to_sort(s))) {
|
!fu.is_float(to_sort(s))) {
|
||||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
expr * a = fu.mk_to_fp(to_sort(s), to_expr(rm), to_expr(sig), to_expr(exp));
|
expr * a = fu.mk_to_fp(to_sort(s), to_expr(rm), to_expr(exp), to_expr(sig));
|
||||||
ctx->save_ast_trail(a);
|
ctx->save_ast_trail(a);
|
||||||
RETURN_Z3(of_expr(a));
|
RETURN_Z3(of_expr(a));
|
||||||
Z3_CATCH_RETURN(0);
|
Z3_CATCH_RETURN(0);
|
||||||
|
|
|
@ -374,7 +374,11 @@
|
||||||
<Compile Include="RatNum.cs" />
|
<Compile Include="RatNum.cs" />
|
||||||
<Compile Include="RealExpr.cs" />
|
<Compile Include="RealExpr.cs" />
|
||||||
<Compile Include="RealSort.cs" />
|
<Compile Include="RealSort.cs" />
|
||||||
|
<Compile Include="ReExpr.cs" />
|
||||||
<Compile Include="RelationSort.cs" />
|
<Compile Include="RelationSort.cs" />
|
||||||
|
<Compile Include="ReSort.cs" />
|
||||||
|
<Compile Include="SeqExpr.cs" />
|
||||||
|
<Compile Include="SeqSort.cs" />
|
||||||
<Compile Include="SetSort.cs" />
|
<Compile Include="SetSort.cs" />
|
||||||
<Compile Include="Statistics.cs" />
|
<Compile Include="Statistics.cs" />
|
||||||
<Compile Include="Status.cs" />
|
<Compile Include="Status.cs" />
|
||||||
|
|
1424
src/api/python/z3.py
1424
src/api/python/z3.py
File diff suppressed because it is too large
Load diff
|
@ -68,8 +68,8 @@ _z3_op_to_fpa_normal_str = {
|
||||||
Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN : 'RoundNearestTiesToEven()', Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY : 'RoundNearestTiesToAway()',
|
Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN : 'RoundNearestTiesToEven()', Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY : 'RoundNearestTiesToAway()',
|
||||||
Z3_OP_FPA_RM_TOWARD_POSITIVE : 'RoundTowardPositive()', Z3_OP_FPA_RM_TOWARD_NEGATIVE : 'RoundTowardNegative()',
|
Z3_OP_FPA_RM_TOWARD_POSITIVE : 'RoundTowardPositive()', Z3_OP_FPA_RM_TOWARD_NEGATIVE : 'RoundTowardNegative()',
|
||||||
Z3_OP_FPA_RM_TOWARD_ZERO : 'RoundTowardZero()',
|
Z3_OP_FPA_RM_TOWARD_ZERO : 'RoundTowardZero()',
|
||||||
Z3_OP_FPA_PLUS_INF : '+oo', Z3_OP_FPA_MINUS_INF : '-oo',
|
Z3_OP_FPA_PLUS_INF : 'fpPlusInfinity', Z3_OP_FPA_MINUS_INF : 'fpMinusInfinity',
|
||||||
Z3_OP_FPA_NAN : 'NaN', Z3_OP_FPA_PLUS_ZERO : 'PZero', Z3_OP_FPA_MINUS_ZERO : 'NZero',
|
Z3_OP_FPA_NAN : 'fpNaN', Z3_OP_FPA_PLUS_ZERO : 'fpPZero', Z3_OP_FPA_MINUS_ZERO : 'fpNZero',
|
||||||
Z3_OP_FPA_ADD : 'fpAdd', Z3_OP_FPA_SUB : 'fpSub', Z3_OP_FPA_NEG : 'fpNeg', Z3_OP_FPA_MUL : 'fpMul',
|
Z3_OP_FPA_ADD : 'fpAdd', Z3_OP_FPA_SUB : 'fpSub', Z3_OP_FPA_NEG : 'fpNeg', Z3_OP_FPA_MUL : 'fpMul',
|
||||||
Z3_OP_FPA_DIV : 'fpDiv', Z3_OP_FPA_REM : 'fpRem', Z3_OP_FPA_ABS : 'fpAbs',
|
Z3_OP_FPA_DIV : 'fpDiv', Z3_OP_FPA_REM : 'fpRem', Z3_OP_FPA_ABS : 'fpAbs',
|
||||||
Z3_OP_FPA_MIN : 'fpMin', Z3_OP_FPA_MAX : 'fpMax',
|
Z3_OP_FPA_MIN : 'fpMin', Z3_OP_FPA_MAX : 'fpMax',
|
||||||
|
@ -588,14 +588,24 @@ class Formatter:
|
||||||
|
|
||||||
def pp_fp_value(self, a):
|
def pp_fp_value(self, a):
|
||||||
z3._z3_assert(isinstance(a, z3.FPNumRef), 'type mismatch')
|
z3._z3_assert(isinstance(a, z3.FPNumRef), 'type mismatch')
|
||||||
if not self.fpa_pretty:
|
if not self.fpa_pretty:
|
||||||
|
r = []
|
||||||
if (a.isNaN()):
|
if (a.isNaN()):
|
||||||
return to_format('NaN')
|
r.append(to_format(_z3_op_to_fpa_normal_str[Z3_OP_FPA_NAN]))
|
||||||
|
r.append(to_format('('))
|
||||||
|
r.append(to_format(a.sort()))
|
||||||
|
r.append(to_format(')'))
|
||||||
|
return compose(r)
|
||||||
elif (a.isInf()):
|
elif (a.isInf()):
|
||||||
if (a.isNegative()):
|
if (a.isNegative()):
|
||||||
return to_format('-oo')
|
r.append(to_format(_z3_op_to_fpa_normal_str[Z3_OP_FPA_MINUS_INF]))
|
||||||
else:
|
else:
|
||||||
return to_format('+oo')
|
r.append(to_format(_z3_op_to_fpa_normal_str[Z3_OP_FPA_PLUS_INF]))
|
||||||
|
r.append(to_format('('))
|
||||||
|
r.append(to_format(a.sort()))
|
||||||
|
r.append(to_format(')'))
|
||||||
|
return compose(r)
|
||||||
|
|
||||||
elif (a.isZero()):
|
elif (a.isZero()):
|
||||||
if (a.isNegative()):
|
if (a.isNegative()):
|
||||||
return to_format('-zero')
|
return to_format('-zero')
|
||||||
|
@ -1195,6 +1205,10 @@ def set_fpa_pretty(flag=True):
|
||||||
|
|
||||||
set_fpa_pretty(True)
|
set_fpa_pretty(True)
|
||||||
|
|
||||||
|
def get_fpa_pretty():
|
||||||
|
global Formatter
|
||||||
|
return _Formatter.fpa_pretty
|
||||||
|
|
||||||
def in_html_mode():
|
def in_html_mode():
|
||||||
return isinstance(_Formatter, HTMLFormatter)
|
return isinstance(_Formatter, HTMLFormatter)
|
||||||
|
|
||||||
|
|
|
@ -2490,12 +2490,12 @@ void fpa2bv_converter::mk_to_fp_real_int(func_decl * f, unsigned num, expr * con
|
||||||
SASSERT(is_app_of(args[0], m_util.get_family_id(), OP_FPA_INTERNAL_RM));
|
SASSERT(is_app_of(args[0], m_util.get_family_id(), OP_FPA_INTERNAL_RM));
|
||||||
expr * bv_rm = to_app(args[0])->get_arg(0);
|
expr * bv_rm = to_app(args[0])->get_arg(0);
|
||||||
|
|
||||||
rational q;
|
rational e;
|
||||||
if (!m_arith_util.is_numeral(args[1], q))
|
if (!m_arith_util.is_numeral(args[1], e))
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
|
||||||
rational e;
|
rational q;
|
||||||
if (!m_arith_util.is_numeral(args[2], e))
|
if (!m_arith_util.is_numeral(args[2], q))
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
|
||||||
SASSERT(e.is_int64());
|
SASSERT(e.is_int64());
|
||||||
|
@ -2505,11 +2505,11 @@ void fpa2bv_converter::mk_to_fp_real_int(func_decl * f, unsigned num, expr * con
|
||||||
return mk_pzero(f, result);
|
return mk_pzero(f, result);
|
||||||
else {
|
else {
|
||||||
scoped_mpf nte(m_mpf_manager), nta(m_mpf_manager), tp(m_mpf_manager), tn(m_mpf_manager), tz(m_mpf_manager);
|
scoped_mpf nte(m_mpf_manager), nta(m_mpf_manager), tp(m_mpf_manager), tn(m_mpf_manager), tz(m_mpf_manager);
|
||||||
m_mpf_manager.set(nte, ebits, sbits, MPF_ROUND_NEAREST_TEVEN, q.to_mpq(), e.to_mpq().numerator());
|
m_mpf_manager.set(nte, ebits, sbits, MPF_ROUND_NEAREST_TEVEN, e.to_mpq().numerator(), q.to_mpq());
|
||||||
m_mpf_manager.set(nta, ebits, sbits, MPF_ROUND_NEAREST_TAWAY, q.to_mpq(), e.to_mpq().numerator());
|
m_mpf_manager.set(nta, ebits, sbits, MPF_ROUND_NEAREST_TAWAY, e.to_mpq().numerator(), q.to_mpq());
|
||||||
m_mpf_manager.set(tp, ebits, sbits, MPF_ROUND_TOWARD_POSITIVE, q.to_mpq(), e.to_mpq().numerator());
|
m_mpf_manager.set(tp, ebits, sbits, MPF_ROUND_TOWARD_POSITIVE, e.to_mpq().numerator(), q.to_mpq());
|
||||||
m_mpf_manager.set(tn, ebits, sbits, MPF_ROUND_TOWARD_NEGATIVE, q.to_mpq(), e.to_mpq().numerator());
|
m_mpf_manager.set(tn, ebits, sbits, MPF_ROUND_TOWARD_NEGATIVE, e.to_mpq().numerator(), q.to_mpq());
|
||||||
m_mpf_manager.set(tz, ebits, sbits, MPF_ROUND_TOWARD_ZERO, q.to_mpq(), e.to_mpq().numerator());
|
m_mpf_manager.set(tz, ebits, sbits, MPF_ROUND_TOWARD_ZERO, e.to_mpq().numerator(), q.to_mpq());
|
||||||
|
|
||||||
app_ref a_nte(m), a_nta(m), a_tp(m), a_tn(m), a_tz(m);
|
app_ref a_nte(m), a_nta(m), a_tp(m), a_tn(m), a_tz(m);
|
||||||
a_nte = m_plugin->mk_numeral(nte);
|
a_nte = m_plugin->mk_numeral(nte);
|
||||||
|
|
|
@ -490,11 +490,24 @@ func_decl * fpa_decl_plugin::mk_to_fp(decl_kind k, unsigned num_parameters, para
|
||||||
return m_manager->mk_func_decl(name, arity, domain, fp, func_decl_info(m_family_id, k, num_parameters, parameters));
|
return m_manager->mk_func_decl(name, arity, domain, fp, func_decl_info(m_family_id, k, num_parameters, parameters));
|
||||||
}
|
}
|
||||||
else if (arity == 3 &&
|
else if (arity == 3 &&
|
||||||
is_sort_of(domain[0], m_family_id, ROUNDING_MODE_SORT) &&
|
is_sort_of(domain[0], m_family_id, ROUNDING_MODE_SORT) &&
|
||||||
is_sort_of(domain[1], m_arith_fid, REAL_SORT) &&
|
is_sort_of(domain[1], m_arith_fid, REAL_SORT) &&
|
||||||
is_sort_of(domain[2], m_arith_fid, INT_SORT))
|
is_sort_of(domain[2], m_arith_fid, INT_SORT))
|
||||||
{
|
{
|
||||||
// Rounding + 1 Real + 1 Int -> 1 FP
|
// Rounding + 1 Real + 1 Int -> 1 FP
|
||||||
|
if (!(num_parameters == 2 && parameters[0].is_int() && parameters[1].is_int()))
|
||||||
|
m_manager->raise_exception("expecting two integer parameters to to_fp");
|
||||||
|
|
||||||
|
sort * fp = mk_float_sort(parameters[0].get_int(), parameters[1].get_int());
|
||||||
|
symbol name("to_fp");
|
||||||
|
return m_manager->mk_func_decl(name, arity, domain, fp, func_decl_info(m_family_id, k, num_parameters, parameters));
|
||||||
|
}
|
||||||
|
else if (arity == 3 &&
|
||||||
|
is_sort_of(domain[0], m_family_id, ROUNDING_MODE_SORT) &&
|
||||||
|
is_sort_of(domain[1], m_arith_fid, INT_SORT) &&
|
||||||
|
is_sort_of(domain[2], m_arith_fid, REAL_SORT))
|
||||||
|
{
|
||||||
|
// Rounding + 1 Int + 1 Real -> 1 FP
|
||||||
if (!(num_parameters == 2 && parameters[0].is_int() && parameters[1].is_int()))
|
if (!(num_parameters == 2 && parameters[0].is_int() && parameters[1].is_int()))
|
||||||
m_manager->raise_exception("expecting two integer parameters to to_fp");
|
m_manager->raise_exception("expecting two integer parameters to to_fp");
|
||||||
|
|
||||||
|
@ -545,6 +558,7 @@ func_decl * fpa_decl_plugin::mk_to_fp(decl_kind k, unsigned num_parameters, para
|
||||||
"(Real), "
|
"(Real), "
|
||||||
"(RoundingMode (_ BitVec (eb+sb))), "
|
"(RoundingMode (_ BitVec (eb+sb))), "
|
||||||
"(RoundingMode (_ FloatingPoint eb' sb')), "
|
"(RoundingMode (_ FloatingPoint eb' sb')), "
|
||||||
|
"(RoundingMode Int Real), "
|
||||||
"(RoundingMode Real Int), "
|
"(RoundingMode Real Int), "
|
||||||
"(RoundingMode Int), and "
|
"(RoundingMode Int), and "
|
||||||
"(RoundingMode Real)."
|
"(RoundingMode Real)."
|
||||||
|
|
|
@ -24,7 +24,7 @@ Revision History:
|
||||||
#include"arith_decl_plugin.h"
|
#include"arith_decl_plugin.h"
|
||||||
#include"bv_decl_plugin.h"
|
#include"bv_decl_plugin.h"
|
||||||
#include"mpf.h"
|
#include"mpf.h"
|
||||||
|
|
||||||
enum fpa_sort_kind {
|
enum fpa_sort_kind {
|
||||||
FLOATING_POINT_SORT,
|
FLOATING_POINT_SORT,
|
||||||
ROUNDING_MODE_SORT,
|
ROUNDING_MODE_SORT,
|
||||||
|
@ -89,16 +89,16 @@ enum fpa_op_kind {
|
||||||
/* Internal use only */
|
/* Internal use only */
|
||||||
OP_FPA_INTERNAL_RM, // Internal conversion from (_ BitVec 3) to RoundingMode
|
OP_FPA_INTERNAL_RM, // Internal conversion from (_ BitVec 3) to RoundingMode
|
||||||
OP_FPA_INTERNAL_BVWRAP,
|
OP_FPA_INTERNAL_BVWRAP,
|
||||||
OP_FPA_INTERNAL_BVUNWRAP,
|
OP_FPA_INTERNAL_BVUNWRAP,
|
||||||
|
|
||||||
OP_FPA_INTERNAL_MIN_I,
|
OP_FPA_INTERNAL_MIN_I,
|
||||||
OP_FPA_INTERNAL_MAX_I,
|
OP_FPA_INTERNAL_MAX_I,
|
||||||
OP_FPA_INTERNAL_MIN_UNSPECIFIED,
|
OP_FPA_INTERNAL_MIN_UNSPECIFIED,
|
||||||
OP_FPA_INTERNAL_MAX_UNSPECIFIED,
|
OP_FPA_INTERNAL_MAX_UNSPECIFIED,
|
||||||
OP_FPA_INTERNAL_TO_UBV_UNSPECIFIED,
|
OP_FPA_INTERNAL_TO_UBV_UNSPECIFIED,
|
||||||
OP_FPA_INTERNAL_TO_SBV_UNSPECIFIED,
|
OP_FPA_INTERNAL_TO_SBV_UNSPECIFIED,
|
||||||
OP_FPA_INTERNAL_TO_IEEE_BV_UNSPECIFIED,
|
OP_FPA_INTERNAL_TO_IEEE_BV_UNSPECIFIED,
|
||||||
OP_FPA_INTERNAL_TO_REAL_UNSPECIFIED,
|
OP_FPA_INTERNAL_TO_REAL_UNSPECIFIED,
|
||||||
|
|
||||||
LAST_FLOAT_OP
|
LAST_FLOAT_OP
|
||||||
};
|
};
|
||||||
|
@ -115,7 +115,7 @@ class fpa_decl_plugin : public decl_plugin {
|
||||||
mpf_eq_proc(scoped_mpf_vector const & values):m_values(values) {}
|
mpf_eq_proc(scoped_mpf_vector const & values):m_values(values) {}
|
||||||
bool operator()(unsigned id1, unsigned id2) const { return m_values.m().eq_core(m_values[id1], m_values[id2]); }
|
bool operator()(unsigned id1, unsigned id2) const { return m_values.m().eq_core(m_values[id1], m_values[id2]); }
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef chashtable<unsigned, mpf_hash_proc, mpf_eq_proc> value_table;
|
typedef chashtable<unsigned, mpf_hash_proc, mpf_eq_proc> value_table;
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ class fpa_decl_plugin : public decl_plugin {
|
||||||
func_decl * mk_rm_unary_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
|
func_decl * mk_rm_unary_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
|
||||||
unsigned arity, sort * const * domain, sort * range);
|
unsigned arity, sort * const * domain, sort * range);
|
||||||
func_decl * mk_fma(decl_kind k, unsigned num_parameters, parameter const * parameters,
|
func_decl * mk_fma(decl_kind k, unsigned num_parameters, parameter const * parameters,
|
||||||
unsigned arity, sort * const * domain, sort * range);
|
unsigned arity, sort * const * domain, sort * range);
|
||||||
func_decl * mk_fp(decl_kind k, unsigned num_parameters, parameter const * parameters,
|
func_decl * mk_fp(decl_kind k, unsigned num_parameters, parameter const * parameters,
|
||||||
unsigned arity, sort * const * domain, sort * range);
|
unsigned arity, sort * const * domain, sort * range);
|
||||||
func_decl * mk_to_fp(decl_kind k, unsigned num_parameters, parameter const * parameters,
|
func_decl * mk_to_fp(decl_kind k, unsigned num_parameters, parameter const * parameters,
|
||||||
|
@ -184,23 +184,23 @@ class fpa_decl_plugin : public decl_plugin {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
fpa_decl_plugin();
|
fpa_decl_plugin();
|
||||||
|
|
||||||
bool is_float_sort(sort * s) const { return is_sort_of(s, m_family_id, FLOATING_POINT_SORT); }
|
bool is_float_sort(sort * s) const { return is_sort_of(s, m_family_id, FLOATING_POINT_SORT); }
|
||||||
bool is_rm_sort(sort * s) const { return is_sort_of(s, m_family_id, ROUNDING_MODE_SORT); }
|
bool is_rm_sort(sort * s) const { return is_sort_of(s, m_family_id, ROUNDING_MODE_SORT); }
|
||||||
|
|
||||||
virtual ~fpa_decl_plugin();
|
virtual ~fpa_decl_plugin();
|
||||||
virtual void finalize();
|
virtual void finalize();
|
||||||
|
|
||||||
virtual decl_plugin * mk_fresh();
|
virtual decl_plugin * mk_fresh();
|
||||||
virtual sort * mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters);
|
virtual sort * mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters);
|
||||||
virtual func_decl * mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
|
virtual func_decl * mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
|
||||||
unsigned arity, sort * const * domain, sort * range);
|
unsigned arity, sort * const * domain, sort * range);
|
||||||
virtual void get_op_names(svector<builtin_name> & op_names, symbol const & logic);
|
virtual void get_op_names(svector<builtin_name> & op_names, symbol const & logic);
|
||||||
virtual void get_sort_names(svector<builtin_name> & sort_names, symbol const & logic);
|
virtual void get_sort_names(svector<builtin_name> & sort_names, symbol const & logic);
|
||||||
virtual expr * get_some_value(sort * s);
|
virtual expr * get_some_value(sort * s);
|
||||||
virtual bool is_value(app* e) const;
|
virtual bool is_value(app* e) const;
|
||||||
virtual bool is_unique_value(app* e) const;
|
virtual bool is_unique_value(app* e) const;
|
||||||
|
|
||||||
mpf_manager & fm() { return m_fm; }
|
mpf_manager & fm() { return m_fm; }
|
||||||
func_decl * mk_numeral_decl(mpf const & v);
|
func_decl * mk_numeral_decl(mpf const & v);
|
||||||
app * mk_numeral(mpf const & v);
|
app * mk_numeral(mpf const & v);
|
||||||
|
@ -209,7 +209,7 @@ public:
|
||||||
bool is_rm_numeral(expr * n, mpf_rounding_mode & val);
|
bool is_rm_numeral(expr * n, mpf_rounding_mode & val);
|
||||||
bool is_rm_numeral(expr * n);
|
bool is_rm_numeral(expr * n);
|
||||||
|
|
||||||
mpf const & get_value(unsigned id) const {
|
mpf const & get_value(unsigned id) const {
|
||||||
SASSERT(m_value_table.contains(id));
|
SASSERT(m_value_table.contains(id));
|
||||||
return m_values[id];
|
return m_values[id];
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ class fpa_util {
|
||||||
ast_manager & m_manager;
|
ast_manager & m_manager;
|
||||||
fpa_decl_plugin * m_plugin;
|
fpa_decl_plugin * m_plugin;
|
||||||
family_id m_fid;
|
family_id m_fid;
|
||||||
arith_util m_a_util;
|
arith_util m_a_util;
|
||||||
bv_util m_bv_util;
|
bv_util m_bv_util;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -269,29 +269,29 @@ public:
|
||||||
app * mk_pzero(sort * s) { return mk_pzero(get_ebits(s), get_sbits(s)); }
|
app * mk_pzero(sort * s) { return mk_pzero(get_ebits(s), get_sbits(s)); }
|
||||||
app * mk_nzero(sort * s) { return mk_nzero(get_ebits(s), get_sbits(s)); }
|
app * mk_nzero(sort * s) { return mk_nzero(get_ebits(s), get_sbits(s)); }
|
||||||
|
|
||||||
bool is_nan(expr * n) { scoped_mpf v(fm()); return is_numeral(n, v) && fm().is_nan(v); }
|
bool is_nan(expr * n) { scoped_mpf v(fm()); return is_numeral(n, v) && fm().is_nan(v); }
|
||||||
bool is_pinf(expr * n) { scoped_mpf v(fm()); return is_numeral(n, v) && fm().is_pinf(v); }
|
bool is_pinf(expr * n) { scoped_mpf v(fm()); return is_numeral(n, v) && fm().is_pinf(v); }
|
||||||
bool is_ninf(expr * n) { scoped_mpf v(fm()); return is_numeral(n, v) && fm().is_ninf(v); }
|
bool is_ninf(expr * n) { scoped_mpf v(fm()); return is_numeral(n, v) && fm().is_ninf(v); }
|
||||||
bool is_zero(expr * n) { scoped_mpf v(fm()); return is_numeral(n, v) && fm().is_zero(v); }
|
bool is_zero(expr * n) { scoped_mpf v(fm()); return is_numeral(n, v) && fm().is_zero(v); }
|
||||||
bool is_pzero(expr * n) { scoped_mpf v(fm()); return is_numeral(n, v) && fm().is_pzero(v); }
|
bool is_pzero(expr * n) { scoped_mpf v(fm()); return is_numeral(n, v) && fm().is_pzero(v); }
|
||||||
bool is_nzero(expr * n) { scoped_mpf v(fm()); return is_numeral(n, v) && fm().is_nzero(v); }
|
bool is_nzero(expr * n) { scoped_mpf v(fm()); return is_numeral(n, v) && fm().is_nzero(v); }
|
||||||
|
|
||||||
app * mk_fp(expr * arg1, expr * arg2, expr * arg3) { return m().mk_app(m_fid, OP_FPA_FP, arg1, arg2, arg3); }
|
app * mk_fp(expr * sgn, expr * exp, expr * sig) { return m().mk_app(m_fid, OP_FPA_FP, sgn, exp, sig); }
|
||||||
app * mk_to_fp(sort * s, expr * bv_t) {
|
app * mk_to_fp(sort * s, expr * bv_t) {
|
||||||
SASSERT(is_float(s) && s->get_num_parameters() == 2);
|
SASSERT(is_float(s) && s->get_num_parameters() == 2);
|
||||||
return m().mk_app(m_fid, OP_FPA_TO_FP, 2, s->get_parameters(), 1, &bv_t);
|
return m().mk_app(m_fid, OP_FPA_TO_FP, 2, s->get_parameters(), 1, &bv_t);
|
||||||
}
|
}
|
||||||
app * mk_to_fp(sort * s, expr * rm, expr * t) {
|
app * mk_to_fp(sort * s, expr * rm, expr * t) {
|
||||||
SASSERT(is_float(s) && s->get_num_parameters() == 2);
|
SASSERT(is_float(s) && s->get_num_parameters() == 2);
|
||||||
expr * args[] = { rm, t };
|
expr * args[] = { rm, t };
|
||||||
return m().mk_app(m_fid, OP_FPA_TO_FP, 2, s->get_parameters(), 2, args);
|
return m().mk_app(m_fid, OP_FPA_TO_FP, 2, s->get_parameters(), 2, args);
|
||||||
}
|
}
|
||||||
app * mk_to_fp(sort * s, expr * rm, expr * sig, expr * exp) {
|
app * mk_to_fp(sort * s, expr * rm, expr * exp, expr * sig) {
|
||||||
SASSERT(is_float(s) && s->get_num_parameters() == 2);
|
SASSERT(is_float(s) && s->get_num_parameters() == 2);
|
||||||
expr * args[] = { rm, sig, exp };
|
expr * args[] = { rm, exp, sig};
|
||||||
return m().mk_app(m_fid, OP_FPA_TO_FP, 2, s->get_parameters(), 3, args);
|
return m().mk_app(m_fid, OP_FPA_TO_FP, 2, s->get_parameters(), 3, args);
|
||||||
}
|
}
|
||||||
app * mk_to_fp_unsigned(sort * s, expr * rm, expr * t) {
|
app * mk_to_fp_unsigned(sort * s, expr * rm, expr * t) {
|
||||||
SASSERT(is_float(s) && s->get_num_parameters() == 2);
|
SASSERT(is_float(s) && s->get_num_parameters() == 2);
|
||||||
expr * args[] = { rm, t };
|
expr * args[] = { rm, t };
|
||||||
return m().mk_app(m_fid, OP_FPA_TO_FP_UNSIGNED, 2, s->get_parameters(), 2, args);
|
return m().mk_app(m_fid, OP_FPA_TO_FP_UNSIGNED, 2, s->get_parameters(), 2, args);
|
||||||
|
@ -299,11 +299,11 @@ public:
|
||||||
|
|
||||||
bool is_to_fp(expr * n) { return is_app_of(n, m_fid, OP_FPA_TO_FP); }
|
bool is_to_fp(expr * n) { return is_app_of(n, m_fid, OP_FPA_TO_FP); }
|
||||||
|
|
||||||
app * mk_to_ubv(expr * rm, expr * t, unsigned sz) {
|
app * mk_to_ubv(expr * rm, expr * t, unsigned sz) {
|
||||||
parameter ps[] = { parameter(sz) };
|
parameter ps[] = { parameter(sz) };
|
||||||
expr * args[] = { rm, t };
|
expr * args[] = { rm, t };
|
||||||
return m().mk_app(m_fid, OP_FPA_TO_UBV, 1, ps, 2, args); }
|
return m().mk_app(m_fid, OP_FPA_TO_UBV, 1, ps, 2, args); }
|
||||||
app * mk_to_sbv(expr * rm, expr * t, unsigned sz) {
|
app * mk_to_sbv(expr * rm, expr * t, unsigned sz) {
|
||||||
parameter ps[] = { parameter(sz) };
|
parameter ps[] = { parameter(sz) };
|
||||||
expr * args[] = { rm, t };
|
expr * args[] = { rm, t };
|
||||||
return m().mk_app(m_fid, OP_FPA_TO_SBV, 1, ps, 2, args);
|
return m().mk_app(m_fid, OP_FPA_TO_SBV, 1, ps, 2, args);
|
||||||
|
@ -336,7 +336,7 @@ public:
|
||||||
app * mk_is_inf(expr * arg1) { return m().mk_app(m_fid, OP_FPA_IS_INF, arg1); }
|
app * mk_is_inf(expr * arg1) { return m().mk_app(m_fid, OP_FPA_IS_INF, arg1); }
|
||||||
app * mk_is_zero(expr * arg1) { return m().mk_app(m_fid, OP_FPA_IS_ZERO, arg1); }
|
app * mk_is_zero(expr * arg1) { return m().mk_app(m_fid, OP_FPA_IS_ZERO, arg1); }
|
||||||
app * mk_is_normal(expr * arg1) { return m().mk_app(m_fid, OP_FPA_IS_NORMAL, arg1); }
|
app * mk_is_normal(expr * arg1) { return m().mk_app(m_fid, OP_FPA_IS_NORMAL, arg1); }
|
||||||
app * mk_is_subnormal(expr * arg1) { return m().mk_app(m_fid, OP_FPA_IS_SUBNORMAL, arg1); }
|
app * mk_is_subnormal(expr * arg1) { return m().mk_app(m_fid, OP_FPA_IS_SUBNORMAL, arg1); }
|
||||||
app * mk_is_positive(expr * arg1) { return m().mk_app(m_fid, OP_FPA_IS_POSITIVE, arg1); }
|
app * mk_is_positive(expr * arg1) { return m().mk_app(m_fid, OP_FPA_IS_POSITIVE, arg1); }
|
||||||
app * mk_is_negative(expr * arg1) { return m().mk_app(m_fid, OP_FPA_IS_NEGATIVE, arg1); }
|
app * mk_is_negative(expr * arg1) { return m().mk_app(m_fid, OP_FPA_IS_NEGATIVE, arg1); }
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ br_status fpa_rewriter::mk_to_fp(func_decl * f, unsigned num_args, expr * const
|
||||||
mpf_exp_t mpf_exp = mpzm.get_int64(exp);
|
mpf_exp_t mpf_exp = mpzm.get_int64(exp);
|
||||||
mpf_exp = m_fm.unbias_exp(ebits, mpf_exp);
|
mpf_exp = m_fm.unbias_exp(ebits, mpf_exp);
|
||||||
|
|
||||||
m_fm.set(v, ebits, sbits, !mpzm.is_zero(z), sig, mpf_exp);
|
m_fm.set(v, ebits, sbits, !mpzm.is_zero(z), mpf_exp, sig);
|
||||||
TRACE("fp_rewriter",
|
TRACE("fp_rewriter",
|
||||||
tout << "sgn: " << !mpzm.is_zero(z) << std::endl;
|
tout << "sgn: " << !mpzm.is_zero(z) << std::endl;
|
||||||
tout << "sig: " << mpzm.to_string(sig) << std::endl;
|
tout << "sig: " << mpzm.to_string(sig) << std::endl;
|
||||||
|
@ -267,7 +267,21 @@ br_status fpa_rewriter::mk_to_fp(func_decl * f, unsigned num_args, expr * const
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
|
|
||||||
TRACE("fp_rewriter", tout << "r1: " << r1 << ", r2: " << r2 << "\n";);
|
TRACE("fp_rewriter", tout << "r1: " << r1 << ", r2: " << r2 << "\n";);
|
||||||
m_fm.set(v, ebits, sbits, rmv, r1.to_mpq(), r2.to_mpq().numerator());
|
m_fm.set(v, ebits, sbits, rmv, r2.to_mpq().numerator(), r1.to_mpq());
|
||||||
|
result = m_util.mk_value(v);
|
||||||
|
return BR_DONE;
|
||||||
|
}
|
||||||
|
else if (m_util.is_rm_numeral(args[0], rmv) &&
|
||||||
|
m_util.au().is_int(args[1]) &&
|
||||||
|
m_util.au().is_real(args[2])) {
|
||||||
|
// rm + int + real -> float
|
||||||
|
if (!m_util.is_rm_numeral(args[0], rmv) ||
|
||||||
|
!m_util.au().is_numeral(args[1], r1) ||
|
||||||
|
!m_util.au().is_numeral(args[2], r2))
|
||||||
|
return BR_FAILED;
|
||||||
|
|
||||||
|
TRACE("fp_rewriter", tout << "r1: " << r1 << ", r2: " << r2 << "\n";);
|
||||||
|
m_fm.set(v, ebits, sbits, rmv, r1.to_mpq().numerator(), r2.to_mpq());
|
||||||
result = m_util.mk_value(v);
|
result = m_util.mk_value(v);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
}
|
}
|
||||||
|
@ -281,8 +295,8 @@ br_status fpa_rewriter::mk_to_fp(func_decl * f, unsigned num_args, expr * const
|
||||||
mpf_exp_t biased_exp = m_fm.mpz_manager().get_int64(r2.to_mpq().numerator());
|
mpf_exp_t biased_exp = m_fm.mpz_manager().get_int64(r2.to_mpq().numerator());
|
||||||
m_fm.set(v, bvs2, bvs3 + 1,
|
m_fm.set(v, bvs2, bvs3 + 1,
|
||||||
r1.is_one(),
|
r1.is_one(),
|
||||||
r3.to_mpq().numerator(),
|
m_fm.unbias_exp(bvs2, biased_exp),
|
||||||
m_fm.unbias_exp(bvs2, biased_exp));
|
r3.to_mpq().numerator());
|
||||||
TRACE("fp_rewriter", tout << "v = " << m_fm.to_string(v) << std::endl;);
|
TRACE("fp_rewriter", tout << "v = " << m_fm.to_string(v) << std::endl;);
|
||||||
result = m_util.mk_value(v);
|
result = m_util.mk_value(v);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
|
@ -753,23 +767,23 @@ br_status fpa_rewriter::mk_rm(expr * arg, expr_ref & result) {
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
br_status fpa_rewriter::mk_fp(expr * arg1, expr * arg2, expr * arg3, expr_ref & result) {
|
br_status fpa_rewriter::mk_fp(expr * sgn, expr * exp, expr * sig, expr_ref & result) {
|
||||||
unsynch_mpz_manager & mpzm = m_fm.mpz_manager();
|
unsynch_mpz_manager & mpzm = m_fm.mpz_manager();
|
||||||
bv_util bu(m());
|
bv_util bu(m());
|
||||||
rational r1, r2, r3;
|
rational rsgn, rexp, rsig;
|
||||||
unsigned bvs1, bvs2, bvs3;
|
unsigned bvsz_sgn, bvsz_exp, bvsz_sig;
|
||||||
|
|
||||||
if (bu.is_numeral(arg1, r1, bvs1) &&
|
if (bu.is_numeral(sgn, rsgn, bvsz_sgn) &&
|
||||||
bu.is_numeral(arg2, r2, bvs2) &&
|
bu.is_numeral(sig, rsig, bvsz_sig) &&
|
||||||
bu.is_numeral(arg3, r3, bvs3)) {
|
bu.is_numeral(exp, rexp, bvsz_exp)) {
|
||||||
SASSERT(mpzm.is_one(r2.to_mpq().denominator()));
|
SASSERT(mpzm.is_one(rexp.to_mpq().denominator()));
|
||||||
SASSERT(mpzm.is_one(r3.to_mpq().denominator()));
|
SASSERT(mpzm.is_one(rsig.to_mpq().denominator()));
|
||||||
scoped_mpf v(m_fm);
|
scoped_mpf v(m_fm);
|
||||||
mpf_exp_t biased_exp = mpzm.get_int64(r2.to_mpq().numerator());
|
mpf_exp_t biased_exp = mpzm.get_int64(rexp.to_mpq().numerator());
|
||||||
m_fm.set(v, bvs2, bvs3 + 1,
|
m_fm.set(v, bvsz_exp, bvsz_sig + 1,
|
||||||
r1.is_one(),
|
rsgn.is_one(),
|
||||||
r3.to_mpq().numerator(),
|
m_fm.unbias_exp(bvsz_exp, biased_exp),
|
||||||
m_fm.unbias_exp(bvs2, biased_exp));
|
rsig.to_mpq().numerator());
|
||||||
TRACE("fp_rewriter", tout << "simplified (fp ...) to " << m_fm.to_string(v) << std::endl;);
|
TRACE("fp_rewriter", tout << "simplified (fp ...) to " << m_fm.to_string(v) << std::endl;);
|
||||||
result = m_util.mk_value(v);
|
result = m_util.mk_value(v);
|
||||||
return BR_DONE;
|
return BR_DONE;
|
||||||
|
|
|
@ -79,7 +79,7 @@ public:
|
||||||
br_status mk_to_fp_unsigned(func_decl * f, expr * arg1, expr * arg2, expr_ref & result);
|
br_status mk_to_fp_unsigned(func_decl * f, expr * arg1, expr * arg2, expr_ref & result);
|
||||||
|
|
||||||
br_status mk_rm(expr * arg, expr_ref & result);
|
br_status mk_rm(expr * arg, expr_ref & result);
|
||||||
br_status mk_fp(expr * arg1, expr * arg2, expr * arg3, expr_ref & result);
|
br_status mk_fp(expr * sgn, expr * exp, expr * sig, expr_ref & result);
|
||||||
br_status mk_to_fp_unsigned(expr * arg1, expr * arg2, expr_ref & result);
|
br_status mk_to_fp_unsigned(expr * arg1, expr * arg2, expr_ref & result);
|
||||||
br_status mk_to_ubv(func_decl * f, expr * arg1, expr * arg2, expr_ref & result);
|
br_status mk_to_ubv(func_decl * f, expr * arg1, expr * arg2, expr_ref & result);
|
||||||
br_status mk_to_sbv(func_decl * f, expr * arg1, expr * arg2, expr_ref & result);
|
br_status mk_to_sbv(func_decl * f, expr * arg1, expr * arg2, expr_ref & result);
|
||||||
|
|
|
@ -235,7 +235,7 @@ namespace smt {
|
||||||
SASSERT(mpzm.is_int64(exp_u));
|
SASSERT(mpzm.is_int64(exp_u));
|
||||||
|
|
||||||
scoped_mpf f(mpfm);
|
scoped_mpf f(mpfm);
|
||||||
mpfm.set(f, m_ebits, m_sbits, mpzm.is_one(sgn_z), sig_z, mpzm.get_int64(exp_u));
|
mpfm.set(f, m_ebits, m_sbits, mpzm.is_one(sgn_z), mpzm.get_int64(exp_u), sig_z);
|
||||||
result = m_fu.mk_value(f);
|
result = m_fu.mk_value(f);
|
||||||
|
|
||||||
TRACE("t_fpa", tout << "fpa_value_proc::mk_value [" <<
|
TRACE("t_fpa", tout << "fpa_value_proc::mk_value [" <<
|
||||||
|
|
|
@ -132,7 +132,7 @@ expr_ref fpa2bv_model_converter::convert_bv2fp(sort * s, expr * sgn, expr * exp,
|
||||||
mpzm.set(sig_z, sig_q.to_mpq().numerator());
|
mpzm.set(sig_z, sig_q.to_mpq().numerator());
|
||||||
exp_z = mpzm.get_int64(exp_unbiased_q.to_mpq().numerator());
|
exp_z = mpzm.get_int64(exp_unbiased_q.to_mpq().numerator());
|
||||||
|
|
||||||
fu.fm().set(fp_val, ebits, sbits, !mpqm.is_zero(sgn_q.to_mpq()), sig_z, exp_z);
|
fu.fm().set(fp_val, ebits, sbits, !mpqm.is_zero(sgn_q.to_mpq()), exp_z, sig_z);
|
||||||
|
|
||||||
mpzm.del(sig_z);
|
mpzm.del(sig_z);
|
||||||
|
|
||||||
|
|
358
src/util/mpf.cpp
358
src/util/mpf.cpp
File diff suppressed because it is too large
Load diff
|
@ -37,7 +37,7 @@ typedef enum {
|
||||||
|
|
||||||
typedef int64 mpf_exp_t;
|
typedef int64 mpf_exp_t;
|
||||||
|
|
||||||
class mpf {
|
class mpf {
|
||||||
friend class mpf_manager;
|
friend class mpf_manager;
|
||||||
friend class scoped_mpf;
|
friend class scoped_mpf;
|
||||||
unsigned ebits:15;
|
unsigned ebits:15;
|
||||||
|
@ -47,11 +47,11 @@ class mpf {
|
||||||
mpf_exp_t exponent;
|
mpf_exp_t exponent;
|
||||||
mpf & operator=(mpf const & other) { UNREACHABLE(); return *this; }
|
mpf & operator=(mpf const & other) { UNREACHABLE(); return *this; }
|
||||||
void set(unsigned _ebits, unsigned _sbits);
|
void set(unsigned _ebits, unsigned _sbits);
|
||||||
public:
|
public:
|
||||||
mpf();
|
mpf();
|
||||||
mpf(unsigned ebits, unsigned sbits);
|
mpf(unsigned ebits, unsigned sbits);
|
||||||
mpf(mpf const & other);
|
mpf(mpf const & other);
|
||||||
~mpf();
|
~mpf();
|
||||||
unsigned get_ebits() const { return ebits; }
|
unsigned get_ebits() const { return ebits; }
|
||||||
unsigned get_sbits() const { return sbits; }
|
unsigned get_sbits() const { return sbits; }
|
||||||
void swap(mpf & other);
|
void swap(mpf & other);
|
||||||
|
@ -74,14 +74,14 @@ public:
|
||||||
void set(mpf & o, unsigned ebits, unsigned sbits, double value);
|
void set(mpf & o, unsigned ebits, unsigned sbits, double value);
|
||||||
void set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode rm, mpq const & value);
|
void set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode rm, mpq const & value);
|
||||||
void set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode rm, char const * value);
|
void set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode rm, char const * value);
|
||||||
void set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode rm, mpq const & significand, mpz const & exponent);
|
void set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode rm, mpz const & exponent, mpq const & significand);
|
||||||
void set(mpf & o, unsigned ebits, unsigned sbits, bool sign, uint64 significand, mpf_exp_t exponent);
|
void set(mpf & o, unsigned ebits, unsigned sbits, bool sign, mpf_exp_t exponent, uint64 significand);
|
||||||
void set(mpf & o, unsigned ebits, unsigned sbits, bool sign, mpz const & significand, mpf_exp_t exponent);
|
void set(mpf & o, unsigned ebits, unsigned sbits, bool sign, mpf_exp_t exponent, mpz const & significand);
|
||||||
void set(mpf & o, mpf const & x);
|
void set(mpf & o, mpf const & x);
|
||||||
void set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode rm, mpf const & x);
|
void set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode rm, mpf const & x);
|
||||||
|
|
||||||
void del(mpf & x) {
|
void del(mpf & x) {
|
||||||
m_mpz_manager.del(x.significand);
|
m_mpz_manager.del(x.significand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void abs(mpf & o);
|
void abs(mpf & o);
|
||||||
|
@ -97,14 +97,14 @@ public:
|
||||||
|
|
||||||
bool is_nzero(mpf const & x);
|
bool is_nzero(mpf const & x);
|
||||||
bool is_pzero(mpf const & x);
|
bool is_pzero(mpf const & x);
|
||||||
|
|
||||||
// structural eq
|
// structural eq
|
||||||
bool eq_core(mpf const & x, mpf const & y) {
|
bool eq_core(mpf const & x, mpf const & y) {
|
||||||
return
|
return
|
||||||
x.ebits == y.ebits &&
|
x.ebits == y.ebits &&
|
||||||
x.sbits == y.sbits &&
|
x.sbits == y.sbits &&
|
||||||
x.sign == y.sign &&
|
x.sign == y.sign &&
|
||||||
m_mpz_manager.eq(x.significand, y.significand) &&
|
m_mpz_manager.eq(x.significand, y.significand) &&
|
||||||
x.exponent == y.exponent;
|
x.exponent == y.exponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public:
|
||||||
void add(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf & o);
|
void add(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf & o);
|
||||||
void sub(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf & o);
|
void sub(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf & o);
|
||||||
void mul(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf & o);
|
void mul(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf & o);
|
||||||
void div(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf & o);
|
void div(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf & o);
|
||||||
|
|
||||||
void fma(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf const &z, mpf & o);
|
void fma(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf const &z, mpf & o);
|
||||||
|
|
||||||
|
@ -143,10 +143,10 @@ public:
|
||||||
|
|
||||||
double to_double(mpf const & x);
|
double to_double(mpf const & x);
|
||||||
float to_float(mpf const & x);
|
float to_float(mpf const & x);
|
||||||
|
|
||||||
bool sgn(mpf const & x) const { return x.sign; }
|
bool sgn(mpf const & x) const { return x.sign; }
|
||||||
const mpz & sig(mpf const & x) const { return x.significand; }
|
const mpz & sig(mpf const & x) const { return x.significand; }
|
||||||
void sig_normalized(mpf const & x, mpz & res) {
|
void sig_normalized(mpf const & x, mpz & res) {
|
||||||
mpf t;
|
mpf t;
|
||||||
set(t, x);
|
set(t, x);
|
||||||
unpack(t, true);
|
unpack(t, true);
|
||||||
|
@ -154,7 +154,7 @@ public:
|
||||||
del(t);
|
del(t);
|
||||||
}
|
}
|
||||||
const mpf_exp_t & exp(mpf const & x) const { return x.exponent; }
|
const mpf_exp_t & exp(mpf const & x) const { return x.exponent; }
|
||||||
mpf_exp_t exp_normalized(mpf const & x) {
|
mpf_exp_t exp_normalized(mpf const & x) {
|
||||||
mpf t;
|
mpf t;
|
||||||
set(t, x);
|
set(t, x);
|
||||||
unpack(t, true);
|
unpack(t, true);
|
||||||
|
@ -186,9 +186,9 @@ public:
|
||||||
unsynch_mpz_manager & mpz_manager(void) { return m_mpz_manager; }
|
unsynch_mpz_manager & mpz_manager(void) { return m_mpz_manager; }
|
||||||
unsynch_mpq_manager & mpq_manager(void) { return m_mpq_manager; }
|
unsynch_mpq_manager & mpq_manager(void) { return m_mpq_manager; }
|
||||||
|
|
||||||
unsigned hash(mpf const & a) {
|
unsigned hash(mpf const & a) {
|
||||||
return hash_u_u(m_mpz_manager.hash(a.significand),
|
return hash_u_u(m_mpz_manager.hash(a.significand),
|
||||||
m_mpz_manager.hash(hash_ull(a.exponent)));
|
m_mpz_manager.hash(hash_ull(a.exponent)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void mk_max_value(unsigned ebits, unsigned sbits, bool sign, mpf & o);
|
void mk_max_value(unsigned ebits, unsigned sbits, bool sign, mpf & o);
|
||||||
|
@ -202,7 +202,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Return the biggest k s.t. 2^k <= a.
|
\brief Return the biggest k s.t. 2^k <= a.
|
||||||
|
|
||||||
\remark Return 0 if a is not positive.
|
\remark Return 0 if a is not positive.
|
||||||
*/
|
*/
|
||||||
unsigned prev_power_of_two(mpf const & a);
|
unsigned prev_power_of_two(mpf const & a);
|
||||||
|
@ -216,16 +216,16 @@ protected:
|
||||||
bool has_bot_exp(mpf const & x);
|
bool has_bot_exp(mpf const & x);
|
||||||
bool has_top_exp(mpf const & x);
|
bool has_top_exp(mpf const & x);
|
||||||
|
|
||||||
void unpack(mpf & o, bool normalize);
|
void unpack(mpf & o, bool normalize);
|
||||||
void add_sub(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf & o, bool sub);
|
void add_sub(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf & o, bool sub);
|
||||||
void round(mpf_rounding_mode rm, mpf & o);
|
void round(mpf_rounding_mode rm, mpf & o);
|
||||||
void round_sqrt(mpf_rounding_mode rm, mpf & o);
|
void round_sqrt(mpf_rounding_mode rm, mpf & o);
|
||||||
|
|
||||||
void mk_round_inf(mpf_rounding_mode rm, mpf & o);
|
void mk_round_inf(mpf_rounding_mode rm, mpf & o);
|
||||||
|
|
||||||
// Convert x into a mpz numeral. zm is the manager that owns o.
|
// Convert x into a mpz numeral. zm is the manager that owns o.
|
||||||
void to_mpz(mpf const & x, unsynch_mpz_manager & zm, mpz & o);
|
void to_mpz(mpf const & x, unsynch_mpz_manager & zm, mpz & o);
|
||||||
void to_mpz(mpf const & x, scoped_mpz & o) { to_mpz(x, o.m(), o); }
|
void to_mpz(mpf const & x, scoped_mpz & o) { to_mpz(x, o.m(), o); }
|
||||||
|
|
||||||
class powers2 {
|
class powers2 {
|
||||||
unsynch_mpz_manager & m;
|
unsynch_mpz_manager & m;
|
||||||
|
@ -239,7 +239,7 @@ protected:
|
||||||
dispose(m_p);
|
dispose(m_p);
|
||||||
dispose(m_pn);
|
dispose(m_pn);
|
||||||
dispose(m_pm1);
|
dispose(m_pm1);
|
||||||
dispose(m_pm1n);
|
dispose(m_pm1n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispose(u_map<mpz*> & map) {
|
void dispose(u_map<mpz*> & map) {
|
||||||
|
@ -275,7 +275,7 @@ protected:
|
||||||
m.dec(*new_obj);
|
m.dec(*new_obj);
|
||||||
if (negated) m.neg(*new_obj);
|
if (negated) m.neg(*new_obj);
|
||||||
return *new_obj;
|
return *new_obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue