You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
654 B

# -*- coding:utf-8 -*-
import decimal
CELSIUS = 'C'
FAHRENHEIT = 'F'
_THIRTYTWO = decimal.Decimal(32)
_ONEPOINTEIGHT = decimal.Decimal(18) / decimal.Decimal(10)
_TENPOINTSEVENSIXFOUR = decimal.Decimal(10764) / decimal.Decimal(1000)
def f_to_c(temp):
temp = decimal.Decimal(temp)
return float((temp - _THIRTYTWO) / _ONEPOINTEIGHT)
def c_to_f(temp):
temp = decimal.Decimal(temp)
return float(temp * _ONEPOINTEIGHT + _THIRTYTWO)
def ft2_to_m2(area):
area = decimal.Decimal(area)
return float(area / _TENPOINTSEVENSIXFOUR)
def m2_to_ft2(area):
area = decimal.Decimal(area)
return float(area * _TENPOINTSEVENSIXFOUR)

Powered by TurnKey Linux.