... | ... | @@ -37,7 +37,8 @@ |
|
|
# 1 - Introduction
|
|
|
|
|
|
Welcome to COJAC, a tool that leverages in new ways the arithmetic
|
|
|
capabilities of the Java programming language.
|
|
|
capabilities of the Java programming language. The idea is summarized in
|
|
|
small demos on [YouTube](https://youtu.be/DqAFQfbWZOU?list=PLHLKWUtT0B7kNos1e48vKhFlGAXR1AAkF).
|
|
|
|
|
|
If you need a definition for the acronym "COJAC", feel free to choose one of
|
|
|
following:
|
... | ... | @@ -50,7 +51,7 @@ following: |
|
|
COJAC is in fact a two-fold tool:
|
|
|
|
|
|
- a **_"numerical sniffer"_** that detects anomalies arising in arithmetic operations,
|
|
|
on either integers (eg overflow) or floating point numbers (eg
|
|
|
on both integers (eg overflow) and floating point numbers (eg
|
|
|
cancellation or NaN outcome). This can be of great help to detect vicious bugs
|
|
|
involving annoying events that normally happen silently in the Java Virtual
|
|
|
Machine. See [§2](home#2-cojac-the-numerical-sniffer). This tool is pretty
|
... | ... | @@ -100,7 +101,7 @@ COJAC is offered (without warranty of any kind) in the hope it can be useful |
|
|
for educational purposes, as well as in the software industry.
|
|
|
|
|
|
You might be interested in the
|
|
|
[valgrind-based cousin](https://github.com/frederic-bapst/cojac-grind), a
|
|
|
[valgrind-based cousin](https://github.com/Cojac/cojac-grind), a
|
|
|
similar tool not limited to the Java world (it acts on any Linux binary).
|
|
|
|
|
|
The concept of _numerical problem sniffer_ is presented in our
|
... | ... | @@ -127,7 +128,8 @@ the problems. |
|
|
The COJAC sniffer tracks the following kinds of event:
|
|
|
|
|
|
* *Integer overflow*: the result is out-of-bounds for a `long` or `int` operation (an arithmetic operation, not the bit-shift operations). Examples: `3*Integer.MAX_VALUE, Integer.MIN_VALUE/-1`
|
|
|
* *Offending typecasting*: a value loses its essence after a type conversion. Examples: `(short) Long.MAX_VALUE, (int) Float.NaN`
|
|
|
* *Offending typecasting*: a value loses its essence after a type conversion. Examples: `(short) Long.MAX_VALUE, (int) Float.NaN`. We also detect loss
|
|
|
of precision when converting int-to-float or long-to-double (not included in release v1.4). Example: `(float)Integer.MAX_VALUE`
|
|
|
* *Smearing*: adding/subtracting a non-zero floating point number (float or double) has no effect because the two operands have excessively different orders of magnitude. Examples: `(342.0 + 1.0E-43), (342.0 - 1.0E+43)`
|
|
|
* *Cancellation*: two floating point numbers almost cancel each other after an addition or subtraction, so that the least significant bits (often noise) are promoted to highest significance. Example: `(3.000001f - 3.0f)`
|
|
|
* *Questionable comparisons*: two floating point numbers are being compared, but they are very close together. Example: `if (3.000001f >= 3.0f)...`
|
... | ... | @@ -550,7 +552,7 @@ Two nice tools to enrich Java arithmetic capabilities, on-the-fly: |
|
|
-Xs,--summary Print runtime statistics
|
|
|
-Xt,--stats Print instrumentation statistics
|
|
|
|
|
|
------> https://github.com/frederic-bapst/Cojac <------
|
|
|
------> https://github.com/Cojac/Cojac <------
|
|
|
```
|
|
|
|
|
|
--------------------------------------------------
|
... | ... | @@ -571,7 +573,7 @@ The sniffer part of COJAC is rather stable. Here are some limitations: |
|
|
* The tool targets the JVM only. We focus on Java, but it might be interesting
|
|
|
to try it on other JVM-equipped languages (Scala, Jython...). By the way, if
|
|
|
you dream of a numerical sniffer not limited to the Java world, have a look at
|
|
|
[cojac-grind](https://github.com/frederic-bapst/cojac-grind)...
|
|
|
[cojac-grind](https://github.com/Cojac/cojac-grind)...
|
|
|
|
|
|
## 5.2 - Issues with the wrapper
|
|
|
|
... | ... | @@ -617,10 +619,9 @@ the COJAC project: |
|
|
|
|
|
- Ruggiero Botteon and Diego Cavadini (for the very first pre-prototype)
|
|
|
- Baptiste Wicht (the major contributor, strong refactoring, testing - many thanks!)
|
|
|
- Maxime Reymond (for a nice Eclipse Plugin, now (temporarily?) discontinued)
|
|
|
- Maxime Reymond (for an Eclipse Plugin, now (temporarily?) discontinued)
|
|
|
- Vincent Pasquier (for switching to the "Java agent" technology)
|
|
|
- Luis Domingues (for some improvements in the Valgrind cousin Cojac-grind)
|
|
|
- Luis Domingues (for improving the Valgrind cousin Cojac-grind)
|
|
|
- Romain Monnard (without whom the "wrapping" would still be an unimplemented dream - many thanks!)
|
|
|
- Sylvain Julmy (for populating 3 "rich number" types)
|
|
|
- Lucy Linder (for improving the whole and preparing the release on GitHub)
|
|
|
|
|
|
- Lucy Linder (for improving the whole, preparing the release on GitHub, and much more - many thanks!) |