Author Topic: Strange behaviours in ^  (Read 2582 times)

0 Members and 1 Guest are viewing this topic.

kryton9

  • Guest
Strange behaviours in ^
« on: June 27, 2011, 04:44:20 PM »
Here is code to test. Lines are marked if work and don't work.
Code: Text
  1. byte b = 8
  2.  
  3. 'this works
  4. print "line 1    " str( pow( 2, sizeof( char ) * b ) - 1 )
  5.  
  6.  
  7. byte s = ( sizeof( char ) * b )
  8.  
  9.  
  10. 'this works
  11. print 2^s
  12.  
  13. 'this doesn't work
  14. print 2^s "line 2"
  15.  
  16. 'this doesn't work
  17. print "line 3    " str( 2^s )
  18.  
  19. 'this doesn't work
  20. print "line 4    " str( 2^s - 1 )
  21.  
  22. 'this doesn't work
  23. print "line 5    " str( ( 2^s ) - 1 )
  24.  
  25. 'this doesn't work
  26. print "line 6    " str( ( 2^( sizeof( char ) * b ) ) - 1 )

Charles Pegge

  • Guest
Re: Strange behaviours in ^
« Reply #1 on: June 27, 2011, 08:36:04 PM »

It seems that it does not interpret integer exponents correctly Kent

Working in floats is okay. And also pow(2,v) works correctly

'Print' does not autoconvert numbers to strings when the first term is a number. But that should also be fixable.

Thanks.

Charles

Charles Pegge

  • Guest
Re: Strange behaviours in ^
« Reply #2 on: June 28, 2011, 03:31:14 PM »

Ive done quite a lot today so I hope that most of the bugs you found have been cleared in the process.

Code: [Select]

7:02 28/06/2011  Fix assign operator for quads and float types: if f :=42 then ...
08:45 28/06/2011  Allow first term number to string autoconversion: print 1 " m/s"
11:28 28/06/2011  Fix attribute : typeof(string)      (disambiguation from string() function)
12:36 28/06/2011  Fix Power autoconversion: a=b^c
14:15 28/06/2011  Relax need for brackets around named params: fun a=6, b=7
14:52 28/06/2011  Allow simple function calls to be delimited by commas: main funA,FunB, FunC
21:57 28/06/2011  Revoke implicit comments ===== ------
23:11 28/06/2011  Fix static array elements
00:02 29/06/2011  Fix Himac closing bracket

Now for the luxury of sleep :)

Charles

kryton9

  • Guest
Re: Strange behaviours in ^
« Reply #3 on: June 28, 2011, 04:40:50 PM »
Thanks Charles.