LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Multiplying 2 fields

    Employee
    Posted 10-31-2011 21:12

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Rapkat

    E.g

    Field1 Field2
    20 150


    How do I multiply Field1 by Field2 to get the total of 3000?


  • 2.  RE: Multiplying 2 fields

    Employee
    Posted 11-01-2011 01:28

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    Hey,

    Look at the example in the attached graph.
    The multiplication and output of the new field is handled in the filter nodes.
    The first filter node assumes that the input fields are already numeric.
    The second filter node can take a String or numeric input and will convert it to be numeric prior to attempting the multiplication.

    Is this what you are looking for?

    Tim.
    Attachments:
    Multiply.brg


  • 3.  RE: Multiplying 2 fields

    Employee
    Posted 11-01-2011 16:49

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Rapkat

    Hi Tim

    Thank you for that, it will be helpful with other things, but I should have been more specific, my figures 0.123, so wont work changing to an interger. Is there any way to multiply these types of figures?


  • 4.  RE: Multiplying 2 fields

    Employee
    Posted 11-02-2011 02:36

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    Hi,

    See the attached example, showing the same thing as the previous one - this time using doubles instead of ints.

    These different functions (such as double() int() etc) can be found in the BRAINScript help, under Help->BRAINScript Help.

    In addition, if you are in the Node Editor, and are writing into a BRAINScript parameter, you can right click & will be able to see all of the available BRAINScript functions.

    The operators in question can be found in the "Numeric Operators" sub menu item.

    Regards,
    Tim.
    Attachments:
    MultiplyFloatingPoint.brg


  • 5.  RE: Multiplying 2 fields

    Employee
    Posted 11-02-2011 02:38

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: mgajdosik

    use double(FieldName) instead of int(FieldName). LAE has 3 numeric data types:

    int - Integers - only whole numbers without decimal point
    (from - to + 2,147,483,647)
    long -Long Integers - same as integer but allows higher/lower values
    (from - to + 9,223,372,036,854,775,808)
    double - no limitations to size, but precision may be tricky, used for decimals/floating point numbers

    Marek


  • 6.  RE: Multiplying 2 fields

    Employee
    Posted 11-02-2011 02:56

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    Actually double has it's limitations too.
    This is encoded in BRD format as a standard 64 bit IEEE-754 floating point number (see http://en.wikipedia.org/wiki/IEEE_754-2008)

    In general though, these limits would rarely be exceeded, and as Marek points out, the precision is more likely to be an issue due to the standard issues floating point precision in floating point arithmetic since not all numbers can be encoded with 100% accuracy into binary form.