tempconv

package
v0.0.0-...-40c8e05 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 1 Imported by: 0

README

Exercise 2.1 (P42)

Add types, constants, and functions to tempconv for processing temperatures in the Kelvin scale, where zero Kelvin is -273.15℃ and a difference of 1K has the same magnitude as 1℃.

Documentation

Index

Constants

View Source
const (
	AbsoluteZeroC Celsius = -273.15
	FreezingC     Celsius = 0
	BoilingC      Celsius = 100
	AbsoluteZeroK Kelvin  = 0
	FreezingK     Kelvin  = 273.15
	BoilingK      Kelvin  = 373.15
	DeltaCK       Celsius = -273.15
	DeltaKC       Kelvin  = 273.15
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Celsius

type Celsius float64

func FToC

func FToC(f Fahrenheit) Celsius

FToC converts a Fahrenheit temperature to Celsius.

func KtoC

func KtoC(k Kelvin) Celsius

KToC converts a Kelvin temperature to Celsius.

func (Celsius) String

func (c Celsius) String() string

type Fahrenheit

type Fahrenheit float64

func CToF

func CToF(c Celsius) Fahrenheit

CToF converts a Celsius temperature to Fahrenheit.

func KToF

func KToF(k Kelvin) Fahrenheit

KToF converts a Kelvin temperature to Fahrenheit.

func (Fahrenheit) String

func (f Fahrenheit) String() string

type Kelvin

type Kelvin float64

func CtoT

func CtoT(c Celsius) Kelvin

CToK converts a Celsius temperature to Kelvin.

func FToK

func FToK(f Fahrenheit) Kelvin

FToK converts a Fahrenheit temperature to Kelvin.

func (Kelvin) String

func (f Kelvin) String() string

Jump to

Keyboard shortcuts

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