[messages] [Module General Discussion] Some help with building custom code
taruss2000 at gmail.com
Tue Sep 10 16:02:53 MST 2013
0.1 is not exactly representable as a binary fraction, so you wouldn't have
any guarantees as to the number of decimal places that a floating point
number will occupy. That can only really be done by formatting the
resulting numbers, which is not really something supported by Vassal, AFAIK.
Binary floating point can be really surprising in the way that it works.
In fact, it will likely have the same results as what you see in Python.
Now Java happens to have decimal numbers as well, which you may be able to
use in beanshell, although it would be less convenient than using int or
On Tue, Sep 10, 2013 at 3:00 PM, capi3101 <capi3101a at netscape.net> wrote:
> ...and I don't know Java either. I know Python, though, and I've got
> enough knowledge of programming to know that the big difference between
> programming languages is the syntax.
> So in Python, I'd recast something to a float by saying (float); that
> would give then give me a number with a gazillion decimal points, which
> I would then narrow down a bit. Now, my understanding is that I could
> achieve what I wanted in Java - a number with a single decimal point -
> by multiplying one of the numbers by 0.1 first. Is that correct? I
> haven't actually tried this...
> Read this topic online here:
> messages mailing list
> messages at vassalengine.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the messages