Skip to content

Define ::Integer * ::FixedPoint? #78

Closed
@TotalVerb

Description

@TotalVerb
julia> 2 * 0.5Q1f14
ERROR: InexactError()
Stacktrace:
 [1] convert at /home/fengyang/.julia/v0.6/FixedPointNumbers/src/fixed.jl:42 [inlined]
 [2] promote at ./promotion.jl:174 [inlined]
 [3] *(::Int64, ::FixedPointNumbers.Fixed{Int16,14}) at ./promotion.jl:247

This is happening because 2 is not representable in Q1f14, even though the result 1 would be. I think it is avoidable by specializing ::Integer * ::FixedPoint (and ::FixedPoint * ::Integer?) directly, but I don't have much experience with this. If this is the right thing to do, I'll make a PR.

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