See »The March of Progress« on
http://www.horstmann.com/
.
yeah, in my scripting language:
printf("%10.2f", x);
also typically, math functions can be used directly, like in:
y=sin(x);
or:
z=atan2(y, x)/TAU; //(TAU=2*PI)
or: ...
actually, as-is, these math functions are actually intrinsics, and
treated similar to operators by the VM (mostly for sake of higher
performance, as function-calls are more expensive, and these functions
may often appear in tight loops).
this also includes a few "uncommon" / "non-standard" math functions,
like "ssqrt" (signed square root), "spow" (signed power), mostly as
these are sometimes rather useful.
a cost though is that it isn't currently possible to override them,
though theoretically a person could write something like:
this.sin();
or:
MyClass.sin();
or:
packagename.sin();
or: ...
partly, as these don't invoke the intrinsic (which is specific to the
direct-function-call usage). (there are a few method-like intrinsics
though, mostly ".clone()" and ".toString()" and similar, so it isn't
really free-and-clear either).
(this issue may be resolved eventually, mostly as it would involve
nailing down some issues regarding scope, as currently scope isn't fully
nailed down before producing the bytecode, whereas these intrinsics are
handled in the front-end compiler).
actually, similarly, many things, like vector-math, are built in (note:
these types are value-types).
(using the "non-canonical" declaration syntax):
vec3d a, b, c; //vec3(double)
a=#[1,0,0];
b=#[0,1,0];
c=a%b; //cross product, c=#[0,0,1]
double f; //canonical: "var f:double;"
f=a*b; //dot product
vector types: vec2/vec3/vec4/quat (float), vec2d/vec3d/vec4d/quatd
(double), where quat = quaternion.
well, there is also complex/fcomplex/dcomplex, which I guess also count
as vectors (complex=dcomplex, or "double complex").
....
granted, yes, a lot of this is a little closer to the core usage-domain
of the language (namely, stuff useful in 3D gaming).
or such...