Converting to decimal number

Hi to all,
I am diplaying data from the DataControl on a page, these data is numbers and are shown as:
number1: 12.154
number2: 125.25
number3: 1.254
as seen with a decimal point, are not aligned and with more than two decimal numbers.
How can I make show like this?
number1: 12,15
number2: 125,25
number3: 1,25
numbers with decimal comma, aligned and only two decimal numbers. I saw that this is possible using UI Hints,but I can not get it, someone can help me?

krd12 wrote:
I am trying to convert a string with a lot of digits (ex 324.41897635) into a number and want to get back the same precision in the number as in the string. I tried the "Decimal String to Number" (get back no digits after decimal point ex 324) and "Frac/Exp String to Number" (get back three decimal places rounded ex 324.419) 
Not a trivial exercise!
Here is 1 possible solution I've limited it to non-trivial digits (ext floats are only 15 digits precise on some OS's.)  But you can see the steps necessary.  I assume the radix symbol is "." but the vi could be modified to use"System Decimal Seperator"
Jeff
Attachments:
Max Str-Ext.vi ‏11 KB

Similar Messages

  • How to convert fractional decimal number to hex number?

    Hi,
    Can any one help me to convert the fractional decimal number to its equivalent hex number and vice versa ?
    if u have any code please share.
    thanks
    neethu

    neethukk wrote:
    Can any one help me to convert the fractional decimal number to its equivalent hex number and vice versa ?
    if u have any code please share.
    This question is not clear at all.
    "Fractional decimal" is not a data type, but a way of formatting in readable form using numeric characters and a decimal separator.
    Same to "hex number", but only for integers.
    What do you mean by "convert"? Do you want to keep the value the same or retain the bit pattern of the numeric data type?
    Hexadecimal is for integers. Are you talking about fixed point?
    We clearly need significantly more information. What are the input and output data types? What are you actually trying to do?
    Do you have an example input and corresponding output?
    LabVIEW Champion . Do more with less code and in less time .

  • Regarding Converting the Decimal number into rounded value...

    Hi,
       i have a decimal number as "   58240990.00 " , i wanted this to rounded value .
      for example I am expecting to see 58241 for the above number.
      shell we can do in any way.. if so please let me knw fast.. it is urgent..
      thanks in advance.
    thanks,
    Suresh..

    Dear Suresh,
    Go through the following code chunk:
    DATA : p TYPE p DECIMALS 2 VALUE '2.49'.
    DATA i TYPE i.
    i = CEIL( p ).
    WRITE : i.
    Regards,
    Abir
    Don't forget to award Points *

  • About binary number and decimal number?

    how to use a class to convert a decimal number from a binary number?Thank you

    You've already asked the same kind of thing before (http://forum.java.sun.com/thread.jsp?forum=31&thread=325249), and fsato4 answered. Here is the same thing, but decimal to binary.
    public class ToBinary {
         public static void main(String[] args) {
              int n = 12; 
              System.out.println(Integer.toString(n)); 
              System.out.println(Integer.toBinaryString(n));

  • Conversion of decimal number

    hi,
    how to convert a decimal number
    suppose i want to convert 500.00- to 500.
    plz help me in resolving this.

    Hi Ramya,
    You can use Field symbol with CASTING operator to convert decimal to Numeric Type (Intergers). You can try with other Numeric type also.
    data:wf_int type i,
    wf_dec(10) type x.
    field-symbols: <fs> type any.
    wf_dec = '28'.
    assign wf_dec to <fs> casting type i.
    wf_int = <fs>.
    write wf_int.
    kindly reward if helpful.
    cheers,
    Hema.

  • How to convert data read in byte to decimal number?

    The following are a source code to read from a serial port, but i can't convert the data that i read to decimal number and write it on a text file.....can anyone kindly show me how to solve it? thanks
    import javax.comm.*;
    import java.io.*;
    import java.util.*;
    public class Read implements Runnable, SerialPortEventListener {
         // Attributes for Serial Communication
         static Enumeration portList;
         static CommPortIdentifier portId;
         SerialPort serialPort;
         static OutputStream outputStream;
         InputStream inputStream;
         Thread readThread;
         public static void main(String s[])
         portList=CommPortIdentifier.getPortIdentifiers();
         while(portList.hasMoreElements())
              portId=(CommPortIdentifier)portList.nextElement();
              if(portId.getPortType()==CommPortIdentifier.PORT_SERIAL)
                   if(portId.getName().equals("COM1"))
                        System.out.println( portId.getName());
                        Read ss=new Read();
              }     // end of while
    }          // end of main
    public Read()     {
    try{
              serialPort=(SerialPort)portId.open("Read", 2000);
    catch(PortInUseException e)     {}
         try{
              inputStream=serialPort.getInputStream();
              System.out.println(inputStream);
    catch(IOException e)     {}
         try{
              serialPort.addEventListener(this);
    catch(Exception e)     {}
              serialPort.notifyOnDataAvailable(true);
         try{
              serialPort.setSerialPortParams(9600,
              SerialPort.DATABITS_8,
              SerialPort.STOPBITS_1,
              SerialPort.PARITY_NONE);
              }catch(UnsupportedCommOperationException e)     {}
              readThread=new Thread(this);
              readThread.start();
         }//end of constructor
         public void run()
              try     {
                   Thread.sleep(200);
              }catch(InterruptedException e)     {}
         public void serialEvent(SerialPortEvent event)
              switch(event.getEventType())
                   case SerialPortEvent.BI:
                   case SerialPortEvent.OE:
                   case SerialPortEvent.FE:
                   case SerialPortEvent.PE:
                   case SerialPortEvent.CD:
                   case SerialPortEvent.CTS:
                   case SerialPortEvent.DSR:
                   case SerialPortEvent.RI:
                   case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
                   break;
                   case SerialPortEvent.DATA_AVAILABLE:
                   byte[]readBuffer=new byte[8];
                   try{
                        while(inputStream.available()>0)
                             int numBytes=inputStream.read(readBuffer);
                             //System.out.println("hello");
                        System.out.print(new String(readBuffer));
                        }catch(IOException e)     {}
                   break;
                   }     // end of switch
                   try     {
                        inputStream.close();
                        }catch(Exception e5)     {}
         }          // end of serialEvent

    Is it a float or a double?
    For a float, the decimal should be 4 bytes (small numbers like 1.1 start with the byte 0x40). Convert these 4 bytes to an int, using byte-shifting would probably be easiest.
    int value = ((b3 << 24) + (b2 << 16) + (b1 << 8) + b0);//b# are bytesNow to convert it to a float, use
    Float.intBitsToFloat(value);Now if you want double percision, You will have 8 bytes instead of 4, and need to be converted to a long instead of an int through byte-shifting. Then use Double.longBitsToDouble(long bits) to get the double

  • Program to convert binary to decimal number?

    I only know how to do a program that converts only 4 numbers, but it to convert any amount of digits the number enters, I think you need to use a loop or something, but I'm not sure how. Could someone please help me? This is my code so far:
    import javax.swing.JOptionPane;
    public class bintodec {
         public static void main (String[] args) {
              String input;
              int number,digit1,digit2,digit3,digit4,result;
              input = JOptionPane.showInputDialog ("Enter a binary number.");
              number = Integer.parseInt(input);
              digit1 = ((number % 10000) - (number % 10000 % 1000)) / 1000;
              digit2 = ((number % 1000) - (number % 1000 % 100)) / 100;
              digit3 = ((number % 100) - (number % 100 % 10)) / 10;
              digit4 = (number % 10);
              result = (digit1 * 8) + (digit2 * 4) + (digit3 * 2) + (digit4 * 1);
              System.out.println ( "Binary number: " + input + "\nConverted Decimal Number: " + result);
              System.exit( 0 );
         } // main
    } // bintodecany help is super-appreciated.

    I am not sure if this will help you. Check it out, run it and let me know if it helped.
    import java.util.*;
       public class BitwiseTest1 {
           public static void main(String[] args){
            System.out.println("Enter a integer number:");
            Scanner keyboard = new Scanner(System.in);
            int n1 = keyboard.nextInt();
            System.out.println( "n1 as binary " +
                   Integer.toBinaryString( n1 ));
            System.out.println( "NOT n1 =     " +
                   Integer.toBinaryString( ~n1 ));
            System.out.println("Enter another integer number:");
            int n2 = keyboard.nextInt();
            System.out.println( "n2 as binary " +
                   Integer.toBinaryString( n2 ));
             System.out.println( "NOT n2 =     " +
                   Integer.toBinaryString( ~n2 ));
    }

  • Decimal of SQL Server getting converted to Whole number in ORACLE

    Hi All,
    I am using ORACLESQL Developer tool to migrate database from SQL Server to ORACLE. The decimal datatype in Sql Server is not getting converted to its equivalent in ORACLE. Do anyone face the same problem? Its getting converted to WHOLE number.
    Also I am able to import data only from Excel sheet. Is therre any other option to import data using this tool?
    Also is the tool the best to use for migration? Please give me your suggestions pls since I am facing this conversion problem after import lakhs of data.
    I am using version 1.1.3
    Thanks in Advance,
    Srinivasan.T

    I have upgraded to the version mentioned by you. Even now it is not getting upgraded. I am exporting data using Excel sheet only. Is it possible for you to explain how to migrate data thru SQL * PLUS?
    Thanks,
    Srinivasan.T

  • Prefix zero to a decimal number

    Hi All,
    I need to send a value to third party system. The value is a decimal number but before sending it i need to prefix zero.
    Eg: 1.25---> 00000000001.25
    The Functiom module CONVERSION_EXIT_ALPHA_INPUT works only for integers.
    Can you please suggest a function module which wil satisfy my requirement.
    Thanks
    Rohit

    Use a For loop to index into the array, then use the Not Equal To Zero comparison to convert it to true/false. Then Index out of the For and use the Bool Array to Int from the boolean pallete.
    Here is an example in 8.2
    Use the rating system, otherwise its useless; and please don't forget to tip your waiters!
    using LV 2010 SP 1, Windows 7
    Attachments:
    Convert Bit Array to Int.vi ‏8 KB

  • Convertion from Decimal to Hexadecimal

    Hi,
    Can you please tell me the way to covert a given decimal number into hexadecimal (for example 4 -> 04, 20 -> 14 etc) and also the vice versa.
    thank you.

    Hi
    Try this function module:
    " CRM_EI_KB_CONV_DEC_TO_HEX "
    This fm converts any decimal to hexadecimal, but not vice-versa.........
    Hope it helps....

  • Round decimal number to two places

    trying to round a decimal number to two places i.e. 1.98999 should round to 1.99.
    -tried using math.round but it only rounds to nearest integer
    -tried using decimalformat class but that converts to string, and cast wont allow me to convert from string back to double
    *is there a round method that allows you to specify decimal places?
    *or is there an easy method to cast a string back to a double?
    any advice is appreciated:)

    coynerm wrote:
    trying to round a decimal number to two places i.e. 1.98999 should round to 1.99.Agree.
    -tried using math.round but it only rounds to nearest integerI advise against rounding in most newbie situations. Usually it's the display of the variable you want to change.
    -tried using decimalformat class but that converts to string, and cast wont allow me to convert from string back to doubleOf course cast won't allow you to convert back. If you wanted to do that you'd use Double.parseDouble(stringVar); But we don't know why you are doing all this converting in the first place.
    *is there a round method that allows you to specify decimal places?
    *or is there an easy method to cast a string back to a double?Advice: Forgetting all this fooha with rounding, what in essence are you trying to achieve? Why all of this number manipulation in the first place? It will affect what should be the best answer.

  • C++, issues with converting a decimal to fraction

    Hi all,
    I am working on a C++ program that converts a decimal to a fraction, finds the lowest common multiple, multiplies the numerator by the denominator, then reduces the fraction again so the fraction will be 'numerator/1'. 
    I am using this code in a larger program to change a floating point slope value to a whole value for slope-intercept equations and standard form equations.
    The program will run but I tested almost 500 numbers and 20 numbers made the program crash (it stalled and did not finish the equation, I had to close the terminal and open it up again... )
    These 20 numbers I had problems with:
    2.36,  7.36,  1.11,  1.001,  1.66,  1.88,  2.22,  2.13,  3.24,  3,26,  3.32,  3.43,  3.49,  3.51,  3.57,  3.68,  3.74,  3.76,  3.82 
    (I am sure there are more...)
    I have tried c-style casting and dynamic and static casting to try to resolve this issue. Can someone help me out and point out why these certain numbers make the program crash and offer a possible sloution?
    I tried debugging this program on gdb and keep on getting this frustrating message..
    (gdb) break 16
    No line 16 in file "init.c".
    (gdb)
    Here is the program's code:
    //example.cc
    #include <iostream>
    #include "reduce.h"
    #include "decimal-to-fraction.h"
    using namespace std;
    int main()
    double deci;
    double n, d;
    while(1) {
    cout << "Enter a decimal to convert to a fraction ('0' to quit): ";
    cin >> deci;
    cin.ignore(INT_MAX, '\n');
    if(!deci) exit(0);
    dec_to_frac(deci, n, d);
    if (n * d != n){
    cout << '\n' << deci << " = " << n << '/' << d << "\n\n";
    cout<<'\n' << d << " x " << n;
    n = d * n;
    cout<< " = " << n << "\n\n";
    cout<<'\n' << n << '/' << d;
    reduce(n, d);
    cout << " = " << n << '/' << d << "\n\n";
    cout<<'\n' << n << "\n\n";
    else
    cout<<'\n' << deci<< "\n\n";
    return 0;
    #ifndef _REDUCE_H_
    #error You must include "reduce.h" before this file
    #endif /* def _REDUCE_H_ */
    #ifndef _DECIMAL_TO_FRACTION_H_
    #define _DECIMAL_TO_FRACTION_H_
    void dec_to_frac(double decimal, double &numerator, double &denominator)
    //numerator = static_cast<int >(decimal);
    //numerator = (int )decimal;
    numerator = decimal;
    denominator = 1;
    while(numerator != (int)numerator) {
    numerator *= 10;
    denominator *= 10;
    reduce(numerator, denominator);
    #endif /* def _DECIMAL_TO_FRACTION_H_ */
    #ifndef _REDUCE_H_
    #define _REDUCE_H_
    void reduce(double &numer, double &denom)
    int i;
    for(i=2; i<=numer; ++i) {
    if( ((numer/i) == ((int )(numer/i))) && ((denom/i) == ((int)(denom/i))) ) {
    numer /= i;
    denom /= i;
    --i;
    #endif /* def _REDUCE_H_ */

    Okay, a few things ('cause I'm picky too):  LCM == "least common multiple" or "lowest common multiple", it's really interchangable.  LCD == lowest common denominator, which is when you're adding two fractions and want to find the lowest denom.  Now that we have that out of the way...
    Using ++i or i++ as the third expression in your for loop will make zero difference. 
    for (int i=2; i<=numer; ++i)
    will have exactly the same effect as
    for (int i=2; i<=numer; i++)
    , though they may have slightly different performances.  The reason for this is that the third expression (i++ or ++i) is evaluated after every iteration of the loop, meaning it doesn't happen until the end of the loop body is reached, and then it's evaluated independently, meaning all you end up with is 'i' incrementing.
    As for this:
    if( ((numer/i) == ((int )(numer/i))) && ((denom/i) == ((int)(denom/i))) ) {
    becomes
    if (numer % i == denom % i == 0) {
    That's about right, it would look more like
    if (numer %i == 0 && denom % i == 0)
    - the other way would probably not behave the way you expect.
    Some other tips:
    numer and denom should be 'int' or 'long' - not double.  You don't expect your numerator and denominator to have decimal points, so use integral types - using floating point 'double's is likely what's getting you into this trouble -- floating point arithmetic is inherently imprecise.  You might have better luck parsing the input yourself and constructing the numerator from that instead of reading directly into a floating-point number.
    I'm hacking around with your code right now for fun; I'll let you know if I find anything.
    ==edit==
    Oh, something else I wanted to mention; to break on a line in gdb you type:
    break filename:linenumber
    ie.
    break example.cc:16
    Last edited by Cerebral (2007-06-03 02:43:42)

  • Displaying decimal number

    Dear All;
    I just want to get a decimal number (i.e. 2.5), i tried the
    Math functions, it didn't solved the problem.
    Is there another function which returns decimals.?
    Thank you;

    DEar Ned;
    I am getting the pixels of a scale then converting them into
    a pH range (0-14). so, i want the pH reading upto one decimal as
    follows:
    var mcSlider:MovieClip;
    mcSlider.onMouseMove = function():Void {
    //var xSlider:Number = this._y;
    var ySlider:Number = this._y - 1 * 550;
    var pH:Number=14*(-ySlider/550);
    this.startDrag(true,110,550,110,0);
    txtPh.text=pH;
    txtPh._y=+ySlider - 22.5 + 550;
    mcSlider.onRelease=onReleaseOutside= function():Void {
    this.stopDrag();
    };

  • Is there a way to convert skype online number cont...

    That was the general question, and here are my details:
    I have had a skype number for many years and it was great, around $5.5 a month to call all phones in North America from my laptop from any place in the world with internet. With time, I had a ccumulated a relatively large number of contacts (name of person or party & their phone number(s)). Now I decided that I finally need a regular "smart" cellphone with an AT &T 10c/minute and no data (that's the only way that I understand is not a rip-off, I'm counting on my really unlimited mobile hotspot to get wifi). Now, the company will have me purchase minutes every 30 days which doesn't look very bad considering that I don't have my wifi all the time.
    The problem I'm having is, how to transfer or convert the name/number list on skype to name/number list on my phone? so I can call the same numbers I used to call on slype with my AT&T minutes?
    Typing the numbers one-by-one to my phone may take days!! so, I figured out that there must be away to do it automatically, rather than manually.
    Any help is very appreciated

    Is there any answer skype people?????
    please!

  • Converting a hex number to binary

    How do you convert a hexadecimal number to the actual 1's and 0's of binary? I am using labview 6i. Also I will eventually need the binary to be a string. Thanks.

    Converting for numeric display is quite simple. All you do is on the control/indicator, show the radix, and set it to the desired setting.
    Setting up to display the binary in text is a bit more tricky. You need to insert a "Format Value" function in and wire "%b" to the format string. This will cause the output to change to binary.
    Good luck

Maybe you are looking for

  • ORABPEL-11811 - Error while calling PL/Sql API Into BPEL Process

    Hi, I have created a BPEL Process for creating a Order in Oracle using the synchronous process. I have followed the below steps. 1) Created a Stored procedure using the Order Creation API's by passing Recard Type IN parameters. 2) Created Synchronous

  • Unloading a loaded external SWF with a close button on the external SWF to unload

    I have found some discussion on this topic but I am still having trouble getting it to work and was hoping to get some help here. Here I have a file: http://www.dril-quip.com/test/main.swf I have: main.swf (a menu) and I have module.swf (content) If

  • Calculated key figures are returning the word "ERROR"

    Hi All, the calculated key figures which i used in one query are displaying the word  "ERROR" at the end of the results as part of each cells formatting.But when i copied the same query to my system then its not showing the word error and even i crea

  • Discount Condition type in sales order screen

    Hi Experts, I have a requirement like ,While the creation of Sales order ,we need to add discount for each line item on the main sales order screen ,for that i need an extra field near  to order quantity field,and it must be updated at the pricing pr

  • What is maximum read out speed of USB DAQ 6343

    hello everyone, we have new USB DAQ 6343.Its application note(or say characteristcs) says that it's sampling rate is 500K Sample/second.Now i need some clarification from you guys.I have to read digital data(serial or parallel). so plz tell me how mu