Begin statistics creation

This commit is contained in:
Christoph Hagen
2025-08-31 16:27:32 +02:00
parent f972a2c020
commit 96bd07bdb7
33 changed files with 1406 additions and 187 deletions

View File

@@ -1,7 +1,14 @@
import Foundation
import _math
extension Double {
func rounded(to interval: Double) -> Double {
(self / interval).rounded() * interval
}
func rounded(decimals: Int) -> Double {
let factor = _math.pow(10.0, Double(decimals))
return (self * factor).rounded() / factor
}
}