upd convert()

This commit is contained in:
ge 2024-12-22 05:41:54 +03:00
parent 25a1b7bbf0
commit 080e37a7c2

View File

@ -193,5 +193,8 @@ pub const yibit = zibit * 1024
// assert dataunits.convert(500, dataunits.mbit, dataunits.kb) == 62500 // assert dataunits.convert(500, dataunits.mbit, dataunits.kb) == 62500
// ```` // ````
pub fn convert(value f64, from DataSize, to DataSize) f64 { pub fn convert(value f64, from DataSize, to DataSize) f64 {
if from == to {
return value
}
return f64(value * from / to) return f64(value * from / to)
} }