desperate over math anomily

desperate over math anomily

Anonymous
Not applicable
414 Views
4 Replies
Message 1 of 5

desperate over math anomily

Anonymous
Not applicable

surely 3.6 x 20 = 72

 

 

Command: (setq watts (* (/ seglen 1000) stwts))
60.0

Command: !seglen
3600

Command: !stwts
20.0

 

this does not help

 

Command: (setq watts  (fix (* (/ seglen 1000) stwts)))
60.0

Command: !seglen
3600

Command: !stwts
20.0

 

this works fine as it should then why does the above not work? I must be missing something!!!!!

 

Command: (setq twatts (fix (* (/ fixlgth 1000) stwts)))
240

Command: !fixlgth
12000

Command: !stwts
20.0

0 Likes
415 Views
4 Replies
Replies (4)
Message 2 of 5

phanaem
Collaborator
Collaborator
The result of integers division is integer
(/ 3600 1000) -> 3
Try
(setq watts (* (/ seglen 1000.0) stwts))
Message 3 of 5

Anonymous
Not applicable

YES I have just solved it myself and came on here to post that, by fluke I tried 1000.0 and it worked much to my surprise but thank you so much for solving it too if I had not managed it by fluke I would still be struggling without your post!

0 Likes
Message 4 of 5

stevor
Collaborator
Collaborator

If using 2 integer ariables, ie, symbols, you can add a 1.0 to the argunements: (/ IntVar1 IntVar2 1.0) I think.

S
0 Likes
Message 5 of 5

Kent1Cooper
Consultant
Consultant

@stevor wrote:

If using 2 integer ariables ... you can add a 1.0 to the argunements: (/ IntVar1 IntVar2 1.0) I think.


You think right.  Another approach is to turn either of them into a real number with the (float) function:

 

(/ IntVar1 (float IntVar2))

Kent Cooper, AIA
0 Likes