Skip to content

Commit a67807a

Browse files
[SYCL] Prevent use of double in stream implementation (#7234)
The current implementation of stream uses double literals for some generalized floating point operations. To avoid this inadvertently requiring support for fp64, this commit makes appropriate conversions. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 8ca7d50 commit a67807a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sycl/include/sycl/stream.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,14 @@ EnableIfFP<T, unsigned> floatingPointToDecStr(T AbsVal, char *Digits,
265265
int Exp = 0;
266266

267267
// For the case that the value is larger than 10.0
268-
while (AbsVal >= 10.0) {
268+
while (AbsVal >= T{10.0}) {
269269
++Exp;
270-
AbsVal /= 10.0;
270+
AbsVal /= T{10.0};
271271
}
272272
// For the case that the value is less than 1.0
273-
while (AbsVal > 0.0 && AbsVal < 1.0) {
273+
while (AbsVal > T{0.0} && AbsVal < T{1.0}) {
274274
--Exp;
275-
AbsVal *= 10.0;
275+
AbsVal *= T{10.0};
276276
}
277277

278278
auto IntegralPart = static_cast<int>(AbsVal);
@@ -292,7 +292,7 @@ EnableIfFP<T, unsigned> floatingPointToDecStr(T AbsVal, char *Digits,
292292
FractionLength = MAX_FLOATING_POINT_DIGITS - 5;
293293

294294
for (unsigned I = 0; I < FractionLength; ++I) {
295-
FractionPart *= 10.0;
295+
FractionPart *= T{10.0};
296296
FractionDigits[I] = static_cast<int>(FractionPart);
297297
FractionPart -= static_cast<int>(FractionPart);
298298
}

0 commit comments

Comments
 (0)