Formula evaluation auto-rounds numbers (expected "52.50000", got "52.5")

Hi HyperFormula team :wave:,

I’m using HyperFormula.buildFromSheets() to evaluate some sheet data, and I noticed an issue with how numeric results are returned after formula evaluation.

My input (handsontableJson) looks like this:{ "Sheet2": [ [ "52.50000", "=ROUND(AVERAGE(A1:A5),5)" ], [ "52.50000", "" ], [ "52.50000", "" ], [ "52.50000", "" ], [ "52.50000", "" ] ] } const hfInstance = HyperFormula.buildFromSheets(handsontableJson, { licenseKey: 'gpl-v3', smartRounding: false, }); const sheetId = hfInstance.getSheetId(sheetKey); const evaluatedData = hfInstance.getSheetValues(sheetId); console.log(evaluatedData);
However, when I check the output (evaluatedData), it becomes:
Problem:

  • I expected the result to be "52.50000", preserving the 5 decimal places, because the original formula uses =ROUND(AVERAGE(A1:A5),5).
  • But HyperFormula returns it as 52.5, losing the trailing zeros.

Context:

  • smartRounding: false is already set.
  • I would like to retain the precision as formatted (5 decimal places), especially for PDF generation use cases where the exact number format matters.

Question:

  • Is there a built-in way to preserve the decimal formatting (e.g., ā€œ52.50000ā€ instead of ā€œ52.5ā€)?
  • If not, could this be considered as an enhancement, or is there a recommended workaround?

Thanks a lot for your amazing work on HyperFormula! :rocket:

Hi @dhatchanamoorthiapcs

I see that we got the same question on the HyperFormula Github issue board so I will continue the subject there at [Bug]: Formula evaluation auto-rounds numbers (expected "52.50000", got "52.5") Ā· Issue #1505 Ā· handsontable/hyperformula Ā· GitHub.