The fact that Processing uses float rather than double has bothered me for a long time.
I found the actual code block in PdeEmitter.java, which is looping through an ANTLR generated AST:
// making floating point literals default to floats, not doubles
case NUM_DOUBLE:
final String literalDouble = ast.getText().toLowerCase();
out.print(literalDouble);
if (Preferences.getBoolean("preproc.substitute_floats")
&& literalDouble.indexOf('d') == -1) { // permit literal doubles
out.print("f");
}
dumpHiddenAfter(ast);
break;
This leads to a frustrating amount of incompatibility when convert Processing code to standard java (all decimal literals need f added to the end, or all floats need to be renamed to double).
It looks like this can be disabled in the lib/preferences.txt:
# preprocessor: PdeEmitter.java
preproc.substitute_floats = true
#preproc.substitute_image = false
#preproc.substitute_font = false
Nevertheless, this breaks common uses of the API, since all Processing API functions were written for float.
So why is float used everywhere? I can't imagine there being a large incentive for memory usage optimization in this type of application.