Calculate Temperature - Most Advanced UOC

  • Comments posted to this topic are about the item Calculate Temperature - Most Advanced UOC

  • Interesting! I think I'd prefer a conversion table with lots of columns such as conversion type (area, mass, etc), long names, abbreviations, descriptions, SI standard names, accepted approximate conversion factors, and your high precision ones. It would be nice to see formatting like mm2. Hmm, preview mode is not showing the superscript for millimeters squared.

  • I believe there is an error in this function with regard to F to C & C to F conversions. Try some well known values like:

    32F to C - should be 0

    0C to F - should be 32

    -40 F to C or C to F - should be -40

    I agree that a table-based conversion system (for those units with direct convertibility) is a more flexible mechanism...

  • Hi,

    The correct formula to convert those units are:

    select @returnvalue =

    case

    when @FromConversionUnit = 'DC' and @ToConversionUnit = 'DF' then @UnitValue * 1.8 + 32

    when @FromConversionUnit = 'DC' and @ToConversionUnit = 'K' then @UnitValue + 273.15

    when @FromConversionUnit = 'DF' and @ToConversionUnit = 'DC' then (@UnitValue -32) / 1.8

    when @FromConversionUnit = 'DF' and @ToConversionUnit = 'K' then (@UnitValue -32) / 1.8 + 273.15

    when @FromConversionUnit = 'K' and @ToConversionUnit = 'DC' then @UnitValue - 273.15

    when @FromConversionUnit = 'K' and @ToConversionUnit = 'DF' then (@UnitValue - 273.15) * 1.8 + 32

    when @FromConversionUnit = @ToConversionUnit then @UnitValue * 1.0

    end

  • sergeg (1/9/2015)


    Hi,

    The correct formula to convert those units are:

    select @returnvalue =

    case

    when @FromConversionUnit = 'DC' and @ToConversionUnit = 'DF' then @UnitValue * 1.8 + 32

    when @FromConversionUnit = 'DC' and @ToConversionUnit = 'K' then @UnitValue + 273.15

    when @FromConversionUnit = 'DF' and @ToConversionUnit = 'DC' then (@UnitValue -32) / 1.8

    when @FromConversionUnit = 'DF' and @ToConversionUnit = 'K' then (@UnitValue -32) / 1.8 + 273.15

    when @FromConversionUnit = 'K' and @ToConversionUnit = 'DC' then @UnitValue - 273.15

    when @FromConversionUnit = 'K' and @ToConversionUnit = 'DF' then (@UnitValue - 273.15) * 1.8 + 32

    when @FromConversionUnit = @ToConversionUnit then @UnitValue * 1.0

    end

    +1

    OP function complete nonsense

  • Hi,

    What do you mean OP function???

  • I'm sorry, OP is an abreviation for Original Poster

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply