Exponential operator

HI all
What is the use of PL/SQL exponential operator (**). Where it is used??

http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/functions112.htm#SQLRF00689
And, Oracle documentation library should be your very best friend:
http://download-east.oracle.com/docs/cd/B19306_01/index.htm

Similar Messages

  • Exponentail operations using BIGDECIMAL

    hi all
    Can u someone provide me links, notes, codes and suggestions to perform exponential operations using BigDecimal.
    Thankz in advance
    Arun :)

    If you require greater precision than double provides
    and your exponent is integer try
    Google [
    [url=http://www.google.com/search?hl=en&ie=UTF-8&q=squa
    e+and+multiply&btnG=Google+Search]square and
    multiply ]Good point. I forgot the obvious. m^2 = m * m, etc.

  • Pop from stack and store to char?

    I am trying to write an infix to postfix prgm and when i compile i get:
    ListOperations3.java:143: incompatible types
    found : java.lang.Object
    required: char
    topOp = oStack.pop();
    because apparently the built in stacks use generic objects as a return type and thats incompatible with char. How can i pop from the stack to a char?
    Here is a method where the problem arises:
    public void Parenthesis(){
    char ch;
    char topOp;
    while(!oStack.isEmpty()){
    topOp = oStack.pop();
    if(ch == '(')
    break;
    else
    postFix = postFix + ch;
    }

    This is one of the classes that contains the options for a menu. The other two classes dont have any real
    impact on the code so I'm not gonna post them.
    import java.util.*;
      import java.io.*;
      import javax.swing.*;
      import java.lang.*;
        public class ListOperations3{
          public String postFix = "";  
          public String expression = "";
          Scanner scan;
          Stack oStack = new Stack();
          char ch;
           public ListOperations3(Scanner scan){
             this.scan  = scan;
           public void menu(){
             char option;
             String message;
             int score;
             Screen scr = new Screen ();
             scr.clearscreen ();
             scr.movedown (10);
             DisplayMenu3 menu = new DisplayMenu3();
             menu.printmenu ();
             do {
                scr.movedown (2);
                scr.moveright (15);
                System.out.print ("Enter an option: 0 for Menu, Q to quit");
                message = scan.next();
                option = message.charAt(0);
                switch (option) {
                   case '0':     scr.clearscreen ();
                      scr.movedown (10);
                      menu.printmenu ();
                      break;                           
                   case '1': //Accept infix expression from user
                      expression = JOptionPane.showInputDialog("Please enter an expression using variables(A-Z):\t");
                      expression = expression.toUpperCase();
                      expression = expression.replaceAll(" ", "");
                      break;                           
                   case '2':// Convert to postfix expression
                      scr.clearscreen ();
                      String postfix = InToPost(expression); 
                   case '3': // Evaluate postfix expression
                      break;                           
                   case 'q':   
                      break;
                   case 'Q':  
                      break;    
                   default:     scr.clearscreen ();
                      scr.movedown (10);
                      scr.moveright (15);
                      System.out.println ("Invalid option");
                      scr.movedown (5);
                      menu.printmenu ();
                      break;
                }// switch
             } // do
             while (option != 'Q'&& option != 'q');
             scr.clearscreen ();
             scr.movedown (10);
             scr.moveright (15);
             System.out.println("Thank you for using this program ");
             scr.movedown (3);
             scr.moveright (15);
             System.out.println("Have a nice day");
          } // main method             
           public String InToPost(String infix){
             for (int i = 0; i < infix.length(); i++) {
                ch = infix.charAt(i);
                switch(ch){                    
                   case '+'://It's addition
                      Operator(ch, 1);
                      break;
                   case '-'://It's subtraction
                      Operator(ch, 1);
                      break;                            
                   case '*'://It's multiplication
                      Operator(ch, 2);
                      break;
                   case '/'://It's division
                      Operator(ch, 2);
                      break;                            
                   case '^'://It's exponential
                      Operator(ch, 3);
                      break;                            
                   case '('://It's a left parenthesis
                      oStack.push(new Character(ch));
                      break;                            
                   case ')'://It's a right parenthesis
                      Parenthesis();
                      break;                            
                   default://It's an operand
                      postFix = postFix + ch;
                      break;                                    
             return postFix;
           public void Operator(char thisOp, int thisPrec){
             int topPrec;
                char topOp;
             while (!oStack.isEmpty()){
               Character c = oStack.pop();
                topOp = c.charValue();           
                if(topOp == '('){
                   oStack.push(new Character(topOp));
                   break;
                else {
                   if(topOp == '+' || topOp == '-')
                      topPrec = 1;
                   else if(topOp == '*' || topOp == '/')
                      topPrec = 2;
                   else if(topOp == '^')
                      topPrec = 3;
                   if(topPrec < thisPrec){
                      oStack.push(new Character(topOp));
                      break;
                   else
                      postFix = postFix + topOp;
             oStack.push(new Character(topOp));   
           public void Parenthesis(){
                char topOp;
             while(!oStack.isEmpty()){
               Character c = oStack.pop();
                topOp = c.charValue();
                if(topOp == '(')
                   break;
                else
                   postFix = postFix + topOp;
       }// class NewBasicMenu <code class="jive-code jive-java">

  • Expression node

    What is the correct syntax for an exponent with the expression node?
    I looked in LabVIEW help, and it looked like it was the '^' character,
    except that doesnt appear to be correct:
    The correct output should be 2, but LabVIEW returns 3.
    Cory K
    Solved!
    Go to Solution.

    Darin.K wrote:
    That is easily in my top 2 or 3 LV pet peeves.  I use exponentiation countless times and the next time I use bit-wise XOR in a LV text formula will be my first.  Why couldn't LV be like every other program/language I have used and use ^ for exponentiation?
    Define your definition of every other programming language!
    There are Ada, Bash, COBOL, Fortran, FoxPro, Gnuplot, OCaml, Perl, PL/I, Python, Rexx, Ruby, SAS, Seed7, Tcl, ABAP, Haskell (for floating-point exponents), Turing, VHDL which do just as LabVIEW, Algol, Commodore BASIC which use a special symbol ↑, and some like Java who don't even have a special exponentiation operator, but require the call of a math library function.
    BASIC, J, MATLAB, R, Microsoft Excel, TeX (and its derivatives), TI-BASIC, bc (for integer exponents), Haskell (for nonnegative integer exponents), Lua, ASP and most computer algebra systems do use indeed the ^ symbol, but in Bash, C, C++, C#, Java, JavaScript, Perl, PHP, Python and Ruby, the symbol ^ is used for the XOR operator and the LabVIEW formula node borrowed a lot of syntax from C and is in its current incarnation in fact a limited C syntax environment, so that leaves the ^symbol not available for the exponentiation anymore.
    Also I would say that LabVIEW is indeed more a programming language and not a computer algebra system.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Arithmetic with large numbers

    Hi
    I am developing code to find the poisson distribution. It contains computations with large scale decimal values
    The below is the formula to find the poisson distribution.
    (exp(-Rate)* Power(Rate, Count)/ Factorial(Count));
    But the problem here is if the value of the rate increases the exp(-rate) value will be reaching towards zero.
    Since double is of 8 bytes it's rounding off to zero after a certain value. I tried to use BigDecimal. But BigDecimal doesn't support exponential operations.
    pl suggest any solution for this.
    ur help is highly appreciated.

    Double probably isn't rounding off to zero, it's just not printing all 53 bits of the mantissa. It can support numbers down to 1 * 2**-1024, if I'm not mistaken.
    And BigDecimal supports exponentiation with the pow() method.

  • Calculate the power of 2

    calculate this value's X to the power of 2
    For example,
    if value X=4 the answer would be 2^4 =16
    float X = 4
    float Y = (2^X)
    how do you define the power of 2 in objective c?

    Like in C, which does not have an exponentiation operator.
    You either need to use multiple multiplications or the pow() function. In your case:
    pow(2,4)
    I don't know if Objective-C or Apple has defined any other functions for this (like a math library).
    (You will need math.h for this to work.)
    Message was edited by: Keith Barkley

  • JSTL Math

    I have two jstl variables(actually that contain time values), and want to subtracting them from eachother? but not to usre about the syntax
    is this correct?
    <c:set var="sendTime" value="${endSendTime - startSendTime}"/>

    JSTL doesn't have a exponential operator.
    In fact, neither does java. You use the Math.pow() method.
    If you are using a JSP2.0 container (Tomcat 5) you could probably define a function tag to do this ie
    ${myfunc:power(i+1, -n)}
    Good luck,
    evnafets

  • Invalid operands to binary ^ (have 'double' and 'double')

    Hi all,
    I've been trying to make some calculus like
    double a, b, c;
    b = 0.3;
    c =0.35;
    a = b^c;
    but I get this error message: *"Invalid operands to binary ^ (have 'double' and 'double')"*. Does anybody know how to solve this?
    Thanks in advance!

    Yes I think Ray hit the nail on the head. It looks as if you wanted to perform and exponentiation operation, not a bitwise operation. So, just to expand on Ray's answer a bit, the carrot symbol (^) that you used in your statement is, in C, the bitwise XOR operator, and has nothing to do with exponentiation. There are numerous bitwise operators in C (bitwise AND (&), bitwise OR (|), bitwise XOR (^)), and they all deal with manipulating bits of data. If you were, in fact, trying to raising b to the power of c and assign that value back to a, then Ray's post was the perfect answer as to how to do that.
    Many programmers that are new to C, especially ones coming from a language such as Visual Basic, where the carrot symbol is used for exponentiation operations, naturally try to use the same symbol for the same purpose in C, and are surprised to find that it doesn't do what they expected (understandably). As mentioned, this is because, in C, there is no exponentiation operator, and the carrot symbol does something completely different and unrelated to exponentiation. However, C does provide a predefined function in its standard library for exponentiation, and it is called the pow() function, which takes two double-typed arguments (the first is the number being risen and the second is the power that it is being raised to), and returns the result as a double. To use this function, all you have to do is write an include directive at the top of the file that you will be using the function in that tells the preprocessor to include the file math.h. See RayNewb's post for a solid example of how all this stuff would look in your source code, and, as he mentioned, open your Terminal and type in +man math+ or, for this particular function, +man pow+ to find out more about how this function works (you can page through the information with the spacebar or scroll down with the down arrow).
    Hope this was of some help for you, and best of luck with everything!

  • Why not Integer.NaN?

    Hello
    I wonder why Integer does not supply a NaN like Double.NaN. I find the Double.Nan to be very useful.
    Regards
    JT

    :) I think what you mean is that integers are
    normally only used with the basic arithmetic
    operations: +, -, *, and / (I miss having Python's
    built-in exponentiation operator). These operations
    never return infinity or NaN, with the single notable
    exception of division by zero. And dividing by zero
    is almost always an accident with integers, and is
    easy to check for.Yes, that's what I meant. My post was so dumb even I have to laugh at it. First, I didn't say integers are closed over multiplication, and then I said modulo and remainder like they're two different things. And integers aren't closed under integer division because of 0, as you said.
    Floating point numbers, on the other hand, are often
    used with transcendental functions and fractional
    exponents and things, which frequently result in
    infinity or NaN. Moreover, it's important to be able
    determine that the result is one of those things, so
    we have constants for them. Also, it's often hard to
    check these things ahead of time with these
    functions.
    You dig?
    As an aside, I wonder if an operator-overloading
    framework could be developed for Java by explicitly
    basing the use of operators on interfaces. For
    instance, to use the arithmetic operators, you would
    implement an interface called Field. To use
    the comparison operators, you would implement an
    interface called Ordered (which would
    basically be identical to the Comparable interface).
    You get the idea. The premise would be that it
    t would the operators to conform with their standard
    mathematical definitions.As someone adamantly opposed to operator overloading in Java, this proposal is ok to me. If you're familiar with the matlab language, operator overloading is done there by defining functions like "plus()", etc... so its sort of similar I think. I think C++ gets difficult because you can overload operators like the function call operator (), and the member of operator(s) which gets confusing really quick.

  • Maximize the chances of getting and prompt response and good suggestions exponentially.

    Hi there Folks
    First
    I want to say that all issues cannot be solved by troubleshooting.
    There are times when the hardware of the device damage been damage or  and then is time to replace the unit. With that being said the majority of the problems that users face are fixable with troubleshooting and with steps that we can help with, is important that as a user you understand, most of the People that offer assistance here, are your peers users, most of them have 4 key common denominators
    Experience,
    Knowledge,
    Desire to help,
    Understanding on your necessity.
    Believe me they do know, if you take the time to formulate your question is because you need help with your device and issue. In the same token they need help to understand the issue and more importantly what is causing it. For that we need some basic Information please take the time to read this suggestion on how to formulate your question in a way that will allow us to help you more promptly. I assure that will not hurt your chances but it will increase them exponentially.
    Bear in mind these Great Folks are for the most part users like you, in less quantity professionals that devote their valuable free time to help you folks and in other instances are folks that work for or with HP that devote time to help all of those that are having issues.
    These are some recommendations that will assist you getting quick and accurate assistance.
    Do not do this;
    Don’t include any personal information, such as phone number, email address, complete name and last name.  As this is not relevant to the issue you are having nor it will help nobody help you.
    Do not include Printer, computers or any other device serial numbers. Because this information is completely irrelevant to the issue at hand.
    Don’t feel that any statement is Dumb or irrelevant. The person in the other side on the communication is not psychic and the information that you are omitting can be the information that tells what the actual issue is.  This is simply impossible to know so include as much information as possible.
    Do not rush to formulate your question.  This obviously is your prerogative to use it.  I feel obligated to disclose I do not feel incline to help people that are using offensive language or threads nobody might help you so unless what you want isto use this resource as venting mechanism.   Do not DO IT as is not productive and will limit the amount of help you get.
    DO THIS
    Use a compact and concise format in the opening of the message to include all relevant information.
    Always include the Operating system of the computer you are using or if the issue is on a device such as phone, tablet, or any other mobile devices include this information as well.
     Use this format or something similar. (Substitute the example with your current configuration)
    OS
    Complete printer model
    Router brand, model and firmware version: If connectivity is the likely problem.
    Recent changes and additions to the network configuration.
    Issue description:
    Other comments:
    If you ask your self why we ask in regards your opearting system when is a printer related to include read here I should give a brief explanation why I ask for extra information. 
    Why
    OS: Windows 7 home Premium 32 bits
    All this information is important in most cases. Although issue may be with the printer only or least that is what logic tells you. The steps that you might have to take to fix it, are Operating system dependent or exclusive.  To do something in Windows it may be different that in Mac OS or Linux even between versions of this operation systems. I will suggest let us decide if is not.
    Also very valuable information is to include if the Operating system is update the easiest way to tell this is if the operating system is automatically updating.  Include this information at all times.
    Complete Printer model: i.e.. HP Officejet Pro 8500 All-in-One Printer - A909a
    There are printer models that have more than 8 variants. And in some there are pretty distinct differences .So the last part of the model A909a in the case of t this example, is imperative that is included.   These are all the models in reference of the printer model in the example.
    HP Officejet Pro 8500 All-in-One Printer - A909a ›
    HP Officejet Pro 8500 All-in-One Printer - A909b ›
    HP Officejet Pro 8500 Premier All-in-One Printer - A909n ›
    HP Officejet Pro 8500 Wireless All-in-One Printer - A909g ›
    HP Officejet Pro 8500A Plus e-All-in-One Printer - A910g ›
    HP Officejet Pro 8500A Premium e-All-in-One Printer - A910n ›
    HP Officejet Pro 8500A e-All-in-One Printer - A910a ›
    Recent changes and additions to the configuration:
    Too many to list to let’s think about adding a new device to the network as an good example to explain the importance of this.
    Most of the time this will be a flawless procedure and will not cause issues.
    But for example let’s say you included iPhone to the current home network. You had to include or install bonjour to your computer to able to communicate with the phone and all hell breaks loose now nothing works.  It might be the fact that your router does not support the service (also known as mDNS) but let make a worst example it does support it but in a recent firmware update of the router and also Windows have issued several updates to improve support Again just an example. The person that is trying to assist you assume that all this is done but is not that might prohibited the person to help you with what it should be an easy fix.
    Issue:
    this is where you include all the information that you feel is relevant do not leave anything this way we limit the possibility of lack of understanding from the person trying to help.
    Other comments:
     This is optional I will use this to include other devices information that working or not working in the network or it I try in another computer or network.
    This is a problem that a user had and I wish that would it explain like this it would save him and me 3 days of questions and back and forward to get to a fairly easy solution.
    OS: Windows 7 home Premium 32 bits
    Complete Printer model: i.e.. HP Officejet Pro 8500 All-in-One Printer - A909a
    Recent changes and additions to the configuration: Added a new iPhone and a android phone. To the wireless network.  
    Issue: Printer goes online everyday
    Recent changes: None
    Issue:
     The printer for past week have how in the control panel  an error message offline printer and the jobs are getting stuck in the print queue.
    TS (Troubleshooting) steps taken by me.
    Restart the printer disconnect the printer from the network.  Did not fix.
    Other comments:
    My wife computer are not having the same issue. Is printing fine.
    This took 5 minutes to write this  and will help anybody that is reading understand the issue I am having and give me suggestions on how to fix it without having to comeback to and ask questions.
    I truly hope that you subscribe to this or any similar formats as it will really help all parties involve to get a better and positive result in most cases.
    RobertoR

    You can say THANKS by clicking the KUDOS STAR. If my suggestion resolves your issue Mark as a "SOLUTION" this way others can benefit Thanks in Advance!
    This question was solved.
    View Solution.

    Hi sabretooth04
    Thanks I am considering making an interactive video presentation make it more interesting to the Folks and maybe interactive to ensure the get the most out it. perhasps that can be use as a Sticky as least we can recommend it
    Kind Regards;
    RobertoR
    You can say THANKS by clicking the KUDOS STAR. If my suggestion resolves your issue Mark as a "SOLUTION" this way others can benefit Thanks in Advance!

  • Laser operation with a USB 6008 DAQ

    I'm wondering how I go about using the USB 6008 DAQ in conjuction with labView to turn on and off ths laser: 
    http://www.maplin.co.uk/p/1mw-3v-red-laser-module-le07h
    The laser must be turned on using 3V which isn't possible with this DAQ. I was thinking of usinga BC 109 transistor, then have the laser connected to an external power supply which is supplying 3V to the laser. then have the laser connected to the collector of the transistor.
    I set this up and it didn't exactly work out as the laser was drawing to high a current and not working correctly.
    Can anyone help me?

    OK. The problem is that you need to supply about 30 mA to the laser to get it to work. The digital outputs of the USB-9008 are limited to 8.5 mA or less. Furthermore, a laser diode is a current operated device. If you apply a fixed voltage the current will vary depending on the exact doping used when the device was manufactured and on it instantaneous temperature. The curretn rises exponentially with voltage as in any diode. The link you posted does not have any real data about the electrical characteristics of that diode.
    Typically a current regulating circuit is used to drive laser diodes.  The simplest circuit is a resistor in series with the diode connected to a power supply with a voltage higher than 3 V. The value of the resistor depends on the power supply voltage, the voltage drop across thes witching transistor, and how much current you want to run through the diode. If you have applied 12 V to that laser from a source which can provide substantial current (>50 mA), you have probably destroyed it.
    Lynn

  • How To Get rid of Exponential format in datagridview when the number is very large

    When the number is very large like :290754232, I got 2.907542E +08. in datagridview cell
    I using vb.net , framework 2.0.
    how can I get rid of this format?
    Thanks in advance

    should I change the type of this column to integer or long ?
    The datagridview is binded to binding source and a list ( Of).
    Mike,
    I'll show you an example that shows the correct way to do this and a another way if you're stuck using strings in exponential format. The latter being the "hack way" I spoke about Friday. I don't like it, it's dangerous, but I'll show both anyway.
    In this example, I'm using Int64 because I don't know the range of yours. If your never exceeds Int32 then use that one instead.
    First, I have a DataGridView with three columns. I've populated the data just by creating longs starting with the maximum value in reverse order for 100 rows:
    The way that I created the data is itself not a great way (there's no encapsulation), but for this example "it'll do".
    Notice though that the third column (right-most column) isn't formatted at all. I commented out the part that does that so that I could then explain what I'm doing. If it works, it should look like the first column.
    The first column represents an actual Int64 and when I show the code, you can see how I'm formatting that using the DGV's DefaultCellStyle.Format property. That's how it SHOULD be done.
    The third column though is just a string and because that string contains a letter in it, Long.TryParse will NOT work. This is where the "hack" part comes in - and it's dangerous, but if you have no other option then ...
    You can see that now the third column matches the first column. Now the code:
    Option Strict On
    Option Explicit On
    Option Infer Off
    Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load
    With DataGridView1
    .AllowUserToAddRows = False
    .AllowUserToDeleteRows = False
    .AllowUserToOrderColumns = False
    .AllowUserToResizeRows = False
    .AlternatingRowsDefaultCellStyle.BackColor = Color.Aquamarine
    .ReadOnly = True
    .SelectionMode = DataGridViewSelectionMode.FullRowSelect
    .MultiSelect = False
    .RowHeadersVisible = False
    .RowTemplate.Height = 30
    .EnableHeadersVisualStyles = False
    With .ColumnHeadersDefaultCellStyle
    .Font = New Font("Tahoma", 9, FontStyle.Bold)
    .BackColor = Color.LightGreen
    .WrapMode = DataGridViewTriState.True
    .Alignment = DataGridViewContentAlignment.MiddleCenter
    End With
    .ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing
    .ColumnHeadersHeight = 50
    .DataSource = Nothing
    .Enabled = False
    End With
    CreateData()
    End Sub
    Private Sub CreateData()
    Dim longList As New List(Of Long)
    For l As Long = Long.MaxValue To 0 Step -1
    longList.Add(l)
    If longList.Count = 100 Then
    Exit For
    End If
    Next
    Dim stringList As New List(Of String)
    For Each l As Long In longList
    stringList.Add(l.ToString("e18"))
    Next
    Dim dt As New DataTable
    Dim column As New DataColumn
    With column
    .DataType = System.Type.GetType("System.Int64")
    .ColumnName = "Actual Long Value (Shown Formated)"
    dt.Columns.Add(column)
    End With
    column = New DataColumn
    With column
    .DataType = System.Type.GetType("System.String")
    .ColumnName = "String Equivalent"
    dt.Columns.Add(column)
    End With
    column = New DataColumn
    With column
    .DataType = System.Type.GetType("System.String")
    .ColumnName = "Formated String Equivalent"
    dt.Columns.Add(column)
    End With
    Dim row As DataRow
    For i As Integer = 0 To longList.Count - 1
    row = dt.NewRow
    row("Actual Long Value (Shown Formated)") = longList(i)
    row("String Equivalent") = stringList(i)
    row("Formated String Equivalent") = stringList(i)
    dt.Rows.Add(row)
    Next
    Dim bs As New BindingSource
    bs.DataSource = dt
    BindingNavigator1.BindingSource = bs
    DataGridView1.DataSource = bs
    With DataGridView1
    With .Columns(0)
    .DefaultCellStyle.Format = "n0"
    .Width = 150
    End With
    .Columns(1).Width = 170
    .Columns(2).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
    .Enabled = True
    End With
    End Sub
    ' The following is what I commented
    ' out for the first screenshot. ONLY
    ' do this if there is absolutely no
    ' other way though - the following
    ' casting operation is NOT ADVISABLE!
    Private Sub DataGridView1_CellFormatting(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) _
    Handles DataGridView1.CellFormatting
    If e.ColumnIndex = 2 AndAlso e.Value.ToString IsNot Nothing Then
    ' NOTE! The following is dangerous!
    ' I'm going to use coercion to force the
    ' string into a type long. TryParse will
    ' NOT work here. This can easily throw an
    ' exception if the string cannot be cast
    ' to a type long. I'm "depending on" the
    ' the string to cast. At the very least
    ' you might put this in a Try/Catch but
    ' that won't stop it from failing (if
    ' it doesn't work).
    Dim actualValue As Long = CType(e.Value.ToString, Long)
    Dim formattedValue As String = actualValue.ToString("n0")
    e.Value = formattedValue
    End If
    End Sub
    End Class
    Like I said, only use that hack way if there's no other option!
    I hope it helps. :)
    Still lost in code, just at a little higher level.

  • "All" operator with powers of 2

    Problem
    What is the "all" ("all" as in "all powers of two") operator in exponential math?
    What the program is supposed to do
    Has a GUI with a single textfield that pops-up. The user is prompted to enter the name of the file where the results of the operation are supposed to go. Once they press enter, the program will send the squares of the integers 1 through 10, excluding the powers of two to the designated file.
    My current, erroneous application
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class PowersOf2
         private JTextField field;
         public static void main(String[] args)
              PowersOf2 gui = new PowersOf2();
              gui.go();
         public void go()
              JFrame frame = new JFrame();
              field = new JTextField("Enter name of file where result will be sent");
              field.addActionListener(new sendToFile());
              frame.getContentPane().add(BorderLayout.CENTER, field);
              frame.setSize(300, 50);
              frame.setVisible(true);
         public class sendToFile implements ActionListener
              public void actionPerformed(ActionEvent e)
                   FileOutputStream out;
                 PrintStream p;
                 try
                         out = new FileOutputStream(field.getText());
                         p = new PrintStream( out );
                         int x = 1;
                         int a = ((int)*);
                          while (x<11)
                               if (x != (Math.pow(2, a)))
                                    int y = (int)(Math.pow(x,2));
                                    p.println("The square of "+x+" is "+y+".");
                                    x++;
                               else
                                    x++;
                         p.close();
                 catch (Exception f)
                         f.printStackTrace();
    Thank you very much for your help!

    To clarify, I want to know how to represent
    all powers of two.I'm sure you don't actually mean what you said. What you really want is, as huskerch suggested, a means to test whether a given integer is a power of two. In pseudo-code this would be :
    Create a list;
    for all integers i from 1 to 10 :
    integer square = i * i;
    if square isn't power of two, add square to the list;
    next
    write list to file.
    See : all you need is to find the test which can tell you if a given integer is a power of two. Being able to code such a test has nothing to do with being a beginner in java. I don't mean to be rude but if you don't code yourself this part of your school assignement, there might be little hope for you in the field of computer science.

  • Slow Execution Time of Exponentia​l Function

    Hi,
    I am developing a program with large dataset (arrays size of around 1000*1000 elements).
    I realised that my program ran quite slow when calculating exponential for each array elements.
    So, I built a simple porgram to test the execution time for exponential vs multiplication on 1000*1000 array elements and found
    out that the period is ~25 times longer. Attached is the program (Labview 2011).
    The specs of my system are:
    1) Windows 7
    2) Intel i5 3Ghz with 4gb ram
    3) Labview 2011
    The actual program I built has a version in Matlab and uses exponential function as well. However, the execution time in Labview is around 10 times longer than the Matlab. I believe that the exponential function is the cause of this after making some analysis using built-in "Performance and Memory" tool and modification to the program.
    Is there any way I could make the exponential function runs faster? Or any better way to handle large array operation? (I have tested array operations with nested FOR loops and paralel execution but the results is not that great.
    Hope anyone can help. Thanks for any input.
    Attachments:
    Execution Time-Exponential Function.vi ‏11 KB

    Thank you for your answer. 
    I am sorry, I could not upload the real code since it is large and has lots of dependency. But, I wrote simple program both in Labview and Matlab as attached.
    I tried to make both program doing the same thing and put each element as random number between 0-1 to avoid any folding/optimization process.
    The Labview took around 974ms to complete the task while the matlab 177ms. If the the way I implemented them are correct, the Matlab is around 5 to 6 times faster than Labview to execute Exponential function.
    Attachments:
    Matlab Exponential Test.PNG ‏19 KB
    Labview Exponential Test.PNG ‏24 KB
    Exponential Test.vi ‏10 KB

  • Deprecated math operator  ^ ?

    I was using Cold Fusion MX7, and now I'm on CF8.
    This week someone told me that I had a problem with one of my
    calculation, it use to be giving the good result but now it is not
    giving good result. The only thing I can see is that the math
    operator ^ is deprecated in CF8, is there something that replace
    it???

    > the math operator ^ is deprecated in CF8,
    Cite?
    It certainly doesn't say anything like that in the docs:
    http://livedocs.adobe.com/coldfusion/8/htmldocs/Expressions_03.html
    {quote}
    ^
    Exponentiation: Return the result of a number raised to a
    power (exponent).
    Use the caret character (^) to separate the number from the
    power; for
    example, 2^3 is 8. Real and negative numbers are allowed for
    both the base
    and the exponent. However, any expression that equates to an
    imaginary
    number, such -1^.5 results in the string "-1.#IND. ColdFusion
    does not
    support imaginary or complex numbers.
    {quote}
    But anyway, if something is deprecated, it still works same
    as it ever did,
    it's simply flagged for obsolescence. So even if the ^
    operator was
    deprecated, there'd be no difference in how it worked before
    and after
    deprecation.
    CF seldom deprecates things, and even when deprecated, things
    are seldom
    actually obsoleted. A good example is the parameterExists()
    function: it's
    be deprecated since (at least) CF5. It's still there and
    functional in CF8
    though.
    > <cfset mtp = #rem# * 100 * ( (1 - ((1+
    (#tme#/100))^-#duree#) ) ) / #tme#>
    Well you don't need those pound signs in there, but having
    them just makes
    your code look untidy, it doesn't actually impact anything.
    What kind of differences in results are you seeing?
    Adam

Maybe you are looking for