Add circular mil and clove converters
This commit is contained in:
@@ -4878,46 +4878,46 @@ The registry currently contains 1333 unique calculator slugs.
|
|||||||
- [x] Chains to Thou
|
- [x] Chains to Thou
|
||||||
- [x] Chains to Thou (mil)
|
- [x] Chains to Thou (mil)
|
||||||
- [x] Circular Mils to Acres
|
- [x] Circular Mils to Acres
|
||||||
- [ ] Circular Mils to Ares
|
- [x] Circular Mils to Ares
|
||||||
- [ ] Circular Mils to Awg
|
- [x] Circular Mils to Awg
|
||||||
- [ ] Circular Mils to Barns
|
- [x] Circular Mils to Barns
|
||||||
- [ ] Circular Mils to Dunams
|
- [x] Circular Mils to Dunams
|
||||||
- [ ] Circular Mils to Hectares
|
- [x] Circular Mils to Hectares
|
||||||
- [ ] Circular Mils to Millimeters (diameter)
|
- [x] Circular Mils to Millimeters (diameter)
|
||||||
- [ ] Circular Mils to Roods
|
- [x] Circular Mils to Roods
|
||||||
- [ ] Circular Mils to Sections
|
- [x] Circular Mils to Sections
|
||||||
- [ ] Circular Mils to Square Centimeters
|
- [x] Circular Mils to Square Centimeters
|
||||||
- [ ] Circular Mils to Square Feet
|
- [x] Circular Mils to Square Feet
|
||||||
- [ ] Circular Mils to Square Inches
|
- [x] Circular Mils to Square Inches
|
||||||
- [ ] Circular Mils to Square Kilometers
|
- [x] Circular Mils to Square Kilometers
|
||||||
- [ ] Circular Mils to Square Meters
|
- [x] Circular Mils to Square Meters
|
||||||
- [ ] Circular Mils to Square Miles
|
- [x] Circular Mils to Square Miles
|
||||||
- [ ] Circular Mils to Square Millimeters (cross-section)
|
- [x] Circular Mils to Square Millimeters (cross-section)
|
||||||
- [ ] Circular Mils to Square Yards
|
- [x] Circular Mils to Square Yards
|
||||||
- [ ] Circular Mils to Swg
|
- [x] Circular Mils to Swg
|
||||||
- [ ] Circular Mils to Townships
|
- [x] Circular Mils to Townships
|
||||||
- [ ] Cloves to Amu
|
- [x] Cloves to Amu
|
||||||
- [ ] Cloves to Apothecary Ounces
|
- [x] Cloves to Apothecary Ounces
|
||||||
- [ ] Cloves to Atomic Mass Units
|
- [x] Cloves to Atomic Mass Units
|
||||||
- [ ] Cloves to Attograms
|
- [x] Cloves to Attograms
|
||||||
- [ ] Cloves to Carats
|
- [x] Cloves to Carats
|
||||||
- [ ] Cloves to Centigrams
|
- [x] Cloves to Centigrams
|
||||||
- [ ] Cloves to Daltons
|
- [x] Cloves to Daltons
|
||||||
- [ ] Cloves to Drams
|
- [x] Cloves to Drams
|
||||||
- [ ] Cloves to Earth Masses
|
- [x] Cloves to Earth Masses
|
||||||
- [ ] Cloves to Femtograms
|
- [x] Cloves to Femtograms
|
||||||
- [ ] Cloves to Gamma (mass)
|
- [x] Cloves to Gamma (mass)
|
||||||
- [ ] Cloves to Grains
|
- [x] Cloves to Grains
|
||||||
- [ ] Cloves to Grams
|
- [x] Cloves to Grams
|
||||||
- [ ] Cloves to Hundredweight
|
- [x] Cloves to Hundredweight
|
||||||
- [ ] Cloves to Hundredweight (cwt)
|
- [x] Cloves to Hundredweight (cwt)
|
||||||
- [ ] Cloves to Long Tons
|
- [x] Cloves to Long Tons
|
||||||
- [ ] Cloves to Metric Tons
|
- [x] Cloves to Metric Tons
|
||||||
- [ ] Cloves to Micrograms
|
- [x] Cloves to Micrograms
|
||||||
- [ ] Cloves to Milligrams
|
- [x] Cloves to Milligrams
|
||||||
- [ ] Cloves to Momme
|
- [x] Cloves to Momme
|
||||||
- [ ] Cloves to Nanograms
|
- [x] Cloves to Nanograms
|
||||||
- [ ] Cloves to Ounces
|
- [x] Cloves to Ounces
|
||||||
- [ ] Cloves to Pennyweights
|
- [ ] Cloves to Pennyweights
|
||||||
- [ ] Cloves to Picograms
|
- [ ] Cloves to Picograms
|
||||||
- [ ] Cloves to Planck Mass
|
- [ ] Cloves to Planck Mass
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// THIS FILE IS AUTO-GENERATED BY migrate.py
|
// THIS FILE IS AUTO-GENERATED BY migrate.py
|
||||||
export type CalcType = 'standard' | 'inverse' | '3col' | '3col-mul' | 'base' | 'text-bin' | 'bin-text' | 'dms-dd' | 'dd-dms' | 'dec-frac' | 'db-int' | 'db-spl' | 'db-v' | 'db-w' | 'awg' | 'brinell-rockwell' | 'ev-lux' | 'aov' | 'swg' | 'rockwell-vickers' | 'sus-cst' | 'molarity';
|
export type CalcType = 'standard' | 'inverse' | '3col' | '3col-mul' | 'base' | 'text-bin' | 'bin-text' | 'dms-dd' | 'dd-dms' | 'dec-frac' | 'db-int' | 'db-spl' | 'db-v' | 'db-w' | 'awg' | 'brinell-rockwell' | 'ev-lux' | 'aov' | 'swg' | 'rockwell-vickers' | 'sus-cst' | 'molarity' | 'cmil-dia' | 'cmil-swg';
|
||||||
|
|
||||||
export interface CalculatorDef {
|
export interface CalculatorDef {
|
||||||
slug: string;
|
slug: string;
|
||||||
@@ -2269,6 +2269,46 @@ export const calculators: CalculatorDef[] = [
|
|||||||
{"slug": "chains-to-thou", "name": "Chains to Thou", "category": "length", "type": "standard", "labels": {"in1": "Chains", "in2": "Thou"}, "factor": 792000.0},
|
{"slug": "chains-to-thou", "name": "Chains to Thou", "category": "length", "type": "standard", "labels": {"in1": "Chains", "in2": "Thou"}, "factor": 792000.0},
|
||||||
{"slug": "chains-to-thou-mil", "name": "Chains to Thou (mil)", "category": "length", "type": "standard", "labels": {"in1": "Chains", "in2": "Thou (mil)"}, "factor": 792000.0},
|
{"slug": "chains-to-thou-mil", "name": "Chains to Thou (mil)", "category": "length", "type": "standard", "labels": {"in1": "Chains", "in2": "Thou (mil)"}, "factor": 792000.0},
|
||||||
{"slug": "circular-mils-to-acres", "name": "Circular Mils to Acres", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Acres"}, "factor": 1.252101449146529e-13},
|
{"slug": "circular-mils-to-acres", "name": "Circular Mils to Acres", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Acres"}, "factor": 1.252101449146529e-13},
|
||||||
|
{"slug": "circular-mils-to-ares", "name": "Circular Mils to Ares", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Ares"}, "factor": 5.067074790974978e-12},
|
||||||
|
{"slug": "circular-mils-to-awg", "name": "Circular Mils to Awg", "category": "electrical", "type": "awg", "labels": {"in1": "Circular Mils", "in2": "Awg"}},
|
||||||
|
{"slug": "circular-mils-to-barns", "name": "Circular Mils to Barns", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Barns"}, "factor": 5.067074790974978e+18},
|
||||||
|
{"slug": "circular-mils-to-dunams", "name": "Circular Mils to Dunams", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Dunams"}, "factor": 5.067074790974979e-13},
|
||||||
|
{"slug": "circular-mils-to-hectares", "name": "Circular Mils to Hectares", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Hectares"}, "factor": 5.067074790974978e-14},
|
||||||
|
{"slug": "circular-mils-to-millimeters-diameter", "name": "Circular Mils to Millimeters (diameter)", "category": "length", "type": "cmil-dia", "labels": {"in1": "Circular Mils", "in2": "Millimeters (diameter)"}},
|
||||||
|
{"slug": "circular-mils-to-roods", "name": "Circular Mils to Roods", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Roods"}, "factor": 5.008405796586116e-13},
|
||||||
|
{"slug": "circular-mils-to-sections", "name": "Circular Mils to Sections", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Sections"}, "factor": 1.9564085142914516e-16},
|
||||||
|
{"slug": "circular-mils-to-square-centimeters", "name": "Circular Mils to Square Centimeters", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Square Centimeters"}, "factor": 5.067074790974978e-06},
|
||||||
|
{"slug": "circular-mils-to-square-feet", "name": "Circular Mils to Square Feet", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Square Feet"}, "factor": 5.45415391248228e-09},
|
||||||
|
{"slug": "circular-mils-to-square-inches", "name": "Circular Mils to Square Inches", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Square Inches"}, "factor": 7.853981633974484e-07},
|
||||||
|
{"slug": "circular-mils-to-square-kilometers", "name": "Circular Mils to Square Kilometers", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Square Kilometers"}, "factor": 5.067074790974978e-16},
|
||||||
|
{"slug": "circular-mils-to-square-meters", "name": "Circular Mils to Square Meters", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Square Meters"}, "factor": 5.067074790974978e-10},
|
||||||
|
{"slug": "circular-mils-to-square-miles", "name": "Circular Mils to Square Miles", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Square Miles"}, "factor": 1.9563995331949722e-16},
|
||||||
|
{"slug": "circular-mils-to-square-millimeters-cross-section", "name": "Circular Mils to Square Millimeters (cross-section)", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Square Millimeters (cross-section)"}, "factor": 0.0005067074790974978},
|
||||||
|
{"slug": "circular-mils-to-square-yards", "name": "Circular Mils to Square Yards", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Square Yards"}, "factor": 6.0601710138692e-10},
|
||||||
|
{"slug": "circular-mils-to-swg", "name": "Circular Mils to Swg", "category": "electrical", "type": "cmil-swg", "labels": {"in1": "Circular Mils", "in2": "Swg"}},
|
||||||
|
{"slug": "circular-mils-to-townships", "name": "Circular Mils to Townships", "category": "area", "type": "standard", "labels": {"in1": "Circular Mils", "in2": "Townships"}, "factor": 5.434471477884176e-18},
|
||||||
|
{"slug": "cloves-to-amu", "name": "Cloves to Amu", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Amu"}, "factor": 2.185277680596786e+27},
|
||||||
|
{"slug": "cloves-to-apothecary-ounces", "name": "Cloves to Apothecary Ounces", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Apothecary Ounces"}, "factor": 116.66666666666667},
|
||||||
|
{"slug": "cloves-to-atomic-mass-units", "name": "Cloves to Atomic Mass Units", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Atomic Mass Units"}, "factor": 2.185277680596786e+27},
|
||||||
|
{"slug": "cloves-to-attograms", "name": "Cloves to Attograms", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Attograms"}, "factor": 3.6287389600000005e+21},
|
||||||
|
{"slug": "cloves-to-carats", "name": "Cloves to Carats", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Carats"}, "factor": 18143.6948},
|
||||||
|
{"slug": "cloves-to-centigrams", "name": "Cloves to Centigrams", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Centigrams"}, "factor": 362873.896},
|
||||||
|
{"slug": "cloves-to-daltons", "name": "Cloves to Daltons", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Daltons"}, "factor": 2.185277680596786e+27},
|
||||||
|
{"slug": "cloves-to-drams", "name": "Cloves to Drams", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Drams"}, "factor": 2048.0},
|
||||||
|
{"slug": "cloves-to-earth-masses", "name": "Cloves to Earth Masses", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Earth Masses"}, "factor": 6.076050634607012e-25},
|
||||||
|
{"slug": "cloves-to-femtograms", "name": "Cloves to Femtograms", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Femtograms"}, "factor": 3628738960000000.0},
|
||||||
|
{"slug": "cloves-to-gamma-mass", "name": "Cloves to Gamma (mass)", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Gamma (mass)"}, "factor": 3628738960.0},
|
||||||
|
{"slug": "cloves-to-grains", "name": "Cloves to Grains", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Grains"}, "factor": 56000.0},
|
||||||
|
{"slug": "cloves-to-grams", "name": "Cloves to Grams", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Grams"}, "factor": 3628.73896},
|
||||||
|
{"slug": "cloves-to-hundredweight", "name": "Cloves to Hundredweight", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Hundredweight"}, "factor": 0.08},
|
||||||
|
{"slug": "cloves-to-hundredweight-cwt", "name": "Cloves to Hundredweight (cwt)", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Hundredweight (cwt)"}, "factor": 0.07142857142857142},
|
||||||
|
{"slug": "cloves-to-long-tons", "name": "Cloves to Long Tons", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Long Tons"}, "factor": 0.0035714285714285718},
|
||||||
|
{"slug": "cloves-to-metric-tons", "name": "Cloves to Metric Tons", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Metric Tons"}, "factor": 0.0036287389600000003},
|
||||||
|
{"slug": "cloves-to-micrograms", "name": "Cloves to Micrograms", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Micrograms"}, "factor": 3628738960.0},
|
||||||
|
{"slug": "cloves-to-milligrams", "name": "Cloves to Milligrams", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Milligrams"}, "factor": 3628738.9600000004},
|
||||||
|
{"slug": "cloves-to-momme", "name": "Cloves to Momme", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Momme"}, "factor": 967.6637226666668},
|
||||||
|
{"slug": "cloves-to-nanograms", "name": "Cloves to Nanograms", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Nanograms"}, "factor": 3628738960000.0005},
|
||||||
|
{"slug": "cloves-to-ounces", "name": "Cloves to Ounces", "category": "weight", "type": "standard", "labels": {"in1": "Cloves", "in2": "Ounces"}, "factor": 128.0},
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -448,6 +448,50 @@ export function solve(
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'cmil-dia': {
|
||||||
|
const cmilToMm = (c: number) => 0.0254 * Math.sqrt(c);
|
||||||
|
const mmToCmil = (mm: number) => Math.pow(mm / 0.0254, 2);
|
||||||
|
|
||||||
|
if (source === 1) {
|
||||||
|
out.val2 = (!isNaN(v1) && v1 >= 0) ? fmt(cmilToMm(v1)) : '';
|
||||||
|
} else {
|
||||||
|
out.val1 = (!isNaN(v2) && v2 >= 0) ? fmt(mmToCmil(v2)) : '';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'cmil-swg': {
|
||||||
|
const swgTable: Record<number, number> = {
|
||||||
|
0: 8.23, 1: 7.62, 2: 7.01, 3: 6.4, 4: 5.89, 5: 5.38, 6: 4.88, 7: 4.47,
|
||||||
|
8: 4.06, 9: 3.66, 10: 3.25, 11: 2.95, 12: 2.64, 13: 2.34, 14: 2.03, 15: 1.83,
|
||||||
|
16: 1.63, 17: 1.42, 18: 1.22, 19: 1.02, 20: 0.91, 21: 0.81, 22: 0.71, 23: 0.61,
|
||||||
|
24: 0.56, 25: 0.51, 26: 0.46, 27: 0.42, 28: 0.38, 29: 0.35, 30: 0.32, 31: 0.29,
|
||||||
|
32: 0.27, 33: 0.25, 34: 0.23, 35: 0.21, 36: 0.19, 37: 0.17, 38: 0.15, 39: 0.14,
|
||||||
|
40: 0.12, 41: 0.11, 42: 0.1, 43: 0.09, 44: 0.08, 45: 0.07, 46: 0.064, 47: 0.058,
|
||||||
|
48: 0.051, 49: 0.045, 50: 0.04
|
||||||
|
};
|
||||||
|
const mmToSwg = (mm: number) => {
|
||||||
|
let best = -1, bestDiff = Infinity;
|
||||||
|
for (const [gStr, diam] of Object.entries(swgTable)) {
|
||||||
|
const diff = Math.abs(mm - diam);
|
||||||
|
if (diff < bestDiff) { bestDiff = diff; best = parseInt(gStr, 10); }
|
||||||
|
}
|
||||||
|
return best;
|
||||||
|
};
|
||||||
|
const swgToMm = (g: number) => swgTable[Math.round(g)];
|
||||||
|
const cmilToMm = (c: number) => 0.0254 * Math.sqrt(c);
|
||||||
|
const mmToCmil = (mm: number) => Math.pow(mm / 0.0254, 2);
|
||||||
|
|
||||||
|
if (source === 1) {
|
||||||
|
const mm = (!isNaN(v1) && v1 >= 0) ? cmilToMm(v1) : NaN;
|
||||||
|
out.val2 = isFinite(mm) ? fmt(mmToSwg(mm)) : '';
|
||||||
|
} else {
|
||||||
|
const mm = (!isNaN(v2) && v2 >= 0) ? swgToMm(v2) : NaN;
|
||||||
|
out.val1 = isFinite(mm) ? fmt(mmToCmil(mm)) : '';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
|||||||
Reference in New Issue
Block a user