[messages] [Module General Discussion] Some help with building custom code

Tom Russ taruss2000 at gmail.com
Tue Sep 10 16:02:53 MST 2013

Not necessarily.
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
double floats.

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:
> http://www.vassalengine.org/**forum/viewtopic.php?p=41994#**p41994<http://www.vassalengine.org/forum/viewtopic.php?p=41994#p41994>
> ______________________________**_________________
> messages mailing list
> messages at vassalengine.org
> http://www.vassalengine.org/**mailman/listinfo/messages<http://www.vassalengine.org/mailman/listinfo/messages>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vassalengine.org/pipermail/messages/attachments/20130910/94a969d1/attachment.html>

More information about the messages mailing list