Thread overview | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 22, 2006 Runtime unit lib | ||||
---|---|---|---|---|
| ||||
I have put together a runtime unit type library. While I was writing the unittest I recognized that the most likely error is an error in the convention table (something that can't be checked by the person who wrote that part). Therefor, Would someone please (without looking at my table of conversion factors) finish writing the unittest for the lib? It shouldn't be hard, just get the file and a units conversion table and add some more lines like those around line 644. here it is: http://www.webpages.uidaho.edu/~shro8822/unit_.d ps: I am submitting this for inclusion in Phobos. |
February 22, 2006 Re: Runtime unit lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS Attachments: | BCS schrieb am 2006-02-22:
> I have put together a runtime unit type library. While I was writing the unittest I recognized that the most likely error is an error in the convention table (something that can't be checked by the person who wrote that part). Therefor, Would someone please (without looking at my table of conversion factors) finish writing the unittest for the lib?
>
> It shouldn't be hard, just get the file and a units conversion table and add some more lines like those around line 644.
>
> here it is:
>
> http://www.webpages.uidaho.edu/~shro8822/unit_.d
Acre
US or international ?
Cal
international table calorie, thermochemical calorie or ... ?
Hp
metric, us or ... horsepower?
Leter -> Liter?
mile, inch
british, natic, imperial or ... ?
R
Rankine, Reaumur or ... ?
Fahrenheit and lot's of metric units seem to be missing.
Thomas
|
February 22, 2006 Re: Runtime unit lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | This looks sweet. Sorry for my ignorance but what does feqrel() do ? Charlie "BCS" <BCS_member@pathlink.com> wrote in message news:dtgd32$407$1@digitaldaemon.com... > I have put together a runtime unit type library. While I was writing the unittest I recognized that the most likely error is an error in the convention > table (something that can't be checked by the person who wrote that part). > Therefor, Would someone please (without looking at my table of conversion > factors) finish writing the unittest for the lib? > > It shouldn't be hard, just get the file and a units conversion table and add > some more lines like those around line 644. > > here it is: > > http://www.webpages.uidaho.edu/~shro8822/unit_.d > > ps: > > I am submitting this for inclusion in Phobos. |
February 22, 2006 Re: Runtime unit lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Thomas Kuehne | In article <0q1uc3-rb3.ln1@birke.kuehne.cn>, Thomas Kuehne says... > >-----BEGIN PGP SIGNED MESSAGE----- >Hash: SHA1 > >BCS schrieb am 2006-02-22: >> I have put together a runtime unit type library. While I was writing the unittest I recognized that the most likely error is an error in the convention table (something that can't be checked by the person who wrote that part). Therefor, Would someone please (without looking at my table of conversion factors) finish writing the unittest for the lib? >> >> It shouldn't be hard, just get the file and a units conversion table and add some more lines like those around line 644. >> >> here it is: >> >> http://www.webpages.uidaho.edu/~shro8822/unit_.d > >Acre >US or international ? > >Cal >international table calorie, thermochemical calorie or ... ? > >Hp >metric, us or ... horsepower? > >Leter -> Liter? oops > >mile, inch >british, natic, imperial or ... ? 5280' > >R >Rankine, Reaumur or ... ? Rankine > >Fahrenheit and lot's of metric units seem to be missing. Fahrenheit has an offset so... I didn't put in units like PSI that are named by there definition. I put in all of the units that my table had that looked useful (who besides the GB DMV needs stones?) More units can be added later. non metric units are US (I think). ver 2 fothcoming, several things will change a bit. |
February 22, 2006 Re: Runtime unit lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charles | "to how many bit are the args the same?" its in std.math In article <dti61k$2gpd$1@digitaldaemon.com>, Charles says... > >This looks sweet. > >Sorry for my ignorance but what does feqrel() do ? > >Charlie > > >"BCS" <BCS_member@pathlink.com> wrote in message news:dtgd32$407$1@digitaldaemon.com... >> I have put together a runtime unit type library. While I was writing the unittest I recognized that the most likely error is an error in the >convention >> table (something that can't be checked by the person who wrote that part). >> Therefor, Would someone please (without looking at my table of conversion >> factors) finish writing the unittest for the lib? >> >> It shouldn't be hard, just get the file and a units conversion table and >add >> some more lines like those around line 644. >> >> here it is: >> >> http://www.webpages.uidaho.edu/~shro8822/unit_.d >> >> ps: >> >> I am submitting this for inclusion in Phobos. > > |
February 22, 2006 Re: Runtime unit lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS Attachments: | BCS schrieb am 2006-02-22: > In article <0q1uc3-rb3.ln1@birke.kuehne.cn>, Thomas Kuehne says... [snip] >>mile, inch >>british, natic, imperial or ... ? > > 5280' [snip] > non metric units are US (I think). Except for inch, all conversions seem to be correct. Could you please send me your email - the basic conversion unittest is rather large for posting (ca. 647K). Thomas |
February 22, 2006 Re: Runtime unit lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | http://www.gnu.org/software/units/units.html Above tool seem to have a pretty good collection of units. It would be nice if the 'runtime unit lib' in discussion can generate arbitrary fundamental units and user defined conversions at runtime (like currency, steradian, bit, music_note etc). Sai |
February 22, 2006 Re: Runtime unit lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sai | Sai wrote:
> http://www.gnu.org/software/units/units.html
>
> Above tool seem to have a pretty good collection of units.
>
> It would be nice if the 'runtime unit lib' in discussion can generate
> arbitrary fundamental units and user defined conversions at runtime (like
> currency, steradian, bit, music_note etc).
>
> Sai
>
>
>
I'll check that out
|
February 23, 2006 Re: Runtime unit lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Thomas Kuehne | WOW!! Thanks! That is impressive. If I may ask, how did you make that? Some sort of script I assume? I ask because the Phobos source en-total is 1MB and 647k is kinda large. Can you think of any way to cut down the code size using a data table of some kind? e.g. enum Types {Foot, Inch, Pound, ...) real[Types.max][Types.max] test_values; test_values[Types.Foot][Types.Foot] = 1; // real value is convrtion test_values[Types.Foot][Types.Inch] = 12; test_values[Types.Foot][Types.Pound] = real.nan; //nan on no convertion ... Unit u; real v; foreach(int from, real[] ra; test_values) foreach(int to, real r; test_values) { switch(from) { case Type.Foot: u = Foot(1); break; case Type.Inch: u = Inch(1); break; case Type.Pound: u = Pound(1); break; ... } try switch(from) { case Type.Foot: v = u.Foot(); break; case Type.Inch: v = u.Inch(); break; case Type.Pound: v =u.Pound(); break; ... } catch (ExceptionUnitMisMatch) { assert(isnan(r)); continue; } assert(!isnan(r)); } Thomas Kuehne wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > BCS schrieb am 2006-02-22: > >>In article <0q1uc3-rb3.ln1@birke.kuehne.cn>, Thomas Kuehne says... > > > [snip] > > >>>mile, inch >>>british, natic, imperial or ... ? >> >>5280' > > > [snip] > > >>non metric units are US (I think). > > > Except for inch, all conversions seem to be correct. > > Could you please send me your email - the basic conversion unittest is rather large for posting (ca. 647K). > > Thomas > > > -----BEGIN PGP SIGNATURE----- > > iD8DBQFD/NoA3w+/yD4P9tIRAgr+AKCEHKUcwpu+m2FvmOQlWJowjYMCgwCfZQR8 > IFJFE9kXLfgLQSWrHSvOdrI= > =kJBv > -----END PGP SIGNATURE----- |
February 23, 2006 Re: Runtime unit lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS Attachments: | BCS schrieb am 2006-02-23: > WOW!! Thanks! That is impressive. If I may ask, how did you make that? Some sort of script I assume? No script, just one hundred and one monkeys typing all day ;) > I ask because the Phobos source en-total is 1MB and 647k is kinda large. Can you think of any way to cut down the code size using a data table of some kind? How about 40K? Thomas |
Copyright © 1999-2021 by the D Language Foundation