3/30/2023 0 Comments Frink programming language![]() ![]() If you want to learn more about how evil units are, check out Bill Kent’s Measurement Data Report. What happens when you add two meters, plus or minus a centimeter? If you’re working with physical measurements, all of your measurements will have some amount of uncertainty. And there was a period of time where we used both definitions in different places! This is means that all historical documents have a different measurement of foot. A foot is defined as exactly 0.3048 meters. Units can have different historical values.You can subtract timestamps from each other but not add them. Units can have additional limitations.What about adding two ratios? What about adding a radian to a ratio? ![]() ![]() What’s 20° + 1 radian? They’re both unitless quantities that have compatible dimensions. What’s 200° + 360°? It could be 200° or 560°, depending on we have a “circular angle” or a “rotational angle” (like driving a screw in).As you enter a gravity well, the rate at which gravitational force changes has dimensions N/m. 2 There are also plenty of domain specific examples. The canonical example is that energy and angular force are both measured in Newton-meters. If you’re explicit about what you’re doing you can add these seemingly-incompatible dimensions.ĭimensions aren’t unique, and two incompatible physical quantities can have the same dimension. In Gaussian units, capacitance is measured in cm. In SI, capacitance is measured in Farads, which has dimensions A² s⁴ kg -1 m −2. There’s a nonstandard set of units called “Gaussian units” used in some niches of physics. In the UK, beer is measured using pints but its alcohol by volume is measured in SI.ĭifferent dimensions doesn’t always mean the units are incompatible. But there are also valid uses cases where you’d want to mix them! When I cook, I use a mix of metric weights and American volumes, like 1 cup of water and 128 grams of flour. Is it okay to mix feet and meters? This is the bug that destroyed the Mars Climate Orbiter. There’s the SI system, which all sane, right-thinking nations use, and then there’s the American system. A pressure calculation would take an area and a force, not a frequency and an amperage.įirst of all, there are multiple different representations of units. It also should also make sure that I pass correct units into functions that depend on units. A unit-aware language needs to be able to track units and make sure that I don’t add incompatible dimensions. We can multiply and divide numbers with different dimensions but not add them. ![]() These form new physical properties, or dimensions. Units can have exponents: m² is square meters, m³ is cubic meters, m * s -1 is speed. One kilometer = 1000 meters, 1 centimeter = 1/100th of a meter. That’s things like meters, seconds, kilograms, along with prefixes like kilo- and mega. We almost always are talking about SI units, or Système international. “But why do we need a language just for dealing with units?” Glad you asked! Intro to UnitsĪ unit is the physical property a number represents, like distance or time. 20 years later Frink is one of the best special purpose languages for dealing with units. One day Alan Eliasen read a fart joke and got so mad he invented a programming language. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |