Sha256: 1e8f4c5b58c04bd57b4e946d6c1f7e8c0d726811e93c5f450da1a879f7d616e8

Contents?: true

Size: 785 Bytes

Versions: 10

Compression:

Stored size: 785 Bytes

Contents

All Arithmetic in NSIS is handled by the [http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.10.2 IntOp] instruction.  It is beyond the scope of this task to implement user input (a fairly involved task), so I will be providing hard-coded values simulating the user input, with the intention of later adding the user-input piece.
Function Arithmetic
	Push $0
	Push $1
	Push $2
	StrCpy $0 21
	StrCpy $1 -2
	
	IntOp $2 $0 + $1
	DetailPrint "$0 + $1 = $2"
	IntOp $2 $0 - $1
	DetailPrint "$0 - $1 = $2"
	IntOp $2 $0 * $1
	DetailPrint "$0 * $1 = $2"
	IntOp $2 $0 / $1
	DetailPrint "$0 / $1 = $2"
	DetailPrint "Rounding is toward negative infinity"
	IntOp $2 $0 % $1
	DetailPrint "$0 % $1 = $2"
	DetailPrint "Sign of remainder matches the first number"
	
	Pop $2
	Pop $1
	Pop $0
FunctionEnd

Version data entries

10 entries across 7 versions & 1 rubygems

Version Path
zettacode-0.1.7 files.zettacode/arithmetic.integer/nsis.txt
zettacode-0.1.6 files.zettacode/arithmetic.integer/nsis.txt
zettacode-0.1.6 files.zettacode2/arithmetic.integer/nsis.txt
zettacode-0.1.5 files.zettacode/arithmetic.integer/nsis.txt
zettacode-0.1.5 files.zettacode2/arithmetic.integer/nsis.txt
zettacode-0.1.4 files.zettacode/arithmetic.integer/nsis.txt
zettacode-0.1.4 files.zettacode2/arithmetic.integer/nsis.txt
zettacode-0.1.3 files.zettacode/arithmetic.integer/nsis.txt
zettacode-0.1.2 files.zettacode/arithmetic.integer/nsis.txt
zettacode-0.1.1 zettacode.files/arithmetic.integer/nsis.txt