This is an attempt to translate an example from K&R C. I am unable to parse the InexactError() the code throws up.
struct Point
x::Int
y::Int
function Point()
new(0, 0)
end
function Point(i::Union{Int, Float64}, j::Union{Int, Float64})
new(i, j)
end
end
struct Rect
p1::Point
p2::Point
end
screen = Rect(Point(), Point(16.0, 9.0))
middle = Point((screen.p1.x + screen.p2.x)/2, (screen.p1.y + screen.p2.y)/2)
middle throws up an InexactError():
InexactError()
convert(::Type{Int64}, ::Float64) at float.jl:679
Point(::Float64, ::Float64) at KRC.jl:52
How do I correct this?