!Restored: Negative Numbers in GDL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-05-02 09:25 PM
Why does GDL not handle negative numbers?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-05-02 09:31 PM
Could you give us a little more detail, maybe some actual code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-05-03 10:30 AM
Forgive me if this seems obvious, but I am having trouble understanding the problem. Generally GDL has no trouble with negative numbers. Two exceptions are:
1. When a negative length is applied to a solid element; such as a slab with negative thickness.
2. When used as an argument in a VALUES statement. This is just a quirk which I get around by assigning the negative values to variables and putting those into the values list.
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-05-03 11:09 AM
Matthew wrote:I'm not sure if I understand your problem exactly here, but there is situations when you need to use ( ) when you work with negative values.
2. When used as an argument in a VALUES statement. This is just a quirk which I get around by assigning the negative values to variables and putting those into the values list.
But because I don't now when your got your problem, I can't test it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-05-03 06:00 PM
TurboGlider wrote:I haven't explored this fully. After I found the quick fix I moved on. But the situation is this:Matthew wrote:I'm not sure if I understand your problem exactly here, but there is situations when you need to use ( ) when you work with negative values.
2. When used as an argument in a VALUES statement. This is just a quirk which I get around by assigning the negative values to variables and putting those into the values list.
But because I don't now when your got your problem, I can't test it.
VALUES "for_example" -2, -1, 0, 1, 2Results in an error. Whereas:
n1 = -2 n2 = -1 VALUES "for_example" n1, n2, 0, 1, 2Works just fine. I believe it is because operations are not supported within the values list and it interprets the minus sign as part of a subtraction.
Are you saying that the same result can be achieved with parentheses?
Like this:
VALUES "for_example" (-2), (-1), 0, 1, 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-05-03 08:22 PM
Karl
AC 28 USA and earlier • macOS Sequoia 15.2, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-05-04 02:26 AM
Karl wrote:Thanks Karl. That seems a little cleaner.
Yes, parentheses are the solution.
Karl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-05-04 08:28 AM
I have reported (and documented on selfgdl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-05-09 08:32 PM
Temp = -0'-1.0000" - -0'-3.0000"
When you make a variable called Temp with -1 minus -3, GDL gives an error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-05-10 03:21 AM
-0'-1.0000" - (-0'-3.0000")
Does that work?