() of () (Operators): Difference between revisions

From PenguinMod Wiki
() of () (Operators)
Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
|title = () of ()
|title = () of ()
}}
}}
The '''() of ()''' block is a reporter block in the [[Operators]] category that allows for various functions to be used on a specific number. It originates from Scratch.
The '''() of ()''' block is a reporter block in the [[Operators]] category that allows for various functions to be used on a specific number. It originates from Scratch. All of the trigonometric functions are calculated in degrees.
{| class="wikitable"
{| class="wikitable"
|-
|-
! Operator !! Description !! Default
! Operator !! Description !! Example !! Default
|-
|-
| abs || Absolute value (distance of the number from 0) || The distance of 3 and -3 from 0 would both be 3, and the distance of 0 from 0 would just be 0 || Yes
| abs || Absolute value || Yes
|-
|-
| floor || Floor function (always rounds a decimal down [ex. 4.5 becomes 4, 10.1 becomes 10, 13.9 becomes 13, and 9 stays as 9]) || rowspan="13"|No
| floor || Floor function (always rounds a decimal down) || 4.5 becomes 4, 10.1 becomes 10, 13.9 becomes 13, and 9 stays as 9 || rowspan="13"|No
|-
|-
| ceiling || Ceiling function (always rounds a decimal up [ex. 4.5 becomes 5, 10.1 becomes 11, 13.9 becomes 14, and 9 stays as 9])
| ceiling || Ceiling function (always rounds a decimal up) || 4.5 becomes 5, 10.1 becomes 11, 13.9 becomes 14, and 9 stays as 9
|-
|-
| sqrt || Square root
| sqrt || Square root || Entering 4 would return 2, and 16 would return 4.
|-
|-
| sin || Sine || Entering 30 would result in 0.5, and 180 would result in 0
| sin || Sine
|-
|-
| cos || Cosine || Entering 30 would result in around 0.866, and 180 would result in -1.
| cos || Cosine
|-
|-
| tan || Tangent || Entering 45 would result in 1, and entering 180 would result in 0.
| tan || Tangent
|-
|-
| asin || Arcsine (inverse sine)
| asin || Arcsine (inverse sine) || Entering 0.5 would result in 30, and entering 0 would result in 0.
|-
|-
| acos || Arccosine (inverse cosine)
| acos || Arccosine (inverse cosine) || Entering 0.5 would result in 60, and entering 0 would result in 90.
|-
|-
| atan || Arctangent (inverse tangent)
| atan || Arctangent (inverse tangent) || Entering 1 would
|-
|-
| ln || Natural log (log base e)
| ln || Natural log (log base e) || Entering the [[e]] operator would result in 1, and entering 2 would result in a value around 0.693.
|-
|-
| log || Log base 10 || Entering 10 would result in 1, and entering 2 would result in a value that is around 0.301
| log || Log base 10
|-
|-
| e ^ || Exp function (e^x)
| e ^ || Exp function (e^x) || Entering 1 would result in e
|-
|-
| 10 ^ || Raises 10 to a specific power
| 10 ^ || Raises 10 to a specific power || Entering 3 would result in 1000, and entering 6 would result in 1000000.
|}
|}
==Workarounds==
==Workarounds==
e ^ and 10 ^ can be replicated by using the [[() (v) ()]] block, with 10 or the [[e]] reporter block as the first input, and "^" selected. ln and log can work around each other by using the change of base formula for logarithms, and can also be worked around using the () (v) () block with log selected.
e ^ and 10 ^ can be replicated by using the [[() (v) ()]] block, with 10 or the [[e]] reporter block as the first input, and "^" selected. ln and log can work around each other by using the change of base formula for logarithms, and can also be worked around using the () (v) () block with log selected. abs can be worked around using the sqrt option on the square of the number. sin(90 - x) = cos(x) and cos(90 - x) = sin(x), so those blocks can be used to workaround each other. tan(x) = sin(x)/cos(x), so that option can be worked around by using those other options.
{{DISPLAYTITLE:() of ()}}
{{DISPLAYTITLE:() of ()}}
[[Category:Vanilla Blocks]]
[[Category:Vanilla Blocks]]

Latest revision as of 21:04, 25 June 2024

() of ()
...
[[File:|200px]]
Caption
Block Type Reporter Block
Category / Extension Operators
Status Who tf uses status

The () of () block is a reporter block in the Operators category that allows for various functions to be used on a specific number. It originates from Scratch. All of the trigonometric functions are calculated in degrees.

Operator Description Example Default
abs Absolute value (distance of the number from 0) The distance of 3 and -3 from 0 would both be 3, and the distance of 0 from 0 would just be 0 Yes
floor Floor function (always rounds a decimal down) 4.5 becomes 4, 10.1 becomes 10, 13.9 becomes 13, and 9 stays as 9 No
ceiling Ceiling function (always rounds a decimal up) 4.5 becomes 5, 10.1 becomes 11, 13.9 becomes 14, and 9 stays as 9
sqrt Square root Entering 4 would return 2, and 16 would return 4.
sin Sine Entering 30 would result in 0.5, and 180 would result in 0
cos Cosine Entering 30 would result in around 0.866, and 180 would result in -1.
tan Tangent Entering 45 would result in 1, and entering 180 would result in 0.
asin Arcsine (inverse sine) Entering 0.5 would result in 30, and entering 0 would result in 0.
acos Arccosine (inverse cosine) Entering 0.5 would result in 60, and entering 0 would result in 90.
atan Arctangent (inverse tangent) Entering 1 would
ln Natural log (log base e) Entering the e operator would result in 1, and entering 2 would result in a value around 0.693.
log Log base 10 Entering 10 would result in 1, and entering 2 would result in a value that is around 0.301
e ^ Exp function (e^x) Entering 1 would result in e
10 ^ Raises 10 to a specific power Entering 3 would result in 1000, and entering 6 would result in 1000000.

Workarounds

e ^ and 10 ^ can be replicated by using the () (v) () block, with 10 or the e reporter block as the first input, and "^" selected. ln and log can work around each other by using the change of base formula for logarithms, and can also be worked around using the () (v) () block with log selected. abs can be worked around using the sqrt option on the square of the number. sin(90 - x) = cos(x) and cos(90 - x) = sin(x), so those blocks can be used to workaround each other. tan(x) = sin(x)/cos(x), so that option can be worked around by using those other options.