Author Topic: CONST Does Not Allow SQR() Function To Be Used (in equation)  (Read 340 times)

CONST Does Not Allow SQR() Function To Be Used (in equation)
« on: April 25, 2019, 04:12:21 AM »
Invalid:
Code: QB64 [Select]
  1. CONST BallDiam%% = 80, PinRad%% = 7, Gap%% = 3, ViewSize% = 700, H! = (BallDiam%% + Gap%%) / SQR(2)

Acceptable:
Code: QB64 [Select]
  1. CONST BallDiam%% = 80, PinRad%% = 7, Gap%% = 3, SViewSize% = 700, H! = (BallDiam%% + Gap%%) / 1.41421356

I had thought that SQR() being an in-built function, the first method would have been acceptable.  I expected too much, therefore, from CONST?
« Last Edit: April 25, 2019, 09:18:52 AM by odin »

Offline FellippeHeitor

  • QB64 Developer
  • LET IT = BE
    • QB64.org
Re: CONST Does Not Allow SQR() Function To Be Used (in equation)
« Reply #1 on: April 25, 2019, 06:37:42 AM »
Version 1.3?

Re: CONST Does Not Allow SQR() Function To Be Used (in equation)
« Reply #2 on: April 25, 2019, 07:06:47 AM »
Would I be using anything else?!  Richard

Offline FellippeHeitor

  • QB64 Developer
  • LET IT = BE
    • QB64.org
Re: CONST Does Not Allow SQR() Function To Be Used (in equation)
« Reply #3 on: April 25, 2019, 07:49:28 AM »
Will be checked, thanks for reporting!

Re: CONST Does Not Allow SQR() Function To Be Used (in equation)
« Reply #4 on: April 25, 2019, 09:22:15 AM »
Confirm Richard's Invalid but the following does work with 2^.5 (= SQR(2) ) in parenthesis:
Code: QB64 [Select]
  1. CONST BallDiam%% = 80, PinRad%% = 7, Gap%% = 3, ViewSize% = 700, H! = (BallDiam%% + Gap%%) / (2 ^ .5)  
« Last Edit: April 25, 2019, 09:52:50 AM by odin »
B = B + ...

Re: CONST Does Not Allow SQR() Function To Be Used (in equation)
« Reply #5 on: May 06, 2019, 04:58:06 AM »
Even the following is not allowed:

Code: QB64 [Select]
  1. CONST BallDiam%% = 60, CornRad%% = 50, Bagatelle! = 0.8
  2. CONST B2! = Bagatelle!/(CornRad%% + 8 + BallDiam%% / 2)

Offline FellippeHeitor

  • QB64 Developer
  • LET IT = BE
    • QB64.org
Re: CONST Does Not Allow SQR() Function To Be Used (in equation)
« Reply #6 on: May 06, 2019, 05:32:30 AM »
Question: does it work if you let qb64 decide the types instead of forcing them with sygils (%%, etc)?

Re: CONST Does Not Allow SQR() Function To Be Used (in equation)
« Reply #7 on: May 06, 2019, 05:52:10 AM »
Code: QB64 [Select]
  1. CONST BallDiam = 60, CornRad = 50, Bagatelle = 0.8
  2. CONST B2 = Bagatelle/(CornRad + 8 + BallDiam / 2)

Still not allowed.

sygil?? A completely new word.  According to Google word definition and my Chambers 20th-Century Dictionary, "sigil" is an "inscribed or painted symbol considered to have magical power".  Magical powers?  That's QB64 every time.  It's sigil rather than sygil (which does look better, I agree) because it's from Latin not Greek.

Re: CONST Does Not Allow SQR() Function To Be Used (in equation)
« Reply #8 on: May 06, 2019, 06:54:01 AM »
And yet this does work:
Code: QB64 [Select]
  1. CONST BallDiam = 60, CornRad = 50, Bagatelle = 0.8
  2. CONST B2 = Bagatelle / (CornRad + 8 + (BallDiam / 2))

Also SQR(2) itself is OK:
Code: QB64 [Select]
  1. CONST sqr2 = SQR(2)
  2. CONST BallDiam%% = 80, PinRad%% = 7, Gap%% = 3, ViewSize% = 700
  3. CONST H! = (BallDiam%% + Gap%%) / sqr2
  4.  
« Last Edit: May 06, 2019, 06:59:10 AM by bplus »
B = B + ...

Offline FellippeHeitor

  • QB64 Developer
  • LET IT = BE
    • QB64.org