Commit 6677090 1 parent bfd6660 commit 6677090 Copy full SHA for 6677090
File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -309,13 +309,13 @@ impl Printf for f64 {
309
309
}
310
310
311
311
if use_scientific {
312
- let normal = abs / 10.0_f64 . powi ( exponent) ;
312
+ let normal = abs / 10.0_f64 . powf ( exponent as f64 ) ;
313
313
314
314
number. push_str ( & format ! ( "{}" , normal. trunc( ) ) ) ;
315
315
if precision > 0 {
316
316
number. push ( '.' ) ;
317
317
let mut tail =
318
- ( ( normal - normal. trunc ( ) ) * 10.0_f64 . powi ( precision) ) . round ( ) as u64 ;
318
+ ( ( normal - normal. trunc ( ) ) * 10.0_f64 . powf ( precision as f64 ) ) . round ( ) as u64 ;
319
319
let mut rev_tail_str = String :: new ( ) ;
320
320
for _ in 0 ..precision {
321
321
rev_tail_str. push ( ( b'0' + ( tail % 10 ) as u8 ) as char ) ;
@@ -332,7 +332,7 @@ impl Printf for f64 {
332
332
number. push_str ( & format ! ( "{}" , abs. trunc( ) ) ) ;
333
333
if precision > 0 {
334
334
number. push ( '.' ) ;
335
- let mut tail = ( ( abs - abs. trunc ( ) ) * 10.0_f64 . powi ( precision) ) . round ( ) as u64 ;
335
+ let mut tail = ( ( abs - abs. trunc ( ) ) * 10.0_f64 . powf ( precision as f64 ) ) . round ( ) as u64 ;
336
336
let mut rev_tail_str = String :: new ( ) ;
337
337
for _ in 0 ..precision {
338
338
rev_tail_str. push ( ( b'0' + ( tail % 10 ) as u8 ) as char ) ;
You can’t perform that action at this time.
0 commit comments