half datatype?
David Nadlinger
see at klickverbot.at
Sun Nov 18 04:01:53 PST 2012
On Sunday, 18 November 2012 at 11:21:37 UTC, Manu wrote:
> someFloat = someHalf <- doesn't work, because a cast operator
> expects an
> explicit cast, even though this is a lossless conversion and
> should be
> exactly the same as someDouble = someFloat.
>
> Thoughts?
---
struct Half {
float toFloat() { return 3.14f; }
alias toFloat this;
}
void test() {
Half h;
float f = h;
double d = h;
}
---
Works for you?
David
More information about the Digitalmars-d
mailing list