This project is read-only.
convert units of measure and LanguagePrimitives

Category:
Units of Measure
Description: convert measure and LanguagePrimitives. The conversion ratio is defined and the conversion is based on the ratio.
Code:
[<Measure>]type litre
[<Measure>]type pint

let MeasureSample3() =
let l:float = LanguagePrimitives.FloatWithMeasure 10.
let ratio = 1.0 / 1.76056338
let pints = l / ratio
printfn "%A pints = %A liter" pints l

Execution Result:
17.6056338 pints = 10.0 liter

Last edited Sep 14, 2011 at 4:16 AM by ttliu2000, version 1

Comments

No comments yet.