Extract fractional part of division

Hello,
I am trying to acomplish having the case show up TRUE, if input 2 is a close multiple of Input 1.  In the default case provided, the ramainder is 3.00001837.  I was attempting to extract the fractional part of the division and pass that value to the comparson block to activate the TRUE/FALSE case structure.  If the fractional part is less than 0.0002, then the case will be true, otherwise false.
Any help will be greatly appreciated.
Thanks,
hiNi.
Attachments:
extract decimal.vi ‏9 KB

Hello,
I am still having a problem extracting the decimal values even after using the absolute block.
Any other help will be greatly appreciated!
Thanks,
hiNi.
Attachments:
extract decimal.vi ‏8 KB

Similar Messages

  • Fixed point division on FPGA doesn't show the fraction part

    Hi,
    I'm trying to normalize a fixed-point complex vector. My problem is in the part of fixed point division. Assuming I am dividing x by y (x/y), then I multiply first x by 2^26 and y by 2^9 then divide both of them using high throughput function then multiply the result by 2^-17 and here the problem appears. The result is zero, and the fraction part doesn't appear. My question is: does the "scale by power of 2" block discards the fraction part and only keeps the integer part, even if the input is a fixed point input with fraction part of 20 bits length? If so then how can I get the result of dividing a number by a bigger one? I mnean how can I display a result < 1? If not, then why isn't the fraction part displayed? The numbers I used as an example are: x=10, y=182.
    The indicator is adjusted to have 64 bit word length and 44 integer length. I also write this data into a memory element and then read it through a FIFO to transfer it to the RT vi. Both of the memory and the FIFO are configured with the same word and integer lengths above. I am using 7965R series FPGA.
    Thanks in advance.

    It's worth noting that I tried this same procedure on RT vi itself and the fraction part was displayed.

  • Integer and fractional part of the number

    Hello everybody,
    I want to divide the floating point number to 2 integer words, first will receive the interger part of number, and the second will receive the fractional part of the number.
    For example: I have number 751.98 in DBL, then I create two integer fields: first has value 751, second has value 98.
    I have tried simple conversion from DBL to I16, but it always rounded me to higher interger. I don't want to round it. And I just don't know how to transform the fractional part to integer. Are there any specialized functions for this? Maybe should I use log10 or similar?
    TIA,
    Jacek.

    The place to start with this problem is the IEEE-754 numerical
    representations:
    32 bit floating point is internally:
    highest order bit is the sign bit.
    the next 8 bits are the exponent bits
    the last 23 bits are the mantissa bits
    the mantissas and exponents are binary.
    the mantissa value in a 1.22 fixed point binary number, i.e. the most
    significant binary bit is equal to 1, the next most is equal to 1/2,
    the next most is equal to 1/4, etc., etc.
    The exponent part can go between 2^-127 and 2^128
    You should be able to cast your 32 bit float to a 32 bit unsigned
    integer, separate it into sign, mantissa and exponent parts, use the
    exponent to rotate left or right your mantissa decimal point by the
    exponent value and then separate the whole part from the fractional
    part and then put each into the I16's or U16's as you want.
    Douglas De Clue
    LabVIEW programmer
    [email protected]
    [email protected] (Michael Ross) wrote in message news:...
    > This problem needs some limits. Like: only return the decimal portion
    > out to 6 places.
    >
    > First run the number through Remainder and Quotient (divisor of 1).
    >
    > 751.98743674645641000000 gets remainder of
    >
    > 0.98743674645641021900
    >
    > "floor" is 751
    >
    > Take the remainder and send through Decimal to Fractional String (this
    > is where you set your number of decimal places [default is 6]).
    >
    > returns 0.987437
    >
    > Then use String Subset and set it to an offset of 2 (cleans off the
    > leading zero and decimal point) with the "length" input left at the
    > default of "rest" (of string).
    >
    > 987437 (in string form)
    >
    > Now use String to Decimal Number
    >
    > returns 987437 (as a decimal number)
    > ====================================
    > I think if you don't limit the number of places it is ugly. It is
    > ugly going from numbers to strings and then back. But all numbers is a
    > bad thing.
    >
    > The alogirithm for finding the answer mathematically is nasty.
    > Especially without a limit on decimal places. You have to figure out
    > the number of decimal places and multiply by the inverse of the last
    > decimal place. Sounds easy.
    > =============================
    > Try this: New number: 751.98652
    >
    > Truncate out the remainder (Remainder and Quotient (divisor of 1)):
    >
    > 751.98652 ---> 0.98652
    >
    > Mult by 10 ----> 9.8652
    >
    > Take the floor (9) and divide by 10 ----> 0.9
    >
    > subtract the new number from the old. Is the answer non-zero? Not,
    > then keep on
    >
    > 0.98652 - 0.9 = .08652 which not equal to 0
    >
    > If it is zero, the floor is the answer.
    >
    > Continue - Not:
    >
    > This time multiply by 100 ----> 98.652
    >
    > floor is 98, divide by 100 ----> 0.98
    >
    > Subtract 0.98 from 0.98652 = .00652 still non zero.
    >
    > Keep on. 1,000, 10,000...When you get to 100,000
    >
    > 0.98652 x 100,000 = 98652.00
    >
    > Get the floor
    >
    > divide the floor by 100,000 to get the original number (remainder is
    > now 0.000), compare to original remainder
    >
    > 0.98652 - 0.98652 = 0. Yay.
    >
    > Take the 98652 and go with it. The last place was the one hundred
    > thousandth.
    >
    > I can't take credit for the last, I had uglier stuff going on. I did
    > do the string thing.
    >
    > I swear this is just like some sorry homework problem.
    >
    > Mike

  • Extracting second  part of string

    hi
    i have a string like abcd~12341sdfs
    I have to extract the string after ~ symbol
    Please let me know how ot do it

    Your same question from last week Extracting a part of Strng.

  • How to use the image manipulation palette to extract a part of an image

    How to use the image manipulation palette to extract a part of an image?I have a parent image from which i need to extract a certain sub part.can somebody pls help me on how to use this particular tool?
    Thanks

    Use the above snippet. You might need to convert the Image Type you are using with picture functions. The above snippet will give you good idea on how to achieve what you intend to.
    -FraggerFox!
    Certified LabVIEW Architect, Certified TestStand Developer
    "What you think today is what you live tomorrow"

  • How to remove trailing zeros from a fraction part.

    How to remove trailing zeros from fraction part, need standard API rather then some java code.

    user8726363 wrote:
    How to remove trailing zeros from fraction part, need standard API rather then some java code.I'm pretty sure we have all gathered that English is not your first language, but your question is not a good question in any language.
    Back up. Take a deep breath.
    Now - what's your problem ?
    Please illustrate with results, and the code (just the class/method; not your entire application) that is causing them.
    Winston

  • Extract a part from a txt file

    Hi, I've a simple problem which unfortunately can not solve.
    I have some txt's that I want only to extract a part o them. (The first 100 characters). Here is my code:
    import java.io.*;
    public class ReadSource {
         public static void main(String[] arguments) {
            try {
              FileReader file = new FileReader("1.txt");
              BufferedReader buff = new BufferedReader(file);
               boolean eof = false;
               while (!eof) {
                    String line = buff.readLine();
                    if (line == null)
                        eof = true;
                     else{
                     int start = line.indexOf("something");
                     int end = line.indexOf("something_else");
                     String str2 = line.substring(start, end);
                      System.out.println(str2);
                buff.close();
            } catch (IOException e) {
                System.out.println("Error -- " + e.toString());
    }and the error tha java displays is:
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
         at java.lang.String.substring(String.java:1438)
         at ReadSource.main(ReadSource.java:21)
    Exception in thread "main"

    Tim I'm very sorry but is still don't work. It still display the same error.
    Look at my code
    import java.io.*;
    public class ReadSource {
         public static void main(String[] arguments) {
           try {
                   BufferedReader reader = new BufferedReader(new FileReader("1.txt"));
                   BufferedWriter writer = new BufferedWriter(new StringWriter());
                   String line = null;
                   while ((line = reader.readLine()) != null) {
                       writer.write(line);
                       writer.newLine();
                   String content = writer.toString();
                   // Now you have the whole file content into the content String
                   int start = content.indexOf("smth");
                   int end = content.indexOf("smth2");
                   String str2 = content.substring(start,end);
                   System.out.println("start = "+start+", end = "+end);
                   System.out.println(str2);
               reader.close();
         }catch (IOException e) {
                System.out.println("Error -- " + e.toString());
    }It looks very logical, I don't know what happens
    Thank you very much for your help.
    Kostas

  • How do you retain only fractional part of number

    If I have a number say 3.10383, how do I use only the fractional part? In other words, how do I get rid of the three? My ultimate goal is to add two values of hours, minutes and seconds, say 1 hour, 30 min, 4 secs plus 2 hours, 7 min, 2 secs as an example. Any help would be appreciated.

    afried01 wrote:
    If I have a number say 3.10383, how do I use only the fractional part?Most likely you want to do this:
    double x = 3.10383;
    double fracPartOfX = x - (int)x; //integer cast amounts to simple truncation You might as well check java.lang.Math, which contains methods like round, floor and their siblings.
    My ultimate goal is to add two values of hours, minutes and seconds, say 1 hour, 30 min, 4 secs plus 2 hours, 7 min, 2 secs as an example.Is the need for the fractional part trick related to actually performing the sum or just to displaying the results?

  • How Can I extract each part of a string ??

    Dear Sir:
    I have a string like following to connect to Oracle Database:
    JDBC_URL= jdbc:oracle:thin:@localhost:1521:ABChere,
    I have Variables like:
    driverClass="";
    Hostname = "";
    port = "";
    SID="";
    etc
    I try to extract each part from this JDBC_URL,
    then assign them to following variable separately:
    driverClass="jdbc:oracle:thin";
    Hostname = "localhost";
    port = "1521";
    SID="ABC";
    Can some guru help give some good example and show how to do it??
    Thanks and have a nice weekends.

    try using a regular expression (regex).
    here, i am going to try to freeball it:
    // JDBC_URL= jdbc:oracle:thin:@localhost:1521:ABC
    Pattern p = Pattern.compile("(JDBC_URL)(\\s*)(=)(\\s*)(.*?:.*?:.*?)(:)(@)(.*?)(:)(.*?)(:)(.*?)")
    Matcher m = p.matcher(text)
    if(m.matches()) or if(m.lookingAt()){
    String driverclass = m.group(5);
    String hostname = m.group(8);
    ...group(10);
    ...group(12);
    }note that (\\s*) means "any amount of whitespace" and (.*?) means "any amount of any character (reluctantly)".
    i used that because i dont know the constraints on those values. for only numbers you can use (\\d+) etc
    [http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html|http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html]
    also, i put everything into ( ) - which is called a capture group - but that was just to make it clearer. in your final regex you may get
    rid of most of those.

  • How to extract local part from email address

    Hello, dear Colleagues.
    Please, help to extract local part from email address.
    Input string: "From: [email protected]"
    Need to get output string between "space" and "@": "C.Norris"
    Thanks.

    Thanks you, mjolinor.
    It works. 
    Could you show me please how to do the same with regular expression?
    Using -replace:
    $InputString = "From: [email protected]"
    $InputString -replace 'From: (.+?)@.+','$1'
    C.Norris
    Using -match:
    $InputString -match 'From: (.+?)@.+' > $null
    $Matches[1]
    C.Norris
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • How to extract multiple parts of a .rar file

    How would I extract files like this

    Usually you just click on the first one and the different parts take care of themselves.
    Try UnRarX - Mac OS X RAR Extraction Utility

  • Bash script to extract certain parts of an xml

    Here is what i'm dealing with, i have 2 files, one xml file and one file containing certain class names from the first one, the point is to filter the xml file so the newly created file only contains the classes defined in the second or list file. So far i've come up with an idea but got stuck on the last step, hope someone is willing to point me in the right direction
    The xml file is called description.xml and the list is list.txt
    #!/bin/bash
    # First i extract all the required class names and put in the missing parts
    cat list.txt | awk '{print "<class name=\"" $1 "\">"}' > filter.txt
    # Next i filter out all the line numbers of the required classes
    grep -n -f filter.txt description.xml | cut -d: -f1 > names.txt
    # Now i need to use something like awk '/NR=$n/,/^$/' so it filters
    out the whole class definition using the line number as the starting
    point and a newline as the ending of a class, and of course save it all
    in a new xml but so far nothing i tried worked :)
    The list file is one class name per line:
    java/net/xyz
    java/net/xzy
    java/net/yxz
    And a snippet from the description.xml:
    <class name="java/net/xyz">
    </class>
    <class name="java/net/xzy">
    </class>

    Ahh I see what you're doing. That is a smart approach. I would have gone for a script that reads every line and extracts the java/net/xzy if it has one and grep -q it to the list.txt, and then maintain a variable that says whether it should print the class that gets set to false when </class> comes.
    In this case it is a bit hard to use awk because you need to process the line numbers from a file and the data too, and line numbers aren't the easiest to work with.
    But sed can do that easily
    IFS="
    for sedcmd in $(sed 's~$~,/^$/p~' numbers.txt); do sed -n "$sedcmd" xmlfile.xml; done
    Last edited by Procyon (2009-04-14 00:49:41)

  • POP3 adapter - Extracting body part

    Hi,
    I am using POP3 adapter, where I need to extract the body of the mail. and then I need to create xml message keeping this body as one of the fields description.
    I am doing this in custom pipeline component. I have working code to create the message, but I am not able extract the body part.
    Issue: The email message processing through pipeline, but resulting in empty message output.
    I tried keeping break point @ disassemble stage, but control not hitting my code. 
    I am using below code in disassemble stage to get the body part.
     IBaseMessagePart currentPart = pInMsg.GetPartByIndex(0, out partName);
                        Stream currentPartStream = currentPart.GetOriginalDataStream();
                        var ms = new MemoryStream();
                        IBaseMessage outMsg;
                        outMsg = pc.GetMessageFactory().CreateMessage();
                        outMsg.AddPart("Body", pc.GetMessageFactory().CreateMessagePart(), true);
                        outMsg.Context = pInMsg.Context;
    below is the adapter config
    Please let me know if any other configurations needs to be done in order to extract the body part
    Thanks in advance.

    Hi,
    I am able to debug the code.
    In the below code 
    currentPartStream.CopyTo(ms); is not working in .Net 3.5, how can I replace this code to extract the body part. please help.
    CopyTo method works in .net 4.0 and above
    public void Disassemble(Microsoft.BizTalk.Component.Interop.IPipelineContext pc, Microsoft.BizTalk.Message.Interop.IBaseMessage
    inmsg)
                var partName = string.Empty;
                // we start from index 1 because index zero contains the body of the message
                // which we are not interested
                for (int i = 1; i < inmsg.PartCount;
    i++)
                    IBaseMessagePart currentPart = inmsg.GetPartByIndex(i, out partName);
                    Stream currentPartStream = currentPart.GetOriginalDataStream();
                    var ms = new MemoryStream();
                    IBaseMessage outMsg;
                    outMsg = pc.GetMessageFactory().CreateMessage();
                    outMsg.AddPart("Body",
    pc.GetMessageFactory().CreateMessagePart(), true);
                    outMsg.Context = inmsg.Context;
                    currentPartStream.CopyTo(ms);
                    string attachmentContent = Encoding.UTF8.GetString(ms.ToArray());
                    MemoryStream attachmentStream = new System.IO.MemoryStream(
                    System.Text.Encoding.UTF8.GetBytes(attachmentContent));
                    outMsg.GetPart("Body").Data
    = attachmentStream;
                    outMsg.Context.Write("ReceivedFileName","http://schemas.microsoft.com/BizTalk/2003/file-properties  ",
    partName);
                    _msgs.Enqueue(outMsg);

  • Extract 11g part 1 of 2. Some files corrupted

    All:
    Please i know the answer to this is just to download a fresh zip file of oracle 11g part 1 of 2.
    But is there any other way out. In the part of the world i am in, internet is slow and i dont have 1.25gig of data. Got errors while extracting the zip file part 1 of 2. Part 2 of 2 extracted successfully. How can i get some of the files i failed.
    How can i get the .jar files?
    ! C:\Downloads\Oracle_112020_Win64_Database_1of2.zip: CRC failed in database\doc\em.112\e12255.pdf. The file is corrupt
    ! C:\Downloads\Oracle_112020_Win64_Database_1of2.zip: CRC failed in database\stage\Components\oracle.dbdev\11.2.0.2.0\1\DataFiles\filegroup1.jar. The file is corrupt
    ! C:\Downloads\Oracle_112020_Win64_Database_1of2.zip: CRC failed in database\stage\Components\oracle.precomp.common\11.2.0.2.0\1\DataFiles\filegroup6.jar. The file is corrupt
    ! C:\Downloads\Oracle_112020_Win64_Database_1of2.zip: The archive is corrupt
    ! C:\Downloads\Oracle_112020_Win64_Database_1of2.zip: CRC failed in database\stage\Components\oracle.sysman.console.db\11.2.0.2.0\1\DataFiles\filegroup11.jar. The file is corrupt
    ! C:\Downloads\Oracle_112020_Win64_Database_1of2.zip: CRC failed in database\stage\Components\oracle.sysman.plugin.db.main.oms\11.2.0.2.0\1\DataFiles\filegroup2.jar. The file is corrupt
    ! C:\Downloads\Oracle_112020_Win64_Database_1of2.zip: CRC failed in database\stage\Components\oracle.sysman.plugin.db.main.oms\11.2.0.2.0\1\DataFiles\filegroup3.jar. The file is corrupt

    I do not believe you have any choice other than to re-download the file. The download page has cksum values to verify the integrity of the download.
    HTH
    Srini

  • Extracting a part of string

    I have a string like 'abcd1234'. I want to extract only the number part to another variable. I dont know the occurance of the number in the string
    Please help me

    Please read this thread:
    Re: Splitting numbers and alphabets

Maybe you are looking for

  • Using select event for interlayer navigation

    Hi All,               I have two tables. The output of first table is input for the second one. When I select a row in the first table,the SELECT event is fired and the second table is populated based on the selection.              Now I have a scena

  • Re: Satellite P200-1JR - S/PDIF OUT is stereo only

    Hi. I have Toshiba P200-1JR. When I'm connecting laptop to receiver trough optical cable and trying to watch movies with AC3 5.1 sound, I'm getting only stereo sound. 1. Receiver is working correctly with PS3 and DVD player. 2. In S/PDIF options I ha

  • Sync apps can not be ticked

    I was trying to transfer my purchase to ITunes, and then authorize my computer as well. But my ITunes on the Apple Mac would not let me to tick the place that says sync apps at all. the page is all faded.

  • Can Solaris run on AMD Sempron

    I am considering evaluating Solaris 10. I have a new motherboard with an AMD Sempron CPU. I currently run WinXP on a 30 GB hard drive, partitioned as two 15GB drives. I need to re-install the operating system as I am replacing my current motherboard.

  • Is it possible to automatically add entry to contacts?

    Using my iPhone or iPad, I can search for an address using the white and yellow pages app, then just click a button to add that entry to my contacts.  Is there a way to do this using a Mac? -Thanks