#395 ** (power) not same as * * * ... product

v3.8.2
closed-invalid
None
5
2014-06-23
2012-11-17
Anonymous
No

x ** n is defined as x * x * ,,, with n x's, but evidently Regina uses a different implementation of **. For example:

With source
-------------------------------
/* Regina math bug? */

parse version ver
say ver
say ' '

numeric digits 20
cuberoot_2 = 1.2599210498948731648

product = cuberoot_2 * cuberoot_2 * cuberoot_2
power = cuberoot_2 ** 3

say 'x*x*x = x**3 is' word('FALSE TRUE',(product=power)+1) 'for x=' cuberoot_2 'with NUMERIC DIGITS' digits()

exit
-------------------------------

The output is

-------------------------------
REXX-Regina_3.7(MT) 5.00 14 Oct 2012

x*x*x = x**3 is FALSE for x= 1.2599210498948731648 with NUMERIC DIGITS 20

Press ENTER key to exit...
-------------------------------

Discussion

  • Stefan Haubenthal

    REXX/imc-beta-1.75 4.00 25 Feb 2002

    x*x*x = x**3 is FALSE for x= 1.2599210498948731648 with NUMERIC DIGITS 20

    It works with NUMERIC DIGITS 19!

     
  • Paul Kislanko

    Paul Kislanko - 2014-06-22

    I think I was the "anonymous" here; in any case this is not a Regina bug.

    TRL2 explains this. "**" works the way it does to ensure that it gives the same result in every implementation. It is not necessarily true that it gives the same result as repeated multiplication.

     
    Last edit: Paul Kislanko 2014-06-22
  • Mark Hessling

    Mark Hessling - 2014-06-23

    Closed due to OP explanation

     
  • Mark Hessling

    Mark Hessling - 2014-06-23
    • status: open --> closed-invalid
    • assigned_to: Mark Hessling
    • Group: --> v3.8.2
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks