Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relational Operators are failing if we provide floating numbers in if else conditions #18

Open
yozna-kabra-sarda opened this issue Sep 13, 2022 · 1 comment

Comments

@yozna-kabra-sarda
Copy link

yozna-kabra-sarda commented Sep 13, 2022

I am getting the wrong result if I am providing floating numbers in if else condition.

my %data = (balance => '800.25');

my $str2 = ' {% if  balance < 1000.78 %} IN IF balance is {{ balance }} is less than 1000.78  {% else %} IN ELSE balance is {{ balance }} which is more than 1000.78 {% endif %}';

my $tt1 = Template::Liquid->parse($str2);

print $tt1->render(%data) or die $tt1->error;

print "\n\n";

Output is : IN ELSE balance is 800.25 which is more than 1000.78

Please provide a fix for this.

@yozna-kabra-sarda
Copy link
Author

I have raised a PR to fix this issue. Please check and merge it.
PR Link : https://github.com/sanko/template-liquid/pull/17/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant