This version of the code has been updated to 6.3, but since the old version of the extension still works, then there is currently no need to release it to Netlogo. We want to keep the workload on the maintainers of NetLogo to a minimum.
Implement access to the Math library from inside Java. Many of these commands, such as expm1, log1p and hypot will produce better numerical accuracy than calculating them using expressions in code. The following summarizes the commands available.
e-- return the nearest double-precision floating-point number to the base of natural logarithmspi-- return the nearest double-precision floating-point number to pirandom-- return a random number in the range [0, 1[
abs-- return the absolute value of the argumentacos-- return the arc cosine of the argument in the range [0, pi]asin-- return the arc sine of the argument in the range [- pi / 2, pi / 2]atan-- return the arc tangent of the argument in the range [- pi / 2, pi / 2]cbrt-- return the cube root of the argumentceil-- return the smallest integer (as a double) greater than or equal to the argumentcos-- return the cosine of the argument (in radians)cosh-- return the hyperbolic cosine of the argumentdecrement-exact-- decrement the integer argument (by one), throwing an exception on integer underflowexp-- return the base of natural logarithm raised to the power of the argumentexpm1-- return one less than the base of the natural argument raised to the power of the argumentfloor-- return the largest integer (as a double) less than or equal to the argumentget-exponent-- return the exponent of the (double) argument (an integer)increment-exact-- increment the integer argument (by one), throwing an exception on integer overflowlog-- return the logarithm (base e) of the argumentlog10-- return the logarithm (base 10) of the argumentlog1p-- return the logarithm (base e) of the argument + 1negate-exact-- return the (integer) negation of the (integer) argument, throwing an exception on overflownext-down-- return the next double-precision floating-point number after the argument in the direction of negative infinitynext-up-- return the next double-precision floating-point number after the argument in the direction of positive infinityrint-- return the (double) integer closest to the argumentround-- return the closestintto the argument (which is cast to afloatfirst)signum-- return the sign of the argument in {0, -1, 1} (as doubles), for {zero, negative, positive} numbers respectivelysin-- return the sine of the argument (in radians)sinh-- return the hyperbolic sine of the argumentsqrt-- return the square root of the argumenttan-- return the tangent of the argument (in radians)tanh-- return the hyperbolic tangent of the argumentto-degrees-- convert the argument (in radians) to degreesto-int-exact-- convert the argument to an integer, throwing an exection on overflow (callsroundwithout casting tofloat, returning along, which is then converted to an integer)to-radians-- convert the argument (in degrees) to radiansulp-- returns the size of the 'units in the last place' of the argument
add-exact-- returns the integer sum of the two integer arguments, throwing an exception on overflowatan2-- returns the angle between the co-ordinate arguments (like NetLogo'satan) -- y-axis then x-axiscopy-sign-- returns the first argument with the sign of the second argumentfloor-div-- returns the largest integer less than or equal to the quotient of the (integer) argumentsfloor-mod-- returns the floor modulus of the integer argumentshypot-- returns the length of the hypotenuse formed from a right-angled triangle with two other sides of length the two argumentsieee-remainder-- returns the remainder after dividing the first argument by the second, as specified by the IEEE 754 standardmax-- returns the larger of the two argumentsmin-- returns the smaller of the two argumentsmultiply-exact-- returns the product of the two (integer) arguments, with exception on overflownext-after-- returns next double-precision floating-point number after the first argument in the direction of the secondpow-- returns the first argument raised to the power of the secondscalb-- returns the first argument multiplied by 2 raised to the power of the (integer) secondsubtract-exact-- returns the first argument minus the second, with exception on integer overflow
In this latest version I (DS) have included scripts for compilation, build and
execution of the extension. The scripts to achieve this are in the script
directory. There are in this directory as the compiled Java classes end up in
the bin directory. This is because the original author (GP) would have used an
IDE and IDE tend to wipe everything out in the bin directory (assumption of
authority). I have included scripts, because all this predicates is the
presence of javac and bash or zsh.
In addition I have added a few more documentation files, or howtos.
BUILD.md- instructions on how to build the extension using javac and bash/zsh.LICENSE- the licence under which this code is released - GPLv3PUBLISHING.md- how to get all this merged into the Netlogo extensions tabREADME.md- this filebin- the directory where the compiled class files are kept.lib- the libraries needed to build the jarmanifest.txt- the manifest for the contents of the jar.math.jardesc- ??? - presumably something to do with the IDE that was being used.netlogo- a reference program demonstrating use of the extension.scripts- compile, build and run scripts.src- the source files for the extension.zip- where the files are placed for use in publishing.