Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Borg

Pages: [1]
1
QB64 Discussion / Re: Math issue
« on: February 22, 2019, 10:12:08 am »
Why is it that I am just now learning about the problems inherent in floating point math and qb64? I wrote many engineering programs back in the 90's using QB45 with  a lot of math and the problem never surfaced. Maybe it's because it wasn't being checked by a really persnickity CNC machine.  They have no mercy in that regard.  Some of the stuff I wrote involved hydraulics, simple beam loading, various steam calculations and more. I still have the source code but it wont run on qb64 unless I go through and change all of the LOCATE statements as well as all the printer output and probably more. In those days Windows still supported DOS based EXE's. I think that ended with XP.

It's fun getting back into it now with qb64.

If anyone is interested I can post up some of the source code on that stuff. Too busy right now.

Again, thanks to you all for helping out.

2
QB64 Discussion / Re: Math issue
« on: February 21, 2019, 09:02:46 pm »
Worked like a charm. You guys are geniuses.

3
QB64 Discussion / Re: Math issue
« on: February 21, 2019, 08:11:21 pm »
You have just given me an idea. I get the data in integer format and then convert to FPD by dividing by 10,000. I will try leaving the numbers as integers for the math, then converting to FPD.
Thanks for the idea.

4
QB64 Discussion / Re: Math issue
« on: February 21, 2019, 08:06:29 pm »
Thanks for helping.
Maybe I should back up a bit. This bit of code is part of a program that converts HPGL or .plt text files into G-Code text files. The PRINT statement is just for debugging. The values are converted to strings and written to a text file.  I do something similar to the PRINT USING to arrive at the proper number of decimal places but it truncates and does not round. A CNC machine will not even try to execute a command that is off by .0001". 

If I write a separate program that does nothing but execute that bit of code, it gives me the correct answer. 
 
Again, thanks for trying to help me.


5
QB64 Discussion / Math issue
« on: February 21, 2019, 06:47:46 pm »
Doing a simple subtraction is giving me a weird answer.
This is the line of code and the if condition is met.
IF ex = gx THEN ra = ABS(gy - ey): PRINT "1"; ra; gy; ey: GOTO 1150
The PRINT statement is only for debugging.
The variable values are gy 13.7926, ey 13.4951
doing the math manually ra = .2975
The answer I get from the program is ra = .2974997

What am I doing wrong here?

Pages: [1]