Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline janclaeys  
#1 Posted : 20 July 2021 00:17:15(UTC)
janclaeys


Rank: Member

Groups: Registered
Joined: 05/10/2016(UTC)
Posts: 20
Man
Belgium

Was thanked: 2 time(s) in 2 post(s)
Dear all,

I'm currently writing a basic cam profile generation program in SMath, see attachment below.
Today, I encountered a behaviour I can't explain:
* On the last page, I create some X and Y values
* For some reason, the calculated values in the augmented XY matrix are not correctly calculated
However, calculation is correct when I add an extra field that has nothing to do with the actual calculation (field marked in red)

What happens here?
* SMath error?
* Programming error on my side?

Thanks in advance for any feedback, I love SMath and I would like to finish the program.

Kind regards from Belgium,

Jan

Cam engine - problem.sm (74kb) downloaded 10 time(s).
Offline Razonar  
#2 Posted : 20 July 2021 01:35:50(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 791
Uruguay

Was thanked: 418 time(s) in 270 post(s)
Hi Jan. The problem is that SMath try to eval functions starting with if to true or false. You can prevent that behavior with line( ), as in the attached.

Cam engine - problem.sm (74kb) downloaded 11 time(s).

Best regards.
Alvaro.
thanks 1 user thanked Razonar for this useful post.
on 20/07/2021(UTC)
Offline janclaeys  
#3 Posted : 20 July 2021 10:45:07(UTC)
janclaeys


Rank: Member

Groups: Registered
Joined: 05/10/2016(UTC)
Posts: 20
Man
Belgium

Was thanked: 2 time(s) in 2 post(s)
Hi Alvaro,

Thank you very much for your feedback!
This is certainly something I wouldn't have discovered by myself: muchly appreciated!

p.s. the program isn't ready: the formulas at the last page don't create the required cam profile yet, working on it ;-)

Kind regards,

Jan
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.