tempconv

package
v0.0.0-...-a716749 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package tempconv converts the temperate between different scales:

  • Celsius
  • Fahrenheit
  • Kelvin

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Celsius

type Celsius float64
const (
	// Kelvin scale defines this as absolute zero temperature
	// However it is difficult to reach zero kelvins as it requires infinite energy
	// Also, atoms and molecules would still have some irreducible motion
	AbsoluteZeroC Celsius = -273.15
	FreezingC     Celsius = 0
	BoilingC      Celsius = 100
)

func FToC

func FToC(f Fahrenheit) Celsius

FToC converts temperature from Fahrenheit to Celsius C = F - 32 * (5/9)

func KToC

func KToC(k Kelvin) Celsius

KToC converts temperature from Kelvin to Celsius C = K - 273.15

func (Celsius) String

func (c Celsius) String() string

String is the implementation of fmt.Stringer interface to use fmt.Print

type Fahrenheit

type Fahrenheit float64

func CToF

func CToF(c Celsius) Fahrenheit

CToF converts temperature from Celsius to Fahrenheit F = (9/5)C + 32

func (Fahrenheit) String

func (f Fahrenheit) String() string

type Kelvin

type Kelvin float64

func CToK

func CToK(c Celsius) Kelvin

CToK converts temperature from Celsius to Kelvin K = C + 273.15

func (Kelvin) String

func (k Kelvin) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL