Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

multilpy and additions in one line of lua


Question

Posted (edited)

Hi

 

I have this code in vba Etime = y * sin2l0 - 2# * e * sinm + 4# * e * y * sinm * cos2l0 - 0.5 * y * y * sin4l0 - 1.25 * e * e * sin2m

 

which returns 2.19286480758148

 

However when i run this lua as follows Etime = y * sin2l0 - 2 * e * sinm + 4 * e * y * sinm * cos2l0 - 0.5 * y * y * sin4l0 - 1.25 * e * e * sin2m

 

I get a different result of -23.475237189689

 

Can anyone please guide me what I am doing wrong please?

 

Many thanks for any help provided.

 

 

Here are the variables with the correct numbers in both vba and in lua

y = 4.3027925017093

e = 1.6699503037352

sin2l0 -0.16774718359489
sinm -0.9503036952014
cos2l0 0.98583004741993
sin4l0 -0.33074042791581
sin2m 0.5917054702608
 

Edited by Jay Ess

6 answers to this question

Recommended Posts

  • 0
Posted

I wouldn't expect it, but could it be some missing ()  ?

  • 0
Posted
6 hours ago, Jay Ess said:

Can anyone please guide me what I am doing wrong please?

 

no idea, i see same result in

Please login or register to see this link.

as in LUA

 

Please login or register to see this attachment.

 

 

 

  • 0
  • Inquirer
  • Posted

    in lua i am getting the same results as you howver in a spreadsheet running this code i am getting 2.19286480758148E-02

    • 0
    Posted
    6 hours ago, Jay Ess said:

    I get a different result of -23.475237189689

     

    I get that a same number  Python

     

    Please login or register to see this code.

     

    15 minutes ago, Jay Ess said:

    howver in a spreadsheet running this code i am getting 2.19286480758148E-02

     

    Since Lua test 1  (you), Lua test 2 and Vb test 2 (tinman) and Python (my test) agree that it is about -23.5 I would suggest that your spreadsheet is not calculating the same thing.

    • 0
    Posted
    1 hour ago, Jay Ess said:

    in lua i am getting the same results as you howver in a spreadsheet running this code i am getting 2.19286480758148E-02

     

    legit S/N? :P

     

    image.png.500edf3444a0caa5f55d8ec9a7c7bde6.png

     

    image.png.c71872f5cf3c7b40595aebeb6ce69638.png

     

     

    • 0
  • Inquirer
  • Posted

    yes i know i think i am loosing the plot here, i hvae enclosed the spreadsheet file i am working on as something is definetly wrong here

     

    i am trying to replicate calcEquationOfTime(t)

    and it gives me a different value then what you are getting and what i am getting something is very weird here if you replicate the Etime you end up getting a different value

    Please login or register to see this attachment.

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...