Temperature Snippets

    0

    0

    Arcktosh

    temperature

    The following code defines several functions to convert between different temperature units.

    Library: react

    const CelciusToFahrenheit = (celcius: number) => {
      return (celcius * 9) / 5 + 32
    }
    const CelciusToKelvin = (celcius: number) => {
      return celcius + 273.15
    }
    const CelciusToRankine = (celcius: number) => {
      return (celcius * 9) / 5 + 491.67
    }
    const FahrenheitToCelcius = (fahrenheit: number) => {
      return ((fahrenheit - 32) * 5) / 9
    }
    const FahrenheitToKelvin = (fahrenheit: number) => {
      return ((fahrenheit + 459.67) * 5) / 9
    }
    const FahrenheitToRankine = (fahrenheit: number) => {
      return fahrenheit + 459.67
    }
    const KelvinToCelcius = (kelvin: number) => {
      return kelvin - 273.15
    }
    const KelvinToFahrenheit = (kelvin: number) => {
      return ((kelvin - 273.15) * 9) / 5 + 32
    }
    const KelvinToRankine = (kelvin: number) => {
      return (kelvin * 9) / 5
    }
    const RankineToCelcius = (rankine: number) => {
      return ((rankine - 491.67) * 5) / 9
    }
    const RankineToFahrenheit = (rankine: number) => {
      return rankine - 459.67
    }
    const RankineToKelvin = (rankine: number) => {
      return (rankine * 5) / 9
    }
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.