|
@@ -318,7 +318,7 @@
|
|
</argument>
|
|
</argument>
|
|
<description>
|
|
<description>
|
|
The natural exponential function. It raises the mathematical constant [b]e[/b] to the power of [code]s[/code] and returns it.
|
|
The natural exponential function. It raises the mathematical constant [b]e[/b] to the power of [code]s[/code] and returns it.
|
|
- [b]e[/b] has an approximate value of 2.71828.
|
|
|
|
|
|
+ [b]e[/b] has an approximate value of 2.71828, and can be obtained with [code]exp(1)[/code].
|
|
For exponents to other bases use the method [method pow].
|
|
For exponents to other bases use the method [method pow].
|
|
[codeblock]
|
|
[codeblock]
|
|
a = exp(2) # Approximately 7.39
|
|
a = exp(2) # Approximately 7.39
|
|
@@ -505,6 +505,8 @@
|
|
</argument>
|
|
</argument>
|
|
<description>
|
|
<description>
|
|
Returns [code]true[/code] if [code]a[/code] and [code]b[/code] are approximately equal to each other.
|
|
Returns [code]true[/code] if [code]a[/code] and [code]b[/code] are approximately equal to each other.
|
|
|
|
+ Here, approximately equal means that [code]a[/code] and [code]b[/code] are within a small internal epsilon of each other, which scales with the magnitude of the numbers.
|
|
|
|
+ Infinity values of the same sign are considered equal.
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="is_inf">
|
|
<method name="is_inf">
|
|
@@ -641,6 +643,7 @@
|
|
[codeblock]
|
|
[codeblock]
|
|
log(10) # Returns 2.302585
|
|
log(10) # Returns 2.302585
|
|
[/codeblock]
|
|
[/codeblock]
|
|
|
|
+ [b]Note:[/b] The logarithm of [code]0[/code] returns [code]-inf[/code], while negative values return [code]-nan[/code].
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="max">
|
|
<method name="max">
|
|
@@ -686,7 +689,9 @@
|
|
Moves [code]from[/code] toward [code]to[/code] by the [code]delta[/code] value.
|
|
Moves [code]from[/code] toward [code]to[/code] by the [code]delta[/code] value.
|
|
Use a negative [code]delta[/code] value to move away.
|
|
Use a negative [code]delta[/code] value to move away.
|
|
[codeblock]
|
|
[codeblock]
|
|
|
|
+ move_toward(5, 10, 4) # Returns 9
|
|
move_toward(10, 5, 4) # Returns 6
|
|
move_toward(10, 5, 4) # Returns 6
|
|
|
|
+ move_toward(10, 5, -1.5) # Returns 11.5
|
|
[/codeblock]
|
|
[/codeblock]
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
@@ -696,12 +701,17 @@
|
|
<argument index="0" name="value" type="int">
|
|
<argument index="0" name="value" type="int">
|
|
</argument>
|
|
</argument>
|
|
<description>
|
|
<description>
|
|
- Returns the nearest larger power of 2 for integer [code]value[/code].
|
|
|
|
|
|
+ Returns the nearest equal or larger power of 2 for integer [code]value[/code].
|
|
|
|
+ In other words, returns the smallest value [code]a[/code] where [code]a = pow(2, n)[/code] such that [code]value <= a[/code] for some non-negative integer [code]n[/code].
|
|
[codeblock]
|
|
[codeblock]
|
|
nearest_po2(3) # Returns 4
|
|
nearest_po2(3) # Returns 4
|
|
nearest_po2(4) # Returns 4
|
|
nearest_po2(4) # Returns 4
|
|
nearest_po2(5) # Returns 8
|
|
nearest_po2(5) # Returns 8
|
|
|
|
+
|
|
|
|
+ nearest_po2(0) # Returns 0 (this may not be what you expect)
|
|
|
|
+ nearest_po2(-1) # Returns 0 (this may not be what you expect)
|
|
[/codeblock]
|
|
[/codeblock]
|
|
|
|
+ [b]WARNING:[/b] Due to the way it is implemented, this function returns [code]0[/code] rather than [code]1[/code] for non-positive values of [code]value[/code] (in reality, 1 is the smallest integer power of 2).
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="ord">
|
|
<method name="ord">
|
|
@@ -1093,12 +1103,15 @@
|
|
</argument>
|
|
</argument>
|
|
<argument index="1" name="to" type="float">
|
|
<argument index="1" name="to" type="float">
|
|
</argument>
|
|
</argument>
|
|
- <argument index="2" name="weight" type="float">
|
|
|
|
|
|
+ <argument index="2" name="s" type="float">
|
|
</argument>
|
|
</argument>
|
|
<description>
|
|
<description>
|
|
- Returns a number smoothly interpolated between the [code]from[/code] and [code]to[/code], based on the [code]weight[/code]. Similar to [method lerp], but interpolates faster at the beginning and slower at the end.
|
|
|
|
|
|
+ Returns the result of smoothly interpolating the value of [code]s[/code] between [code]0[/code] and [code]1[/code], based on the where [code]s[/code] lies with respect to the edges [code]from[/code] and [code]to[/code].
|
|
|
|
+ The return value is [code]0[/code] if [code]s <= from[/code], and [code]1[/code] if [code]s >= to[/code]. If [code]s[/code] lies between [code]from[/code] and [code]to[/code], the returned value follows an S-shaped curve that maps [code]s[/code] between [code]0[/code] and [code]1[/code].
|
|
|
|
+ This S-shaped curve is the cubic Hermite interpolator, given by [code]f(s) = 3*s^2 - 2*s^3[/code].
|
|
[codeblock]
|
|
[codeblock]
|
|
- smoothstep(0, 2, 0.5) # Returns 0.15
|
|
|
|
|
|
+ smoothstep(0, 2, -5.0) # Returns 0.0
|
|
|
|
+ smoothstep(0, 2, 0.5) # Returns 0.15625
|
|
smoothstep(0, 2, 1.0) # Returns 0.5
|
|
smoothstep(0, 2, 1.0) # Returns 0.5
|
|
smoothstep(0, 2, 2.0) # Returns 1.0
|
|
smoothstep(0, 2, 2.0) # Returns 1.0
|
|
[/codeblock]
|
|
[/codeblock]
|
|
@@ -1114,7 +1127,7 @@
|
|
[codeblock]
|
|
[codeblock]
|
|
sqrt(9) # Returns 3
|
|
sqrt(9) # Returns 3
|
|
[/codeblock]
|
|
[/codeblock]
|
|
- If you need negative inputs, use [code]System.Numerics.Complex[/code] in C#.
|
|
|
|
|
|
+ [b]Note:[/b]Negative values of [code]s[/code] return NaN. If you need negative inputs, use [code]System.Numerics.Complex[/code] in C#.
|
|
</description>
|
|
</description>
|
|
</method>
|
|
</method>
|
|
<method name="step_decimals">
|
|
<method name="step_decimals">
|