-
Notifications
You must be signed in to change notification settings - Fork 468
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
Add support for floating point operations #2742
Conversation
This user does not have permission to start the build. Can one of the admins verify this patch and start the build? |
1 similar comment
This user does not have permission to start the build. Can one of the admins verify this patch and start the build? |
@kira-syslogng ok to test |
6a6117c
to
42e9ab9
Compare
Build FAILURE |
Build SUCCESS |
69f8e08
to
c082655
Compare
Build SUCCESS |
@smortex I brough up this feature to the team, and we want to discuss it. It may take some time, but I hope not later than next Wednesday. |
Sure, thanks you for taking care of it! I started "the easy way" and I guess a lot of topics will be raised, such as:
Maintainers of the project can push commits to my branch, feel free to do so, but please send me a heads-up in this case so that I do not |
I tried to summarise the result of that conversation: A short summary of the discussion about this topic:Re/defining the arithmetic operations:The way how operation should be defined: like the one you proposed in your PR, the one in the issue( new operations for float). Impact on current configurationsWith your version it is not an issue, as float was not supported before and operations with float resulted invalid/unwanted result (like NaN) Storage method/1There is a recurring idea that nv-pairs should have more sophisticated way to store different types (other then the string representation). Storage method/2Your proposal stores the float in a string representation. (this is somewhat connected to the next topic) Operations error propagationA brief discussion about the errors each operation could introduce, or just the converting into string. What it means for this PR:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please in case of all [optional]
comment either reply won't fix or do the change; I am fine with both.
314e96e
to
919909d
Compare
This comment has been minimized.
This comment has been minimized.
Build SUCCESS |
@Kokan, just to be sure, can you please confirm that your approval has value of "ok for squashing the commits and moving on to the next step"? |
@smortex yes for the squash; but if by next step you mean merging the PR, then no. as that requires at least two approver. |
Sure! By "next step" I meant further work on the PR ;-) |
Make it possible to use the mathematic operators with floating point values. Behave like the C programming language: - if both operands are integers, then compute and return an integer; - if any of the operands is a floating-point number, return a floating-point result. $(/ 3 2) #=> 1 $(/ 3.0 2) #=> 1.500000 $(/ 3 2.0) #=> 1.500000 $(/ 3.0 2.0) #=> 1.500000
With the ability to compute values with floating points, we need to be able to round results.
919909d
to
918c534
Compare
I reordered the commits, fixed and squashed the commits after rebasing on top of the master branch. I pushed the two modified commits one by one in order to trigger two builds. Let's see how is goes 😉 |
Build SUCCESS |
1b582ba
to
4d6f1a0
Compare
Thanks! I added the optional precision argument to round, and reached a complete coverage of my use-case. |
Build SUCCESS |
6752a82
to
6454988
Compare
Build SUCCESS |
6454988
to
b0e5659
Compare
Build SUCCESS |
I added a bunch of commit that address the problems you spotted. Thanks! |
Build FAILURE |
1 similar comment
Build FAILURE |
@smortex please feel free to fixup the changes in the next step (if you agree with my comment on your commit), and from my side it is good to go. |
Allow an optional second argument to the round template to set the precision of the rounding. The default is 0 (output a natural number) but values up to 20 are accepted. The limit of 20 was set in accordance with the precision used internally for computations.
80db31e
to
3ba54e8
Compare
Build SUCCESS |
Thanks @Kokan I squashed the last commits into a single one. It looks like the "default" kira build fails, but I cannot access the system. Is there something I can fix myself? |
@smortex please ignore the default kira. |
That job is work in progress, so ignore it please. I have disabled it for
now.
Kókai Péter <notifications@github.com> ezt írta (időpont: 2019. jún. 6., Cs
23:05):
… @smortex <https://github.com/smortex> please ignore the *default* kira.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2742>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAFOK5VOZF5DRLKEHAASIP3PZF3ZTANCNFSM4HOO7YUQ>
.
|
(@smortex I'll do some stuff here to make default green, you still can ignore) |
@kira-syslogng retest this please |
Build FAILURE |
@kira-syslogng retest this please |
Build SUCCESS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work!
This PR is about supporting math expression using floating-point values. The code is published for review for now, because some decisions might need to be discussed. I plan to amend the commits to address the issues and comments raised by the syslog-ng community, and remove the
[Do not merge]
tag when I consider the changes to be ready.Fixes #2734