Fractional power of units of measures in F#

后端 未结 5 888
死守一世寂寞
死守一世寂寞 2021-01-12 01:30

Is it true to say that : there are no fractional power units in F#

5条回答
  •  不思量自难忘°
    2021-01-12 02:22

    In addition to what has already been said, the best resource for information about (not just) F# units of measure is Andrew Kennedy's PhD thesis, who actually designed F# units. He mentions fractional units:

    The most important decision is whether or not to allow fractional exponents of dimensions. The argument against them is philosophical: a quantity with a dimension such as M1/2 makes no sense physically, and if such a thing arose, it would suggest revision of the set of base dimensions rather than a re-evaluation of integral exponents. The argument in favour is pragmatic: sometimes it is easier to write program code which temporarily creates a value whose dimension has fractional exponents. In this dissertation the former view prevails, and fractional exponents are not considered. However, most of the theory would apply just the same; any potential differences are highlighted as they arise.

    I think this is essentially the reason why F# does not have fractional units, because the F# design quite closely follows Andrew Kennedy's work to make sure it is sound.

    Update: With F# 4.0, support for fractional exponents has been implemented

提交回复
热议问题