wip authored by Frédéric Bapst's avatar Frédéric Bapst
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*Contents* *Contents*
<wiki:toc max_depth="1"/> <wiki:toc max_depth="1"/>
-------------------------------------------------- --------------------------------------------------
# 1. Introduction # 1 - Introduction
Welcome to COJAC, a tool that leverages in new ways the arithmetic Welcome to COJAC, a tool that leverages in new ways the arithmetic
capabilities of the Java programming language. capabilities of the Java programming language.
...@@ -14,7 +14,7 @@ Feel free to choose one of those acronym meaning: ...@@ -14,7 +14,7 @@ Feel free to choose one of those acronym meaning:
- `C`reating `O`ther `J`uicy `A`rithmetic `C`apabilities - `C`reating `O`ther `J`uicy `A`rithmetic `C`apabilities
- `C`hecking `O`verflows in `JA`va `C`ode - `C`hecking `O`verflows in `JA`va `C`ode
## 1.1 Overview ## 1.1 - Overview
COJAC is in fact a two-fold tool: COJAC is in fact a two-fold tool:
- a "numerical sniffer" that detects anomalies arising in arithmetic operations, - a "numerical sniffer" that detects anomalies arising in arithmetic operations,
...@@ -270,9 +270,11 @@ Java library (with the sad consequence that the "enrichment" is then lost). ...@@ -270,9 +270,11 @@ Java library (with the sad consequence that the "enrichment" is then lost).
The "arithmetic behavior" that is embedded in our richer number types includes: The "arithmetic behavior" that is embedded in our richer number types includes:
* the basic operations (addition, multiplication...) corresponding to the * the basic operations (addition, multiplication...) corresponding to the
bytecode instructions `dadd, dsub, dmul, ddiv, drem, dneg` bytecode instructions `dadd`, `dsub`, `dmul`, `ddiv`, `drem`, `dneg`
* the most common operations defined in `java.lang.Math`: `sqrt, abs, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, exp, log, log10, toRadians, toDegrees`. * the most common operations defined in `java.lang.Math`: `sqrt`, `abs`,
`sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `sinh`, `cosh`, `tanh`,
`exp`, `log`, `log10`, `toRadians`, `toDegrees`.
COJAC features a mechanism of *Magic Methods* that can be used to interact with COJAC features a mechanism of *Magic Methods* that can be used to interact with
the new enriched numbers. A magic method has an identifier starting with the new enriched numbers. A magic method has an identifier starting with
...@@ -337,9 +339,9 @@ Now, let's compute with twice as much significant numbers: ...@@ -337,9 +339,9 @@ Now, let's compute with twice as much significant numbers:
``` ```
prompt> java -javaagent:cojac.jar="-Rb 30" HelloMrCojac prompt> java -javaagent:cojac.jar="-Rb 30" HelloMrCojac
3.2323158094055926 3.23231580940559268732643345646441621673819 3.2323158094055926 3.23231580940559268732643345647
3.142591654339543 3.142591654339543050901127737252204566153538 3.142591654339543 3.14259165433954305090112773730
3.141593653588793 3.141593653588793239212643133279315384134670 3.141593653588793 3.14159365358879323921264313231
``` ```
... ...
......