Returns the difference from the initial value. Defaults to absolute difference.
initial
const rel = differenceFromFixed(100);rel(100); // 0rel(150); // 50rel(50); // 50 Copy
const rel = differenceFromFixed(100);rel(100); // 0rel(150); // 50rel(50); // 50
'numerical' gives sign:
const rel = differenceFromFixed(100, `numerical`);rel(100); // 0rel(150); // 50rel(50); // -50 Copy
const rel = differenceFromFixed(100, `numerical`);rel(100); // 0rel(150); // 50rel(50); // -50
'relative' gives proportion to initial
const rel = differenceFromFixed(100, `relative`);rel(100); // 0rel(150); // 0.5rel(10); // 0.90 Copy
const rel = differenceFromFixed(100, `relative`);rel(100); // 0rel(150); // 0.5rel(10); // 0.90
Using 'relativeSigned', we get negative relative result when value is below the initial value.
Use differenceFromLast to compare against the last value, rather than the same fixed value.
Value to compare against
Difference from initial value
Returns the difference from the
initial
value. Defaults to absolute difference.'numerical' gives sign:
'relative' gives proportion to initial
Using 'relativeSigned', we get negative relative result when value is below the initial value.
Use differenceFromLast to compare against the last value, rather than the same fixed value.