Skip to content

Conversation

@mmolnar
Copy link

@mmolnar mmolnar commented Jun 15, 2018

This function will be usefull when you need to convert miliseconds to seconds.

I am not a go programmer, so doing tests would be difficult for me.

@coveralls
Copy link

coveralls commented Jun 15, 2018

Coverage Status

Coverage decreased (-0.4%) to 68.957% when pulling 3554b54 on mmolnar:master into ad4273d on fstab:master.

@fstab
Copy link
Owner

fstab commented Jun 16, 2018

Looks good, thanks. Maybe it would be clearer to use multiply instead of shift. With {{shift .val 3}} there are some implicit assumptions (decimal shift (not binary), shift is to the right (not to the left), order of the parameters is important (right is the exponent)). If we instead implement {{multiply .val 1000}} I think it would be clearer what it does.

Could you change it and make it multiply instead of shift?

@mmolnar
Copy link
Author

mmolnar commented Jun 18, 2018

OK, I have modified the commit to do general multiplication.
As templates can use go float literals I can just use scientific notation to simply achieve what I was aiming for:
{{multiply .val 1.e-6}}

@fstab fstab merged commit 45f0ff1 into fstab:master Jun 19, 2018
@fstab
Copy link
Owner

fstab commented Jun 19, 2018

Thanks!

@fstab
Copy link
Owner

fstab commented Jun 19, 2018

I added add, subtract, and divide. So we have all four arithmetic functions now.

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

Successfully merging this pull request may close these issues.

3 participants