[Issue 3661] New: opPow not supported in array operations.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Dec 31 20:48:58 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3661
Summary: opPow not supported in array operations.
Product: D
Version: 2.036
Platform: Other
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: baryluk at smp.if.uj.edu.pl
--- Comment #0 from Witold Baryluk <baryluk at smp.if.uj.edu.pl> 2009-12-31 20:48:57 PST ---
This is agains 2.037.
void main() {
float[2] a,b,c;
a = [8.33, 7.11];
b = [2.1, 3.1];
double[2] d = [2.11, 3.11];
int[2] e = [4,5];
double[2] f;
// this should work
//c[] = a[] ^^ b[]; // Error: float[] ^^ float[] is not supported
//f[] = d[] ^^ d[]; // Error: double[] ^^ double[] is not supported
// just like
c[] = a[] * c[]; // works
// if possible this also
//c[] = 2.0f ^^ b[]; // Error: float ^^ float[] is not supported
//c[] = a[] ^^ 2.0f; // Error: float[] ^^ float is not supported
//f[] = d[] ^^ 2.0; // Error: double[] ^^ double is not supported
//f[] = 2.0 ^^ d[]; // Error: double ^^ double[] is not supported
// and then this also (relevant opPow is working).
//c[] = a[] ^^ e[]; // Error: float[] ^^ int[] is not supported
//f[] = d[] ^^ e[]; // Error: double[] ^^ int[] is not supported
//c[] = a[] ^^ 2; // Error: float[] ^^ int is not supported
//f[] = d[] ^^ 2; // Error: double[] ^^ int is not supported
// and eventually this also, but this part involves mixed types,
// and there is no opPow(double,float)
//c[] = 2.0 ^^ b[]; // Error: double ^^ float[] is not supported
//f[] = d[] ^^ a[]; // Error: double[] ^^ float[] is not supported
// or opPow(float,double),
//f[] = a[] ^^ 2.0; // Error: float[] ^^ double is not supported
//f[] = a[] ^^ d[]; // Error: float[] ^^ double[] is not supported
// similary this doesnt work currently
//c[] = a[] * d[]; // Error: incompatible types for ((a[]) * (e[])):
'float[]' and 'double[]'
//c[] = a[] * e[]; // Error: incompatible types for ((a[]) * (e[])):
'float[]' and 'int[]'
}
btw. also this in opPow doesnt work
float pi = 3.14;
float x = pi ^^ 2.0;
one needs explicitly write 2.0f (this is because std.math.pow have only one F
template parameter, and compiler doesn't know which to infer).
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list