-
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.
Introduces a new data type called Real64 to more easily deal with dec…
…imals. Real64 is based on Int64 and incorporates a SCALE factor that basically moves the decimal point by six positions to the right and rounds the result. This commit also adds more operations to the Vector3 type as well as more test cases.
- Loading branch information
Showing
6 changed files
with
374 additions
and
305 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as ZK3D from '../../build/src/index.js'; | ||
|
||
const n1 = ZK3D.Real64.from(0.123); | ||
const n2 = ZK3D.Real64.from(0.456); | ||
|
||
console.log(n1.toString()); | ||
console.log(n2.toString()); | ||
|
||
console.log('Testing addition...'); | ||
console.log('Adding n1 and n2...'); | ||
console.log(n1.clone().add(n2).toString()); | ||
|
||
console.log('Testing subtraction...'); | ||
console.log('Subtracting n2 from n1...'); | ||
console.log(n1.clone().sub(n2).toString()); | ||
|
||
console.log('Testing multiplication...'); | ||
console.log('Multiplying n1 and n2...'); | ||
console.log(n1.clone().mul(n2).toString()); | ||
|
||
console.log('Testing division...'); | ||
console.log('Dividing n1 by n2...'); | ||
console.log(n1.clone().div(n2).toString()); |
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
Oops, something went wrong.