This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 257813 - Cosine
Summary: Cosine
Status: RESOLVED INVALID
Alias: None
Product: ide
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.1
Hardware: PC Windows 10
: P3 normal (vote)
Assignee: issues@ide
URL:
Keywords: API
Depends on:
Blocks:
 
Reported: 2016-02-01 22:32 UTC by henri127
Modified: 2016-02-03 16:01 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description henri127 2016-02-01 22:32:17 UTC
Product Version = NetBeans IDE 8.1 (Build 201510222201)
Operating System = Windows 10 version 10.0 running on amd64
Java; VM; Vendor = 1.8.0_72
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.72-b15

Reproducibility: Happens every time

STEPS:
  * Open dialog Foo
  * Click on button "Click me"

ACTUAL:
  nothing happens

EXPECTED:
  message pops up

The cosine function of Math package is redirected to the StrictMath package of GNU(?). I wonder why this is and not Clenshaw's rule is used for large arguments, i.e.:

cos(n*x) = 2*cos(x)*cos((n-1)*x)-cos((n-2)*x), see Numerical recipes in C page 178.

and use the following routine:

      public static double THRESHOLD = 500000.0;//example value
  /**
     * Compute cosine using Clenshaw's rule:
     * cos(n*x) = 2*cos(x)*cos((n-1)*x)-cos((n-2)*x)
     * Numerical recipes, page 178, for n = 2
     * @param r
     * @return 
     */
    public static double cos(double r){
        if (Math.abs(r) < THRESHOLD) {
            return Math.cos(r);
        } else {
            double cos2 = cos(r/2.0);
            return 2.0*cos2*cos2-1;
        }
    }
Comment 1 Jiri Prox 2016-02-03 16:01:33 UTC
Unfortunately this issue is not related to Netbeans IDE