How to use Double Point precision with spinner values and general question

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
How can I make it work such that every time a person enters a number into a spinner field that value is automatically set to double point accuracy to be used later on?
that way when I refer to it later, I know I am using a number with double point accuracy no matter what a user enters into the spinner?
I usually have refered to it later as SUDoubleSpinnerTest.value given my example below.
I have
preferences.spinnerPrecision = 10 ---dont think this is important for my question but this is what I have it set at...anyway with this:
(
spinner SUDoubleSpinnerTest "Double spinner Test:"fieldwidth:100 range:[0.0000000001,90000000000,66000.45328] align:#right type:#worldunits scale:.0000000001 enabled:true
)
in this case just saying
SUDoubleSpinnerTest.value as double ---doesnt seem to work
the number 66000.45328 is just and example
I also wanted to know if I still have to go through this procedure that is shown below to make sure my numbers really are double point or if just saying "as double" really makes it double point accuracy?
I read about it in a conversation which may or may not still be true that I read here.
http://forums.cgsociety.org/archive/index.php/t-690027.html
Bobo seemed to have the best solution at the time.
It is summarized here:
----------------------------------------------------------------------------
a = "1.23456789012345" --let's assume this is a string you got from a file
returns "1.23456789012345"
b = a+"d0" --turn it into a double by adding D and exponent of 0
returns "1.23456789012345d0"
c = execute b --convert to a value - now MAXScript knows it is a double
returns 1.23457d0
formattedPrint c format:".20g" --and it shows like one
returns "1.23456789012345" --so I know it seems to be seen as double by max
In my own script I have a loop that requires going through 5 different somewhat elaborate formulas and then looping it 100 times and the rounding off side affects of single point accuracy is creating cumulative errors.I am just learning this double point accuracy stuff. Any help is greatly appreciated. thanks