Skip to content

InexactError on certain operating systems #644

@NicholasWang9

Description

@NicholasWang9

Below is an example of code that throws an InexactError. I use Windows and see this error all the time while my coworkers using Mac have never experienced this. This error is intermittent and if I run the code enough times, it will eventually work (Some files take about 10-20 attempts to run while others don't run with 50+ attempts). From what I can tell, the failure rate increases with higher mixed_volumes.

using HomotopyContinuation

@var x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12
variablelist = [x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12]

eqs = vcat(x1 * x2 * x3 * [x10, x11, x12] + x4 * x5 * x6 * [x7, x8, x9],
        x1 * x2 * x4 * [x10, x11, x12] + x3 * x5 * x6 * [x7, x8, x9],
        x1 * x2 * x5 * [x10, x11, x12] + x3 * x4 * x6 * [x7, x8, x9],
        x1 * x2 * x6 * [x10, x11, x12] + x3 * x4 * x5 * [x7, x8, x9],
        x1 * x3 * x4 * [x10, x11, x12] + x2 * x5 * x6 * [x7, x8, x9],
        x1 * x3 * x5 * [x10, x11, x12] + x2 * x4 * x6 * [x7, x8, x9],
        x1 * x3 * x6 * [x10, x11, x12] + x2 * x4 * x5 * [x7, x8, x9],
        x1 * x4 * x5 * [x10, x11, x12] + x2 * x3 * x6 * [x7, x8, x9],
        x1 * x4 * x6 * [x10, x11, x12] + x2 * x3 * x5 * [x7, x8, x9],
        x1 * x5 * x6 * [x10, x11, x12] + x2 * x3 * x4 * [x7, x8, x9])

sys = System(eqs,
             variables = variablelist)
homo_sols = HomotopyContinuation.solve(sys)
real_homo_sols = real_solutions(homo_sols)

The number in the function trunc(Int32, x) changes every run
The error itself:

Computing mixed cells... 6752    Time: 0:00:08
   mixed_volume: 43423
ERROR: LoadError: InexactError: trunc(Int32, -496443133757380)
Stacktrace:
  [1] throw_inexacterror(::Symbol, ::Vararg{Any})
    @ Core .\boot.jl:750
  [2] checked_trunc_sint
    @ .\boot.jl:764 [inlined]
  [3] toInt32
    @ .\boot.jl:801 [inlined]
  [4] Int32
    @ .\boot.jl:891 [inlined]
  [5] convert
    @ .\number.jl:7 [inlined]
  [6] cconvert
    @ .\essentials.jl:687 [inlined]
  [7] set_si!
    @ .\gmp.jl:211 [inlined]
  [8] _broadcast_getindex_evalf
    @ .\broadcast.jl:678 [inlined]
  [9] _broadcast_getindex
    @ .\broadcast.jl:651 [inlined]
 [10] getindex
    @ .\broadcast.jl:610 [inlined]
 [11] macro expansion
    @ .\broadcast.jl:973 [inlined]
 [12] macro expansion
    @ .\simdloop.jl:77 [inlined]
 [13] copyto!
    @ .\broadcast.jl:972 [inlined]
 [14] copyto!
    @ .\broadcast.jl:925 [inlined]
 [15] copy
    @ .\broadcast.jl:897 [inlined]
 [16] materialize
    @ .\broadcast.jl:872 [inlined]
 [17] solve!(BSS::HomotopyContinuation.BinomialSystemSolver)
    @ HomotopyContinuation C:\Users\user\.julia\packages\HomotopyContinuation\Cibx5\src\binomial_system.jl:178
 [18] solve
    @ C:\Users\user\.julia\packages\HomotopyContinuation\Cibx5\src\binomial_system.jl:162 [inlined]
 [19] iterate
    @ C:\Users\user\.julia\packages\HomotopyContinuation\Cibx5\src\polyhedral.jl:80 [inlined]
 [20] _collect(cont::UnitRange{Int64}, itr::PolyhedralStartSolutionsIterator, ::Base.HasEltype, isz::Base.SizeUnknown)
    @ Base .\array.jl:729
 [21] collect
    @ .\array.jl:716 [inlined]
 [22] #solve#280
    @ C:\Users\user\.julia\packages\HomotopyContinuation\Cibx5\src\solve.jl:505 [inlined]
 [23] solve(args::System; show_progress::Bool, threading::Bool, catch_interrupt::Bool, target_parameters::Nothing, stop_early_cb::Function, transform_result::Nothing, transform_parameters::typeof(identity), flatten::Nothing, target_subspaces::Nothing, kwargs::@Kwargs{})
    @ HomotopyContinuation C:\Users\user\.julia\packages\HomotopyContinuation\Cibx5\src\solve.jl:491
 [24] solve(args::System)
    @ HomotopyContinuation C:\Users\user\.julia\packages\HomotopyContinuation\Cibx5\src\solve.jl:435
 [25] top-level scope
    @ MBE.jl:19
 [26] include(fname::String)
    @ Main .\sysimg.jl:38
 [27] top-level scope
    @ REPL[1]:1
in expression starting at MBE.jl:19

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions