Evaluate - Expression editor - Length

the following function doesn’t work in Evaluate item - Expression editor at Length(a) expression function:
{(x/y/z/u/v/w), Length(a)}

error message:

  1. Expression generated an error for (x, y, z, u, v, w, a): Function Length is undefined for parameters: double

What could I to do?

best regards: Tibor

What is the length of a number?

Length only works for text (in which case it counts the characters that make up the text) or for vectors (in which case you get the euclidean metric of the vector magnitude). Doesn’t work for numbers.

Thanks David,
oh…I understand. :frowning:
The basic decimals of result is 8 numbers.
How could I get the results in 30 decimals or more, when I work with fractions?

I don’t quite follow. Grasshopper uses double-precision floating point maths for decimal values, and you typically only get about 16 decimal places, along with a order-of-magnitude scaling factor.

It’s best to think of all (non-integer) numbers as a template along these lines:

\pm \underbrace{x.xxxxxxxxxxxxxxx}_{16 \hspace{1mm} digits} \cdot 10^{\pm yyy}

You have to choose the two signs (the first one tells you whether the number as a whole is positive or negative, the second whether you’re dealing with a small or a large number). You also have to specify 16 digits in the mantissa and three digits in the exponent (but yyy can’t be bigger than ~300).

So in this scheme, the value 1.0 would be written as +1.000000000000000 \cdot 10^{+0}, two-hundred-and-fifty looks like +2.500000000000000 \cdot 10^{+2}, and negative-80-million looks like -8.000000000000000 \cdot 10^{+7}.

Furthermore, due to the inflexible nature of this kind of number and the fact that you sometimes cannot represent a value exactly, the last few digits ought not be trusted. So perhaps it’s better to say the template looks like:

\pm \underbrace{x.xxxxxxxxxxxx}_{significant}\underbrace{xxx}_{junk} \cdot 10^{\pm yyy}

So you do some calculations and the answer should have been 0.075, what you actually get is +7.500000000000017 \cdot 10^{-2}


Grasshopper does not have support for other kinds of numbers such as fractions or symbolics or polynumbers. Every number is either a 32-bit integer or a 64-bit floating point value as described above.