Notifications
Clear all

[Closed] mxs: using "double"s in max9

I wanted to try calculations using doubles. The docs mentions

1.0d
0.5d0

I hit F11 and checked: 1.0d is not accepted – 1.0d0 is … hm ok. What does the 0 stand for?
d1, d2,d4 – no visible effect …
Then I tried a stuff like this 0.3443d0 but the listener cuts the value – even more than using normal numbers. Then i thought: maybe its internal, so i tried to output as string but the d is included.

Who can enlighten me about how to do calculations with doubles in mxs?
thx

2 Replies

d is EXPONENTIAL QUALIFIER.

So d0 means double, multiplied by 10 to the power of 0 (which is 1)
1.0d1 -> 10.0d0
1.0d2 -> 100.0d0
1.0d3 -> 1000.0d0

1.0d is wrong and cannot be entered because the parser expects the exponent after the d. No idea how it came (it was copied from the developer’s submission)

So this is similar to 1.0e0, 1.0e1, 1.0e2, 1.0e3 etc, but the result is a double instead of a single precision value.

Keep on using 123d0 whenever you want to specify a double. The result will also be double and will be denoted with d and a positive or negative exponent.

0.00000123456d0 * 1234567890987654321.0d0
->1.52415d+012

1 Reply
(@pjanssen)
Joined: 11 months ago

Posts: 0

Hmm could you explain that please? I don’t really see a difference in 1.0e0 and 1.0d0