exponentiate, exponentiate and assign

Forum for discussion about the documentation project.
thacket
Posts: 7
Joined: Sep 21, 2012 20:32

exponentiate, exponentiate and assign

Postby thacket » Sep 21, 2012 20:58

Hello to All,

I am not where to put this but I am translating some code from 'C' to 'FreeBasic'. Without going into detail, I had a couple of frustrating minute before I snapped to the problem:

Language Operator Function Label
C ^= XX ^= YY is XX = XX ^ YY is XX = (XX XOR YY) Bitwise XOR assignment
FreeBasic ^= XX ^= YY is XX = XX raised to the power of YY Exponentiate and assign

I am assuming there are a couple of other gotchas as well. I really like FreeBasic; is there a way to add something like this to the documentation? Also for the '^' operator documentation? Thanks for your time.

All the Best,
John
thacket
Posts: 7
Joined: Sep 21, 2012 20:32

Re: exponentiate, exponentiate and assign

Postby thacket » Sep 21, 2012 23:13

Let me try this again:

Code: Select all

Language    Operator    Function                                                  Label

    C          ^=       XX ^= YY   is   XX = XX ^ YY   is   XX = (XX XOR YY)      Bitwise XOR assignment
FreeBasic      ^=       XX ^= YY   is   XX = XX raised to the power of YY         Exponentiate and assign


I hope this is a little clearer. Thanks for your patience.

All the Best,
John
codeFoil
Posts: 255
Joined: Dec 22, 2011 4:45
Location: United States
Contact:

Re: exponentiate, exponentiate and assign

Postby codeFoil » Sep 22, 2012 0:22

Logical operators and operators for exponents and remainders are the most common differences between programming language families. When you're porting from one to another, it's a good idea to just keep the list of operators and their precedence handy. Check the wiki for the operator precedence page. All the operator are there.

In BASIC, arithmetic is usually performed with symbols (except mod), and logical and bitwise operations use keywords.
counting_pine
Site Admin
Posts: 6225
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: exponentiate, exponentiate and assign

Postby counting_pine » Sep 22, 2012 1:22

I suppose another Gotcha might be & and &= which perform concatenation instead of bitwise AND.
The pages for these operations can be found in wiki form where they can be edited. e.g. /wiki/KeyPgOpConcatConvert
counting_pine
Site Admin
Posts: 6225
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: exponentiate, exponentiate and assign

Postby counting_pine » Sep 22, 2012 3:52

TJF
Posts: 3601
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: exponentiate, exponentiate and assign

Postby TJF » Sep 22, 2012 6:12


Shall we really document C / C++ syntax in FreeBasic keyword Wiki pages? (It may confuse beginners.)

I think it's good to document syntax differences to get new translators started, but this shouldn't be done in an extra section.
thacket
Posts: 7
Joined: Sep 21, 2012 20:32

Re: exponentiate, exponentiate and assign

Postby thacket » Sep 22, 2012 15:18

Hello,

Thanks for the added notes on these operators; Not too verbose and not too sparse. In my opinion, a one or two sentence note is just right. If I run into other ones like that, I will let you know. I have no doubt that some definitions should not be modified. Take care.

All the Best,
John

Return to “Documentation”

Who is online

Users browsing this forum: No registered users and 2 guests