Floats rounded down in AWS AppSync VTL

Viewed 9

I am creating a resolvers response mapping in AWS AppSync which is meant to perform a math calculation and return a percentage value as a float:

#set( $result = $ctx.source.total * 100 / 365000 )
$result

However VTL rounds this down each time to the nearest whole number such as 1.0, 2.0 etc.

Given 5000 * 100 / 365000:

Expected - 1.36 Result - 1.0

Is there anyway I can achieve this? or do I need to look towards using a Lambda (which feels overkill for something so simple).

0 Answers
Related