sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.42k stars 476 forks source link

units.mass.pound to units.mass.drachma broken #8897

Open haraldschilly opened 14 years ago

haraldschilly commented 14 years ago
sage: a = 170*units.mass.pound
sage: a.convert(units.mass.drachma)

gives

TypeError: unable to convert x (=kilogram) to an integer

despite 1 drachma is 0.00429234 kilograms.

Component: symbolics

Issue created by migration from https://trac.sagemath.org/ticket/8897

f8667504-6eb9-4678-970d-c85e19c6bba2 commented 12 years ago
comment:1

Same is true for other units of mass or time, that contains tuples in unitdict:

sage: sage.symbolic.units.unitdict['mass']['obol']
"(0.000715380000000000,{'greek':1/6})"
sage: sage.symbolic.units.unitdict['mass']['drachma']
"(0.00429234000000000, {'greek':1})"
sage: sage.symbolic.units.unitdict['mass']['mina']   
"(0.429234000000000, {'greek':100})"
sage: sage.symbolic.units.unitdict['mass']['talent']
"(25.7540400000000, {'greek':6000})"
sage: sage.symbolic.units.unitdict['time']['sidereal_second']
"(0.997269566329086, {'sidereal':1})"
sage: sage.symbolic.units.unitdict['time']['sidereal_day']
"(86164.0905308330, {'sidereal':86400})"

all those result in same "unable to convert x to an integer", coming from:

sage: sage.symbolic.units.base_units(units.time.sidereal_second)