-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Cody Weaver
authored and
Cody Weaver
committed
Mar 5, 2024
1 parent
be621e2
commit bf14c81
Showing
6 changed files
with
63 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
app/src/main/java/com/android/pocketalchemy/util/NumberUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.android.pocketalchemy.util | ||
|
||
|
||
/** | ||
* operator function for addition of two Number | ||
* instances. Uses float addition under the hood. | ||
* @param other | ||
* @return The result of adding the receiver and | ||
* [other]. | ||
* | ||
* | ||
* NOTE: | ||
* From my research it seems that Floats, i.e. (32-bit Floating-Point Numbers) | ||
* will perform more consistently across all devices. It seems that some | ||
* mobile devices can perform 32-bit operations at much higher rates | ||
* compared to 64-bit floating-point operations, especially lower end hardware. | ||
* #TODO: Research this claim more. | ||
*/ | ||
operator fun Number.plus(other: Number): Number { | ||
return this.toFloat() + other.toFloat() | ||
} |