// // Double+truncate.swift // PrySDR // // Created by Jacky Jack on 23/01/2025. // import Foundation extension Double { func truncate(places : Int)-> Double { return Double(floor(Foundation.pow(10.0, Double(places)) * self)/Foundation.pow(10.0, Double(places))) } } extension Float32 { func truncate(places : Int)-> Float32 { return Float32(floor(Foundation.pow(10.0, Float32(places)) * self)/Foundation.pow(10.0, Float32(places))) } } extension Float32 { var bytes: [UInt8] { withUnsafeBytes(of: self, Array.init) } }