File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
plotters/src/coord/ranged1d/types Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -152,9 +152,9 @@ macro_rules! gen_key_points_comp {
152
152
}
153
153
let new_right = range. 1 - rem_euclid( range. 1 , old_scale / nxt) ;
154
154
155
- let npoints = 1 + ( ( new_right - new_left) / old_scale * nxt) as usize ;
155
+ let npoints = 1.0 + ( ( new_right - new_left) / old_scale * nxt) ;
156
156
157
- if npoints > max_points {
157
+ if npoints. round ( ) as usize > max_points {
158
158
break ' outer;
159
159
}
160
160
@@ -431,5 +431,8 @@ mod test {
431
431
let coord: RangedCoordf64 = ( 0.9995 ..1.0005 ) . into ( ) ;
432
432
let points = coord. key_points ( 11 ) ;
433
433
assert_eq ! ( points. len( ) , 11 ) ;
434
+ let coord: RangedCoordf64 = ( 0.9995 ..1.0005 ) . into ( ) ;
435
+ let points = coord. key_points ( 2 ) ;
436
+ assert ! ( points. len( ) <= 2 ) ;
434
437
}
435
438
}
You can’t perform that action at this time.
0 commit comments