pub trait RoundTo: Sized {
    // Required method
    fn round_to(self, decimals: i32) -> Self;
}
Expand description

Trait that provides a way to round floats to a specific amount of decimals

Required Methods§

source

fn round_to(self, decimals: i32) -> Self

Returns the nearest number to self rounded to decimal number of decimals. Half-way cases round away from 0.0.

Implementations on Foreign Types§

source§

impl RoundTo for f32

source§

fn round_to(self, decimals: i32) -> Self

source§

impl RoundTo for f64

source§

fn round_to(self, decimals: i32) -> Self

Implementors§