Show HN: I created Units Converter that contains 5000 units across 78 categories
kodytools.com
kodytools.com
https://frinklang.org/ https://frinklang.org/frinkdata/units.txt https://frinklang.org/fsp/frink.fsp
crocodile := megavolt // used informally in UK physics labs
...
footcandle := lumen/ft^2 // Illuminance from a 1 candela source
// at a distance of one foot
...
// In Britain, the deal is apparently any piece of wood over 6 feet long, over
// 7 wide and 2.5 inches thick. The OED doesn't give a standard size. A piece
// of wood less than 7 inches wide is called a "batten". This unit is now used
// exclusively for fir and pine.
deal := 12 ft 11 in 2.5 in // The standard North American deal [OED]
wholedeal := 1/2 deal // If it's half as thick as the standard
// deal it's called a "whole deal"!
splitdeal := 1/2 wholedeal // And half again as thick is a split deal.
...
parasang := 3.5 mile // Persian unit of length usually thought
// to be between 3 and 3.5 miles // Beware the SI's broken definition
// of Hz. You should treat the radian as being correct, as a fundamental
// dimensionless property of the universe that falls out of pure math like
// the Taylor series for sin[x], and you should treat the Hz as being a
// fundamental property of incompetence by committee.
...
// You are perfectly right. You are perfectly wrong. You look dumb and
// unreasonable. The person arguing the opposite looks dumb and unreasonable.
//
// Hz == YOU CANNOT WIN
//
// (Insert "IT'S A TRAP" image here.)The SI unit of frequency is hertz, the SI unit of angular velocity and angular frequency is radian per second, and the SI unit of activity is becquerel, implying counts per second. Although it is formally correct to write all three of these units as the reciprocal second, the use of the different names emphasizes the different nature of the quantities concerned. It is especially important to carefully distinguish frequencies from angular frequencies, because by definition their numerical values differ by a factor1 of 2π. Ignoring this fact may cause an error of 2π. Note that in some countries, frequency values are conventionally expressed using “cycle/s” or “cps” instead of the SI unit Hz, although “cycle” and “cps” are not units in the SI. Note also that it is common, although not recommended, to use the term frequency for quantities expressed in rad/s. Because of this, it is recommended that quantities called “frequency”, “angular frequency”, and “angular velocity” always be given explicit units of Hz or rad/s and not 1/s.
I find this very concise and clear.
One very desirable property of a units system is that incompatible quantities have incompatible units. So if I try to add 1 Joule (== 1 kg⋅m^2⋅s^−2) to 1 meter, I’m obviously doing something wrong and I just can’t continue.
But in SI I can take 1 Hertz (==1 s^-1) and add it to 1 radian/second (== 1 s^-1) and SI says sure, that’s 2 s^-1. But it’s not, that’s a totally unphysical thing to do and the answer is nonsense.
To resolve the issue, you could define 1Hz as 2pi/s on the grounds that the Taylor series for sin(t) is in "units" of rad/s. You could also define one rad/s as 1/(2pi s), arguing that since the becquerel is 1/s and means "the number of times something happens per second," it would be inconsistent for frequencies to be denominated other ways, and that Hz is applicable to functions other than sin(t), including square and triangle waves, which have no relationship to angles.
Also, defining a Hz as 2pi/s seems to be mixing units and quantities, like a Hz is 2 [pi/s] (where [] stores units), where pi is a unit equal to 6.28 [unitless]. Intead, defining a Hz as 2pi/s is to me changing the definition of Hz, unless it's like 2pi / 2pi [1 / s]. >You could also define one rad/s as 1/(2pi s) I was, specifically 1/2pi [1/s].
But as to your point that things like Hz are semi-meaningless unless attached to physical concepts, I'll agree with that (using a potentially different definition of semi-meaninglessness.)
My original statement that 1 Hz + 1 radian/second (i.e. 1 [1/s] + 1/2pi [1/s]) is both physical (semi-meaningless, meaning somewhat meaningful and fully meaningful when we flexibly attach it to a large range of physical concepts) and non nonsense (again, semi-meaningless until we attach to a physical concept) I think still hold.
The key to me is that we can attach physical concepts to units and measures flexibly (but not arbitarily). Hz is indeed applicable to non-sin functions, like square waves, but then we're all of the sudden talking about "the Hz of the nth harmonic of the square wave" (which has loads of relationship to angles).
That should be 3.54cm.
The issue here is that angles are inherently unitless geometrical quantities. "Radian" is merely a reminder that a number represents an angle. There is no way to make it a consistent physical unit.
More clear example: both Gy and Sv are J/kg (m^2 s^-2), but to add two values, one in each of those units, you need to multiply one of them by a coefficient (that coefficient depends on the kind of radiation and specific organ that absorbed this radiation). So somewhere in the math world lives a constant that is unitless 1, but x Sv/Gy, where x != 1 (again that x depends on circumstances).
Those situations just happen. It's how physics work.
Okay; how do you add the unit of energy, one joule, to the unit of torque, one newton-metre?
Both have the same SI units: kilogram square metre per second per second. But one is a scalar quantity, whereas the other is a vector quantity.
And its reciprocal looks like the age of the universe (apparently this is just a coincidence).
[0] https://github.com/tiffany352/rink-rs/ [1] https://github.com/tiffany352/rink-rs/blob/master/core/defin... [2] https://rinkcalc.app/
"By using our Fahrenheit to Kelvin conversion tool, you know that one Fahrenheit is equivalent to 255.93 Kelvin. Hence, to convert Fahrenheit to Kelvin, we just need to multiply the number by 255.93. We are going to use very simple Fahrenheit to Kelvin conversion formula for that. Pleas see the calculation example given below."
Then it converts 231 in^3 to 0.99999994293884 U.S. gal, while 1 U.S. gal converts to 231 in^3.
By using our Celsius to Fahrenheit conversion tool, you know that one Celsius is equivalent to 33.8
1000 C = 1000 x 33.8 = 1832 F
Probably the explanation engine doesn't support the offset in the underlying linear formula.1 UK teaspoon is about 17.8 ml.
It goes on: 1 US gallon is about 0.83 imperial gallons
For people who cook in the US, a set of "measuring spoons" is a very common kitchen tool.
"Teaspoon" and "Tablespoon" are units of measurement of volume, not bits of silverware. "Tea spoon" and "Table spoon" or "Soup spoon" are pieces of silverware, not units of measure!
The library incorporates dimensional units into the C++ type system with an emphasis on correctness (including considerations for overflow, rounding, loss of precision, etc) and minimal runtime overhead.
As a very simple example of what using this library could look like, here is a tiny code snippet taken from one of the tutorials:
constexpr double speed_mph = 65.0;
constexpr double speed_mps = (miles / hour)(speed_mph).in(meters / second);
In a larger program, of course, the whole point is to avoid using naked "doubles" (or floats or ints, etc) at all, and instead use the library's "Quantity" types, which encode information about their units. Conversions are done automatically, and incompatible operations become compile-time errors. const auto time = hours(1.0)
const auto distance = miles(65.0)
const auto average_speed = distance/time;
The tutorials are a nice way to be introduced to the library:
https://aurora-opensource.github.io/au/tutorial/From a user's point of view (I am a physicist by training), I find the library wonderfully unobtrusive and "natural" to use.
I developed a similar library for Nim, `unchained` [0]. Thanks to Nim's extensive macro system it's a pleasure to use (from a short look at the `au`'s docs my biased opinion is it beats `au` on usability :) ).
If this is how you get to "5000 units" then that feels a bit cheaty
Can you share what types of use cases you've seen people use KodyTools for?
For me, a different UI could fix the problem. Give me a field where I can ask directly "how many cups are in 4.37 cubic meters?"
As it stands now, I can get the answer from any search engine or voice assistant more quickly than from this site.
It has zillions of base units and a algebra syntax for definitions of many more
Edit: "common" units https://github.com/ucum-org/ucum/tree/main/common-units
I'd love to have an HP48 CLI to do unit calcs with.
.5 * 10_m/s^2 * (15_s)^2 = 1125_m
Admittedly, the HPs interim results are a bit of a mess: sqrt(6.673E-11_N*m^2/kg^2 * 5.98E24_kg / 6780_km) =
242603.08_N^.5*m/(kg^.5*km^.5)
But, this converts cleanly to m/s: 7671.8m/sEverything else I've found have been just super fiddly.
You have: .5 * (10 m/s^2) * (15 s)^2
You want:
Definition: 1125 m
You have: sqrt((6.673E-11 N*m^2/kg^2) * (5.98E24 kg) / (6780 km))
You want:
Definition: 7671.783 m / sSo, mi/g => l/km requires a different kind of conversion than most of the others shown. You have to first convert mi/g to g/mi, then you can convert to l/km and then multiply by 100.
Frankly, I think the European method makes a lot more sense to me, especially as you get to higher and higher levels of efficiency. With mpg, the numbers get stupidly big when you're saving relatively small amounts of fuel. With l/km, the numbers get smaller and smaller as you increase your efficiency, and it shows you how relatively little you're actually increasing the amount of fuel saved.
The main limitation I see is that it seems you are limited to picking the units to convert between from predefined lists. If someone gave you say a volume specified in nmi ft^2 for instance and you wanted to convert it m^3 you'd have to do nmi to m and ft^2 to m^2 and then multiply the results to get nmi ft^2 to m^3 because nmi ft^2 is not on the volume unit list.
Those cases are probably pretty rare. It is not often that you run in to people who give you say a gasoline consumption rate of 23 picoacres or give you a cookie recipe that calls for 1.6 barn megaparsecs of vanilla. (BTW, those are 0.04 gal/mile and 1 tsp, respectively).
Metric intervention https://userscripts-mirror.org/scripts/show/130277 > Converting that old French system the Brits are still using to the metric standard of science. ~ foot, inch (00',00",00'00,00'00"), yard, mile, stone, Pound-mass/Lbs., Gallon ~ It will totally convert something heretical like: 1'23 1/4" x 2'12 5/8" into something elegant and civilized like 89.535 cm x 93.0275 cm
This (uhm) didn't take a year to make but it was rather useful when I needed it.
PS just tried the tool and couldn't find any of the above "units", not even "football fields".
$ units GeV/c^2
Definition: 1.7826619e-27 kg
$ units
Currency exchange rates from FloatRates (AUD base) on 2023-06-21
3761 units, 113 prefixes, 120 nonlinear units
You have: GeV/c^2
You want: [leave it blank]
Definition: 1.7826619e-27 kg
You have:
Because of these various definitions (a selection of lines pulled from /usr/share/units/definitions.units, I think I have included all the relevant ones recursively): G- giga
giga- 1e9 # Greek gigas, "giant"
e 1.602176634e-19 C # electron charge (exact)
C coulomb
coulomb A s # charge
A ! # The ampere, symbol A, is the SI unit of electric current. […]
s ! # The second, symbol s, is the SI unit of time. It is defined […]
V volt
volt W/A # potential difference
W watt
watt J/s # power
J joule
joule N m # energy
N newton
newton kg m / s^2 # force
kg ! # The kilogram, symbol kg, is the SI unit of mass. It is […]
m ! # The metre, symbol m, is the SI unit of length. It is […]
c 299792458 m/s # speed of light in vacuum (exact)
(Fun thing, kg being the SI unit. Because of this, gram is defined as millikg!)I really like the approach of specifying what you have, in absolutely whatever unit you like, and what you want (though I omitted that argument in this case, to just have it show the definition), and having it resolve it.
An excerpt from my ~/.units (which does have some serious stuff in it too, honest):
# Why not? (Question: is the slightly-Welsh-sounding ygazillion, yocto-gazillion, 10⁻²⁴ gazillion, greater or less than one?)
gazillion !
elephant 6.35 tonne
elephant_african 6.35 tonne
elephant_asian 5 tonne
# I want to have ranged values: elephant_baby 90–135 kg. This get complicated because of non-linear transformations, e.g. 2^(1–10) = 2–1024, but log₂-biased.
# baby_grand is also a babyhttps://www.unix.com/man-page/v7/1/units/
$ units You have: 1 foot candle You want: lumens meter * 0.310896 / 3.2165097
I'm sure messing around with that will never get old.
A.) ...one gram of DNA can store up to 215 Petabytes or [215,000 Terabytes], knowing that the human being has about 600 grams of DNA [129,000,000 TB]. (1)
B.) Now assume a human is traveling at the speed of sound in air on earth (~343m/s):
343 m/s * 129,000,000 TB * 1/1,000,000,000 s/ns,
The result is that for every kilometer the human travels at the speed of sound, the information stored in that human’s DNA yields a data transfer rate of approximately 44.3 TB/ns. Seems reasonable.
1.) https://www.bibalex.org/SCIplanet/en/Article/Details.aspx?id....
IMO, any converter needs one, so add it or make it easier to find.
I see 5 circular buttons: Facebook, LinkedIn, Twitter, WhatsApp, and a “Copy url to clipboard” one.
Many cooking utensils I have at home are either in ml or oz but not both.
Also, I thought "Library of Congress" was a standard unit of measurement? Not to mention the "standard reference pear".
https://www.bbcgoodfood.com/recipes/collection/bread-recipes for example.
> www.kodytools.com Server: dns9.quad9.net Address: 9.9.9.9
** dns9.quad9.net can't find www.kodytools.com: Non-existent domain
I run a similar site (dateful.com) and I promise the EU regulators don't come after sites like ours. :)
1. <https://imgur.com/gallery/VI0B0nl>
2. <https://twitter.com/SheriffAlert/status/1221881862244749315>
I have already added football field in length category. Will add more soon.
Molar Concenration -> Molar Concen(t)ration