Author Topic: Additional Tagging & Reporting Tools  (Read 942234 times)

redwing

  • Guest
$And(parameter1,parameter2)

$Or(parameter1,parameter2)

MB already supports those. If it does something different, it should use a different function name.

boroda

  • Sr. Member
  • ****
  • Posts: 4669
no, they are generic boolean functions. strange that these functions are not listed in mb and there was request on the forum to add them to mb without Steven's response.

i'll remove these 2 functions from plugin.


redwing

  • Guest
I think people have often requested listing more than two conditions for $And and $Or. If you can implement that with different function names, that would be useful since users could easily construct a template without having to use complex nested $If conditions.

boroda

  • Sr. Member
  • ****
  • Posts: 4669
i'm not sure if its easy or not (as its not very important) for Steven to add support for custom functions with variable number of parameters, eg.:

Code
public string CustomFunc_MultiAnd(params string[] parameters)

currently such custom functions are just ignored by mb.

boroda

  • Sr. Member
  • ****
  • Posts: 4669
Thanks!

All are working great except sorting issue with float numbers:



It completely ignores decimal point and minus sign.
Tried changing the virtual field's format to number, but it makes no differences.
Not sure this is something you can handle or Steven has to look.

Another issue is when rounded it drops all trailing zeros like the screenshot. Why not keep those zeros like 3.00 instead of 3?

its done:

http://www.mediafire.com/file/aylmg5xonsyioc1/mb_TagTools_2018-02-03.zip

also i've removed all $*Float functions, instead use $Add, $Sub, $Mul, $Div functions for both integers and floats. $Or/$And are removed.

@rewing, please change your 2 recent guides for using arithmetic operation.


redwing

  • Guest
Can you look into this issue?

$Sub(7.5,7) returns 0.5 but
$Sub(7.6,7) returns 0.5999999

Why?

Also there's the same issue as dropping trailing zeros with $Sub function.

boroda

  • Sr. Member
  • ****
  • Posts: 4669
its very old computer problem connected to binary calculations, but decimal representation of numbers on a screen (probably you will be surprised, but 1/10 is not 0.1). sometimes there decimal calculations are used to avoid this, but this approach is very slow. most easy way to avoid this is to slightly round end result.

only $Round function preserves trailing zeros. dont want to add additional parameter (number of trailing zeros to preserve) to other functions.

redwing

  • Guest
Then no way to predict when that occurs? Should I add $Round to all calculation result?

boroda

  • Sr. Member
  • ****
  • Posts: 4669
just tried visual studio interpretator and, yes:

7.6-7=0.59999999999999964

i.e. its how .net works. i think i will auto-round all arithmetic function results to 14 digits after decimal point.


redwing

  • Guest

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34390
@boroda74
perhaps the Decimal data type will work better?

boroda

  • Sr. Member
  • ****
  • Posts: 4669
not sure how good this version works in general, but my particular tests were successful. at least $Sub(7.6,7)=0.6 now.

also i've fixed a bug for languages which use comma as decimal point: it was impossible to type fractional number as parameter because $Sub(7,6,7) cant be correctly parsed by mb. now always use dot as decimal point for explicit fractional numbers (there are not and weren't any problems with tag values).

http://www.mediafire.com/file/aylmg5xonsyioc1/mb_TagTools_2018-02-03.zip