so, two things are happening:
A) MyType is cast to float
B) float is cast to int
B makes sense to me, because you can explicitly cast from float to int
A does not make sense to me, because I thought I *just* defined this conversion to be explicit, not implicit
A) MyType is cast to float
B) float is cast to int
B makes sense to me, because you can explicitly cast from float to int
A does not make sense to me, because I thought I *just* defined this conversion to be explicit, not implicit
it could also be a matter of interpretation. like, is an explicit cast allowed to implicitly use explicit casts?
it seems to be the case, but, I don't like it >.>
it seems to be the case, but, I don't like it >.>
the reason this caught me off guard, is that I have a type where a float cast is fundamentally different from an int cast, where:
(int)((float)x)
should behave differently than
(int)x
but I hadn't implemented the int cast yet, but somehow it lets me do that cast
(int)((float)x)
should behave differently than
(int)x
but I hadn't implemented the int cast yet, but somehow it lets me do that cast
to be specific, I have a rational number data type, that stores a numerator and a denominator
while the float cast will always evaluate the floating point value, I want the int cast to throw in case the rational type isn't an integer
while the float cast will always evaluate the floating point value, I want the int cast to throw in case the rational type isn't an integer
Loading suggestions...