@@ -2125,7 +2125,15 @@ struct Slice(SliceKind kind, size_t[] packs, Iterator)
2125
2125
else
2126
2126
{
2127
2127
static if (ls.N == 1 )
2128
- mixin (" ls.front " ~ op ~ " = value.front;" );
2128
+ {
2129
+ static if (op == " ^^" && isFloatingPoint! (typeof (ls.front)) && isFloatingPoint! (typeof (value.front)))
2130
+ {
2131
+ import mir.math.common: pow;
2132
+ ls.front = pow(ls.front, value.front);
2133
+ }
2134
+ else
2135
+ mixin (" ls.front " ~ op ~ " = value.front;" );
2136
+ }
2129
2137
else
2130
2138
static if (rpacks == [1 ])
2131
2139
ls.front.opIndexOpAssignImplValue! op(value.front);
@@ -2217,7 +2225,15 @@ struct Slice(SliceKind kind, size_t[] packs, Iterator)
2217
2225
do
2218
2226
{
2219
2227
static if (ls.N == 1 )
2220
- mixin (" ls.front " ~ op ~ " = value[0];" );
2228
+ {
2229
+ static if (op == " ^^" && isFloatingPoint! (typeof (ls.front)) && isFloatingPoint! (typeof (value[0 ])))
2230
+ {
2231
+ import mir.math.common: pow;
2232
+ ls.front = pow(ls.front, value[0 ]);
2233
+ }
2234
+ else
2235
+ mixin (" ls.front " ~ op ~ " = value[0];" );
2236
+ }
2221
2237
else
2222
2238
mixin (" ls.front[] " ~ op ~ " = value[0];" );
2223
2239
value = value[1 .. $];
@@ -2449,7 +2465,14 @@ struct Slice(SliceKind kind, size_t[] packs, Iterator)
2449
2465
{
2450
2466
return mixin (` t` ~ op ~ ` = v` );
2451
2467
}
2452
- return mixin (` _iterator[indexStride(_indexes)] ` ~ op ~ ` = value` );
2468
+ auto str = indexStride(_indexes);
2469
+ static if (op == " ^^" && isFloatingPoint! DeepElemType && isFloatingPoint! (typeof (value)))
2470
+ {
2471
+ import mir.math.common: pow;
2472
+ _iterator[str] = pow(_iterator[str], value);
2473
+ }
2474
+ else
2475
+ return mixin (` _iterator[str] ` ~ op ~ ` = value` );
2453
2476
}
2454
2477
2455
2478
static if (doUnittest)
0 commit comments