Guilty as charged

For other topics related to the FreeBASIC project or its community.
Kuron
Posts: 30
Joined: Jul 26, 2005 3:22
Location: Nashville

Re: Guilty as charged

Postby Kuron » Oct 12, 2017 6:38

how on earth are you going to be able to pay that bill off?


We are looking for a lawyer to sort this mess, as her ex-employer is in direct violation of her retirement contract.

I am still not sure what is up with your health, but if you have something terminal and you want your work online after you are gone, I am happy to oblige. It will not cost me anything.
dodicat
Posts: 5159
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Guilty as charged

Postby dodicat » Oct 12, 2017 10:10

owen wrote:my code is not correct continued... i'm guilty as charged.
tell me what's wrong with these 3 functions. see what im saying. my way of think'n aint right.
i can't walk and talk and chew bubble gum at the same time. i'm get'n old.

Code: Select all


Function mymod(n As Double,m As Integer) As Double
...
...


Hi owen.
your mymod function looks like the fmod function from crt.bi (which can accept doubles for each parameter if required)

However some have different signs.
About 22 key presses down I get
0.5456991028040648 -0.5456991028040648

Code: Select all

#include "crt.bi"

Function mymod(n As Double,m As Integer) As Double
   Select Case n
      Case 0
         mymod = 0
      Case CDbl(m)
         mymod = CDbl(m)
      Case Else
         If InStr(Str(n),"e")<>0 Then
            mymod=0
         Else
            If InStr(Str(n),".")<>0 Then
               mymod=Val(Str(val(Mid(Str(n),1,InStr(Str(n),".")-1)) Mod m)+"."+Mid(Str(n),InStr(Str(n),".")+1))
            Else
               mymod = (n Mod m)
            EndIf
         End If
   End Select
End Function



do
    var z=rnd*100-rnd*100
    var n=int(rnd*100)
print mymod(z,n);"    ";
print fmod(z,n)
sleep
loop until inkey=chr(27)

 
fxm
Posts: 8350
Joined: Apr 22, 2009 12:46
Location: Paris (suburb), FRANCE

Re: Guilty as charged

Postby fxm » Oct 12, 2017 10:45

That may correspond to the runtime error 11 ("floating point error" signal), when the divisor is null (n=0) !
dodicat
Posts: 5159
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Guilty as charged

Postby dodicat » Oct 12, 2017 10:59

But even avoiding division by zero there are frequent differences.

Code: Select all

#include "crt.bi"

Function mymod(n As Double,m As Integer) As Double
   Select Case n
      Case 0
         mymod = 0
      Case CDbl(m)
         mymod = CDbl(m)
      Case Else
         If InStr(Str(n),"e")<>0 Then
            mymod=0
         Else
            If InStr(Str(n),".")<>0 Then
               mymod=Val(Str(val(Mid(Str(n),1,InStr(Str(n),".")-1)) Mod m)+"."+Mid(Str(n),InStr(Str(n),".")+1))
            Else
               mymod = (n Mod m)
            EndIf
         End If
   End Select
End Function


dim as long c
do
    c+=1
    var z=rnd*100-rnd*100
    var n=int(1+rnd*100)
'print mymod(z,n);"    ";
'print fmod(z,n)
if sgn (mymod(z,n))<>sgn(fmod(z,n)) then
    print c,mymod(z,n),fmod(z,n)
end if
sleep 1
loop until inkey=chr(27)



 
fxm
Posts: 8350
Joined: Apr 22, 2009 12:46
Location: Paris (suburb), FRANCE

Re: Guilty as charged

Postby fxm » Oct 12, 2017 12:18

Code: Select all

Function mymod(n As Double,m As Integer) As Double
   Select Case n
      Case 0
         mymod = 0
      Case CDbl(m)
         mymod = CDbl(m)
      Case Else
         If InStr(Str(n),"e")<>0 Then
            mymod=0
         Else
            If InStr(Str(n),".")<>0 Then
               dim as double _mymod
               _mymod=Val(Str(val(Mid(Str(n),1,InStr(Str(n),".")-1)) Mod m)+"."+Mid(Str(n),InStr(Str(n),".")+1))
               if n<0 and _mymod>-1 then  '' in this case, the sign is lost
                  _mymod *= -1
               end if
               mymod = _mymod
            Else
               mymod = (n Mod m)
            EndIf
         End If
   End Select
End Function
owen
Posts: 475
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Guilty as charged

Postby owen » Oct 12, 2017 13:01

mymod function was a bit of overkill and perhaps n-fix(n) is a better solution.
viewtopic.php?f=3&t=25690

i think my line of thought at the time was to force the decimal points of n.123 mod m to n mod m + .123 to be just that and nothing else for a specific reason which i think had something to do with my dxf files and or dimension feature.

i totally abused the use of mymod through out the entire program and for those who continue to work on fbcadcam i would recommend rewriting the function in such as a way as to not use string manipulation such as i did.

the mymod function serves as explanation as to why i am guilty as charged.
owen
Posts: 475
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Guilty as charged

Postby owen » Oct 12, 2017 13:06

@ Kuron
it would be my pleasure to hand the keys to you. call me or email me anytime.
fxm
Posts: 8350
Joined: Apr 22, 2009 12:46
Location: Paris (suburb), FRANCE

Re: Guilty as charged

Postby fxm » Oct 12, 2017 13:50

I only showed the error by modifying as little as possible the existing code (without making any judgment).
owen
Posts: 475
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Guilty as charged

Postby owen » Oct 12, 2017 13:57

my special requests for whoever ends up with the keys are:

side note (first): of course we can't take anything with us when we leave but we can leave our stuff with friends.

i want to be remembered as a free man :
who at one time expressed himself in FB _
who thought that inspiring others to be creative was keen _
who figured out a bit of math without any formal education _
who was kind at times and cared about people.
owen
Posts: 475
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Guilty as charged

Postby owen » Oct 12, 2017 14:13

@ srvaldez

sometimes G~D uses drastic measures to get one's attention, hopefully this will lead you closer to him, but I would still like to read from you when the situation is resolved.


that was a very thoughtful thing to say.

my situation was resolved 2017 years ago and i'm perfectly ok with it.
owen
Posts: 475
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Guilty as charged

Postby owen » Oct 12, 2017 14:40

@ Trinity
Sorry to hear that you are in what sounds to me like a bad situation.
But I have to say as for the attitude that you seem to express then what I have learned is that "giving up"/loosing spirit" is generally not a beneficial attitude and it will generally not help or solve any problems.


for me this isn't about giving up / loosing spirit or a matter of solving problems.
it's a way to address the inevitable problem that we all face.

time is a funny thing, you see.
at one time i thought about working on some AI stuff but gave up on it before i even started because it was just that -"R" (yes that minus sign is a "NOT") ie. AI= -R
The equation for R is:
R=NOW

R time to do what we can, however we chose to, and my choice is to do something R and that something is to prepare to hand the keys over.

ps i think you shoul have a copy of the keys too because you got the right stuff. maybe you guys will sort out who gets what keys to fbcadcam.
oh, btw fb community, don't forget about discussing ahead of time, the keys to FB
St_W
Posts: 1379
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Guilty as charged

Postby St_W » Oct 12, 2017 14:53

@owen: I don't know how your current hosting solution looks like and especially who will pay for the hosting after you give it away, but IMHO a site hosted on the freebasic.net server would be decent solution. You'll get a subdomain like "fbcadcam.freebasic.net" in that case. See http://www.phatcode.net/hosting.php for details. Contact @Plasma if you're interested - I'm sure you'll get a suitable hosting environment.
grindstone
Posts: 556
Joined: May 05, 2015 5:35
Location: Germany

Re: Guilty as charged

Postby grindstone » Oct 12, 2017 15:16

St_W wrote:a site hosted on the freebasic.net server would be decent solution.
I would say, this wolud be the best place for fbcadcam to keep it alive.
owen
Posts: 475
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Guilty as charged

Postby owen » Oct 12, 2017 15:33

@ fxm
I only showed the error by modifying as little as possible the existing code (without making any judgment).


this is a perfect example of what makes FB special and unique.
for me, the FB community has never made any judgement about my code.
it might be because my view is by default (i might not know everything)
and i always maintained that view because i know that i'm kinda happy go lucky but in a determined way.

if im walking to the store to get a loaf of bread and i happen to see a rabbit, well, let me tell u what, i might chase it for a bit.
and when i come home without that loaf of bread i try to explain to my wife i was chasing constructive criticism and she has no idea what i'm talking about. the looks i get from her are priceless. the beating, well, that goes without saying.
owen
Posts: 475
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Guilty as charged

Postby owen » Oct 12, 2017 15:45

@ St_W
that's a thought and the fb community can make the choice.
i'm prepared to prepay for my existing hosting on bluehost and to provide cash to whoever takes the keys.
it's my thought (and i could be (not correct)) that fb would benefit by keeping fbcadcam on bluehost because it may help in the oogle ranks to hopefully steer others here.

Return to “Community Discussion”

Who is online

Users browsing this forum: Exabot [Bot] and 3 guests