added frequency rounding

This commit is contained in:
tyow 2026-01-30 16:59:33 -05:00
parent 8def3f6af6
commit 35e32a32e8
2 changed files with 23 additions and 21 deletions

View file

@ -102,7 +102,9 @@ export const xen = register('xen', function (scaleNameOrRatios, pat) {
hVal = isObject ? hVal : { n: hVal };
const { n, value, ...otherValues } = hVal;
const scale = getXenScale(scaleNameOrRatios);
const frequency = xenOffset(scale, parseNumeral(hVal.n));
let frequency = xenOffset(scale, parseNumeral(hVal.n));
// 10 is somewhat arbitrary
frequency = parseFloat(frequency.toPrecision(10))
hap.value = isObject ? {...otherValues, freq: frequency } : frequency
return hap;
});