On Tue, 23 Sep 2014 18:02:56 +0000
Meta via Digitalmars-d <[email protected]> wrote:

>      //Allowed?
>      money o = m * n;
>      assert(o == 20.0);
yes.

>      //Allowed?
>      money p = m * 2.0;
>      assert(p == 8.0);
no.

>      //Passes or fails?
>      assert(!isNaN(p.init));
passes, as it's 'dobule' descendant.

>      //Do typedef'd types inherit the properties
>      //of their base classes?
>      assert(p.min_normal == double.min_normal);
yes.

>      typedef float dollars = 0.0f;
>      typedef float cents = 0.0f;
> 
>      dollars d = 1.0f;
>      //Allowed?
>      cents c = d;
no.

>      cents c = cast(cents)d;
yes.

>      cents c = cast(float)d;
no.

>      //Allowed?
>      float f = d
>      float f = d - c;
>      float f = d - 1.0f;
no.

>      //Are these allowed? If so, what
>      //are the resultant types?
>      auto g = c * d;
>      auto h = d * 1.0f;
no.

>      typedef int index;
> 
>      int[] arr = [0, 1, 2];
>      index a = 1;
>      //Allowed?
>      assert(arr[a] == 1);
no.

>      index b = 4;
>      arr ~= b;
no.

my 0.05 dollars.

Attachment: signature.asc
Description: PGP signature

Reply via email to