Arith Sumn: Unterschied zwischen den Versionen
Cg (Diskussion | Beiträge) |
Cg (Diskussion | Beiträge) |
||
(11 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt) | |||
Zeile 3: | Zeile 3: | ||
[[Bild:arith_sumn.jpg]] |
[[Bild:arith_sumn.jpg]] |
||
This block is more or less obsoleted by the [[Arith Sum+| |
This block is more or less '''obsoleted''' by the "[[Arith Sum+|Arith [ Sum+ ] ]]" block, which allows for an arbitrary number of input pins. |
||
The Sumn block will remain in the library, but new actions should use Sum+ (as it looks better in a diagram). |
The "Sumn" block will remain in the library, but new actions should use "Sum+" (as it looks better in a diagram). |
||
== Trigger == |
== Trigger == |
||
At least the first 2 inputs must be connected and both must have received a value for the action to trigger ("and" input behavior). If present, additional values from other pins are added to form the sum. If no value is present, or the pin is |
At least the first 2 inputs must be connected and both must have received a value for the action to trigger ("and" input behavior). If present, additional values from other pins are added to form the sum. If no value is present, or the pin is unconnected, a 0 (zero) is taken as operand. |
||
== Operation == |
== Operation == |
||
Zeile 15: | Zeile 15: | ||
== Automatic Type Conversion == |
== Automatic Type Conversion == |
||
The block allows for mixed mode arithmetic. This means that all combinations of Float, Double, Integer, LargeInteger and |
The block allows for mixed mode arithmetic. This means that all combinations of Float, Double, Integer, LargeInteger, Fractional and ScaledDecimal numbers are allowed as input. |
||
<br>However, due to the pins being of type "Number", non-numbers (such as physical values or vectors) are not handled (unless type checks are disabled at the pins). Use the new [[ Arith Sum Any|"Arith [ Sum Any ]" ]] block for this.<br> |
|||
Depending on the input type(s), the output number is generated as: |
Depending on the input type(s), the output number is generated as: |
||
Zeile 58: | Zeile 59: | ||
Notes: |
Notes: |
||
<BR> |
<BR> |
||
(1) Integers are not limited to a 32bit range. If the result does not fit into a smallInteger, a largeInteger representation with an arbitrary number of digits is automatically |
(1) Integers are not limited to a 32bit range. If the result does not fit into a smallInteger, a largeInteger representation with an arbitrary number of digits is automatically chosen (32, 64, 96, 128... bits). |
||
(2) If the fraction can be reduced to an integral value, an Integer is returned (i.e. 6/3 will be reduced to 2) |
(2) If the fraction can be reduced to an integral value, an Integer is returned (i.e. 6/3 will be reduced to 2) |
||
Zeile 65: | Zeile 66: | ||
This block has been in the [[ Standard Library ]] since 0.1. |
This block has been in the [[ Standard Library ]] since 0.1. |
||
<br> |
|||
It is more or less obsoleted by the "Arith Sum+" block, which supports an arbitrary number of inputs. |
|||
{{noprint| 1 = |
{{noprint| 1 = |
Aktuelle Version vom 19. September 2021, 09:30 Uhr
Inhaltsverzeichnis
Schema[Bearbeiten]
This block is more or less obsoleted by the "Arith [ Sum+ ] " block, which allows for an arbitrary number of input pins. The "Sumn" block will remain in the library, but new actions should use "Sum+" (as it looks better in a diagram).
Trigger[Bearbeiten]
At least the first 2 inputs must be connected and both must have received a value for the action to trigger ("and" input behavior). If present, additional values from other pins are added to form the sum. If no value is present, or the pin is unconnected, a 0 (zero) is taken as operand.
Operation[Bearbeiten]
This block returns the sum of all given numbers, i.e.
sum = number1 + number2 + ... + number10
Automatic Type Conversion[Bearbeiten]
The block allows for mixed mode arithmetic. This means that all combinations of Float, Double, Integer, LargeInteger, Fractional and ScaledDecimal numbers are allowed as input.
However, due to the pins being of type "Number", non-numbers (such as physical values or vectors) are not handled (unless type checks are disabled at the pins). Use the new "Arith [ Sum Any ]" block for this.
Depending on the input type(s), the output number is generated as:
in1 | in2 | out | |
Integer | Integer | Integer (1) | |
Integer | Float / Double | Float / Double | |
Integer | Fraction | Fraction (2) | |
Fraction | Fraction | Fraction (2) | |
Fraction | Float / Double | Float / Double | |
Float / Double | Float / Double | Float / Double |
Notes:
(1) Integers are not limited to a 32bit range. If the result does not fit into a smallInteger, a largeInteger representation with an arbitrary number of digits is automatically chosen (32, 64, 96, 128... bits).
(2) If the fraction can be reduced to an integral value, an Integer is returned (i.e. 6/3 will be reduced to 2)
Revisions[Bearbeiten]
This block has been in the Standard Library since 0.1.
It is more or less obsoleted by the "Arith Sum+" block, which supports an arbitrary number of inputs.