Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with negative floats #40

Open
PLatCIC opened this issue Nov 6, 2024 · 3 comments
Open

Problem with negative floats #40

PLatCIC opened this issue Nov 6, 2024 · 3 comments
Labels

Comments

@PLatCIC
Copy link

PLatCIC commented Nov 6, 2024

When I added a float attribute with a range I could not get Visual Soar to accept it as correct. Here is the example showing the float attribute definition (I had said -0.99 and -0.01 and VS gets something approximate), then the line under referring to that that caused an error, and then the error messages (there were two of them for this line):

     threshold-neg: float [ -0.9900000095367432 - -0.009999999776482582  ]

     ^threshold-neg -0.1

     ...\find-my-neighbors(38): could not match constraint (<op>,threshold-neg,0) in production
     ...\find-my-neighbors(38): could not match constraint (<op>,threshold-neg,0.1) in production

In addition, in defining the float attribute it insisted that the left value had to be less than, or more negative in this case, than the right value. This is probably reasonable.

When I deleted the attribute and redefined it with no limits it worked fine.

@garfieldnate
Copy link
Contributor

Okay, -0.1 is clearly between -.99 and -.01, so that is definitely a bug.

I think in addition that we should be storing the datamap floats as BigDecimals, which would provide exact precision for the comparisons.

It's also interesting that we only support inclusive ranges, though I wouldn't implement exclusive end points unless someone asked for them.

@garfieldnate
Copy link
Contributor

Am I using the right Soar syntax?

sp {test-ranges
   (state <s> ^superstate nil)
-->
   (<s> ^foo -0.1)
}

The datamap errors I get are:

elaborate*goal-message: elaborations/top-state(10): could not match constraint (<s>,foo,0) in production
elaborate*goal-message: elaborations/top-state(10): could not match constraint (<s>,foo,0.1) in production

It seems like a production parsing error to me; I think that V-S thinks there are two floats here: -0 and .1. Or maybe it interpreted the - as something else and read the floats 0 and .1. Either one is wrong.

@PLatCIC
Copy link
Author

PLatCIC commented Nov 6, 2024

The Soar syntax looks good to me. I can't see what you have in the datamap, but those errors seem like part of the problem for this issue, as shown in the errors in the original issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants