Last active
October 27, 2016 13:58
-
-
Save roryl/6edb0b617f29447556e515e4b7597281 to your computer and use it in GitHub Desktop.
Lucee Numeric Type
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
<cfscript> | |
myNumber = 13.5837265748372615; | |
writeDump(myNumber); | |
</cfscript> |
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
component { | |
public function init(){ | |
} | |
function checkValue(){ | |
} | |
public function onMissingMethod(){ | |
} | |
} |
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
<cfscript> | |
myNumber = 135837265748372615; | |
writeDump(myNumber); | |
</cfscript> |
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
<cfscript> | |
myNumber = "135837265748372615"; | |
writeDump(myNumber); | |
</cfscript> |
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
<cfscript> | |
myNumber = javaCast("java.math.BigInteger", "135837265748372615"); | |
writeDump(myNumber.toString()); | |
</cfscript> |
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
<cfscript> | |
BigInt = createObject("java", "java.math.BigInteger"); | |
firstNumber = BigInt.init("135837265748372615"); | |
secondNumber = BigInt.init("68584848283"); | |
result = firstNumber.add(secondNumber); | |
writeDump(result.toString()); | |
</cfscript> |
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
<cfscript> | |
//Create the BigInteger object first | |
BigInt = createObject("java", "java.math.BigInteger"); | |
//Create additional BigInteger objects by calling init() | |
firstNumber = BigInt.init("135837265748372615"); | |
secondNumber = BigInt.init("584858686827"); | |
writeDump(firstNumber.toString()); | |
writeDump(secondNumber.toString()); | |
</cfscript> |
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
<cfscript> | |
BigInt = createObject("java", "java.math.BigInteger"); | |
loops = 100000; | |
//Test 100,000 iterations of adding with BigInteger | |
firstNumber = BigInt.init("500"); | |
secondNumber = BigInt.init("400"); | |
timer type="outline" { | |
echo("Using java.math.BigInteger"); | |
for(i=1; i <= loops; i++){ | |
result = firstNumber.add(secondNumber); | |
} | |
} | |
//Test 100,000 iterations of adding with Lucee numeric | |
firstNumber = 500; | |
secondNumber = 400; | |
timer type="outline" { | |
echo("Using Lucee numeric"); | |
for(i=1; i <= loops; i++){ | |
result = firstNumber + secondNumber; | |
} | |
} | |
</cfscript> |
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
<cfscript> | |
myNumber = 2001; | |
writeDump(myNumber); | |
</cfscript> |
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
<cfscript> | |
myNumber = "2001"; | |
added = myNumber + 500; | |
writeDump(added); | |
</cfscript> |
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
<cfscript> | |
myNumber = "num2001"; | |
added = myNumber + 500; | |
writeDump(added); | |
</cfscript> |
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
<cfscript> | |
myNumber = 2001; | |
added = myNumber + 50; | |
multiplied = added * 1000; | |
writeDump(multiplied); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment