From 080e37a7c2e1d37fb4d8dd77113ff699f3ca84b1 Mon Sep 17 00:00:00 2001 From: ge Date: Sun, 22 Dec 2024 05:41:54 +0300 Subject: [PATCH] upd convert() --- src/dataunits.v | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dataunits.v b/src/dataunits.v index eab2a1b..ddee423 100644 --- a/src/dataunits.v +++ b/src/dataunits.v @@ -193,5 +193,8 @@ pub const yibit = zibit * 1024 // assert dataunits.convert(500, dataunits.mbit, dataunits.kb) == 62500 // ```` pub fn convert(value f64, from DataSize, to DataSize) f64 { + if from == to { + return value + } return f64(value * from / to) }