# agri.yield-per-hectare
Crop yield per hectare and per acre from the quantity harvested and the area
it came from, with the area given in any unit `units.convert` knows (ha,
acre, m2, ft2, ...). `yieldPerHectare("85", "10", "ha", 2)` is 8.5 per
hectare, 3.44 per acre, 10 ha, 24.71 acres.
The quantity is unitless: the answer is in whatever it was counted in (t,
kg, bales, litres of milk from grass), so it works for tonnes of wheat,
bales of hay or kg from a trial plot alike. Convert the quantity first with
`units.convert` if you need a different mass unit.
## Exactness
Quantity and area arrive as decimal text, and the size of the area unit comes
from `units.convert` as exact decimal text (`convertUnits("1", "acre", "m2",
12)` is `"4046.8564224"`, the international acre). Each result is therefore
one exact fraction, rounded once, half up, to `decimals` places, with
trailing zeros trimmed: `"8.5"`, not `"8.50"`. In floating point 1.005 t
from 1 ha shows as 1.00 t/ha to two places; this gives 1.01.
The acre is the international acre (43,560 international square feet,
4046.8564224 m²), as in `units.convert`; the US survey acre was retired at
the end of 2022.
## Limits
Quantity and area are plain non-negative decimal text: digits with an
optional fractional part, no sign, separators or exponent, at most 12
significant digits and 6 decimal places. The area must be more than zero; a
quantity of zero is a yield of zero. `decimals` is 0 to 12. These limits keep
the Rust port exact in `i128`.
## Sources
The unit sizes are `units.convert`'s: NIST SP 811 (2008), Appendix B, and
NIST, "U.S. Survey Foot: Revised Unit Conversion Factors" (the acre as
4046.8564224 m²); 1 ha = 10,000 m² by definition.
1.0.1 fixes Python accepting a trailing newline in quantity and area; adds tests.