Floating numbers representation

23 views
Skip to first unread message

Damian Śliwiński

unread,
Nov 6, 2018, 3:32:39 AM11/6/18
to dotliquid
Hi 

Is there a way to "correctly" represent "bigger" floating point numbers e.g. {{ 9999999.99 }} is generated as 1E+07. It seems these numbers are internally processed as System.Single which can store smaller numbers than System.Double. 
Ideally if I could "force" dotLiquid to handle this number as string.

Unfortunately I'm not able to preprocess input data (e.g. change to a string) - dotLiquid is used as a template engine by Azure API Manager so I need to handle this inside template definition.

Thanks

David Burg

unread,
Jun 4, 2020, 1:31:01 PM6/4/20
to dotliquid
Hi Damian,

I've implemented changes so that floating point numbers try to give you the best accuracy, especially avoid precision issues for financial operations like your number, and falls-back to lower precision when the value range would overflow perfect precision.

With regards,

David.
Reply all
Reply to author
Forward
0 new messages