Editing Openlibm

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 72: Line 72:
}
}
</syntaxhighlight>
</syntaxhighlight>


*;Output Expected :  
*;Output Expected :  
Line 107: Line 108:
*;''Observations :''  
*;''Observations :''  


The expected output is not achieved by compiling the program with Openlibm. Also, the output is not consistent with systems and different compilers. Hence, the openlibm as a proposed solution to solve this bug has failed.
The expected output is not achieved by compiling the program with Openlibm. Also, the output is not consistent with systems and different compilers. Hence, the openlibm as a proposed solution to solve this bug has failed.


=== Testing of bug {{bug|62212}} ===
===Testing of bug {{bug|62212}}===
 
*;CODE SOURCE: [https://github.com/shreyaswikriti/BugTesting/blob/main/bug%2362212.cc C++ PROGRAM]
*;CODE SOURCE:
 
<syntaxhighlight lang="C++">
#include <cmath>
#include <iostream>
 
int main (void)
{
  double db_large_integer = std::pow (2., 64.);
  std::cout << "db_large_integer: " << db_large_integer << std::endl;
  uint64_t ui64_large_integer = db_large_integer;
  std::cout << "ui64_large_integer: " << ui64_large_integer << std::endl;
  return 0;
}
</syntaxhighlight>


*;Output Expected :  
*;Output Expected :  
Line 162: Line 148:
  On Ubuntu, openlibm failed to link when compiling. The expected output is not achieved by compiling the program with Openlibm. Even compiling with OpenLibm is not giving any difference to the output. Hence, the openlibm as a proposed solution to solve this bug has failed.
  On Ubuntu, openlibm failed to link when compiling. The expected output is not achieved by compiling the program with Openlibm. Even compiling with OpenLibm is not giving any difference to the output. Hence, the openlibm as a proposed solution to solve this bug has failed.


=== Testing of bug {{bug|62332}} ===
===Testing of bug {{bug|62332}}===
 
*;CODE SOURCE: [https://github.com/shreyaswikriti/BugTesting/blob/main/bug%2362332.cc C++ PROGRAM]
*;CODE SOURCE:
 
<syntaxhighlight lang="C++">
#include <iostream>
#include <cmath>
#include <complex>
#define cosd(x) (cos((x) * M_PI / 180))
int main()
{
    for(int i=1;i<=20;i++)
    { std::complex<double> x( cosd(45) , std::pow(10, -3*i) );
    std::cout << real(x)<<"+"<<imag(x)<<"i"<<"-->"<<real(acos(x))<<"+"<<imag(acos(x))<<"i"<< std::endl ;}
}
</syntaxhighlight>


*;Output Expected :  
*;Output Expected :  
Line 267: Line 239:
     0.707107+1e-57i-->0.785398+-0i
     0.707107+1e-57i-->0.785398+-0i
     0.707107+1e-60i-->0.785398+-0i
     0.707107+1e-60i-->0.785398+-0i
*;''Observations: ''
*;''Observations: ''
 
Compiling with the Openlibm is providing the output that we want to avoid. The expected output is not achieved by compiling the program with Openlibm. Hence, the openlibm as a proposed solution to solve this bug has failed.
Compiling with the Openlibm is providing the output that we want to avoid. The expected output is not achieved by compiling the program with Openlibm. Hence, the openlibm as a proposed solution to solve this bug has failed.
                   
 
 
==Conclusion==
==Conclusion==
The proposed solution is to use Openlibm as a replacement of libm to deal with the inconsistency in the maths library caused when Octave is compiled with libc++ (default on macOS) and sometimes with libstdc++ has failed and the bug issues and can not be solved with openlibm. Hence, there is a need to find an alternate solution to address this issue.
The proposed solution is to use Openlibm as a replacement of libm to deal with the inconsistency in the maths library caused when Octave is compiled with libc++ (default on macOS) and sometimes with libstdc++ has failed and the bug issues and can not be solved with openlibm. Hence, there is a need to find an alternate solution to address this issue.
Please note that all contributions to Octave may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Octave:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Template used on this page: