Skip to content

InexactError for scalar multiplication of a vector #14

Description

@matthias314

Multiplying two scalars works, but multiplying a scalar and a vector may errror:

julia> @emulate Int3

julia> x, v = Int3(2), Int3[2]
(2, Int3[2])

julia> x*x
-4

julia> x*v
ERROR: InexactError: trunc(Int3, 4)
Stacktrace:
  [1] throw_inexacterror(func::Symbol, to::Type, val::Int8)
    @ Core ./boot.jl:815
  [2] Type
    @ ~/.julia/packages/EmulatedBitIntegers/IFk3G/src/interface.jl:4 [inlined]
  [3] convert
    @ ./number.jl:7 [inlined]
  [4] setindex!
    @ ./array.jl:985 [inlined]
  [5] macro expansion
    @ ./broadcast.jl:995 [inlined]
  [6] macro expansion
    @ ./simdloop.jl:77 [inlined]
  [7] copyto!
    @ ./broadcast.jl:994 [inlined]
  [8] copyto!
    @ ./broadcast.jl:947 [inlined]
  [9] copy
    @ ./broadcast.jl:919 [inlined]
 [10] materialize
    @ ./broadcast.jl:894 [inlined]
 [11] broadcast_preserving_zero_d
    @ ./broadcast.jl:883 [inlined]
 [12] *(A::Int3, B::Vector{Int3})
    @ Base ./arraymath.jl:21
 [13] top-level scope
    @ REPL[5]:1

Tested with Julia 1.12.7 and EmulatedBitIntegers v0.4.2.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions