On-line IEEE floating-point addition

Hi,
Could somebody please recommend the login for the on-line IEEE floating-point number addition.
On-line: start adding twp floating-point number from the most significant posion.
Thank you!

Thank you for your replay!
I had a misspelled word in my question. it should have been "logic" instead of "login"
I am looking for some java code that I can use as a starting point to start developing on-line floating poing addition unit. On-line means that the addition is done from the most significand bit (left-most) and goes towards least significand bits in binary floating point.
for example:
there are 64 bit in a FP number
|1 bit | 11 bits | 52 bits | + |1 bit | 11 bits | 52 bits |
I hope, I make sence
Thank you!

Similar Messages

  • Floating-point addition unit

    Hello All,
    I am very new to NI and I am looking for an example of floating-point addition unit. Basically, I am looking for some example to perform addition of two floating point number (single or double precision). -- just how to create floating-point addition unit using logical gates model (i.e. AND, OR, XOR, etc)
    Thank you!
    Leo
    Message Edited by smuStudent on 12-05-2005 11:51 PM

    Most (if not all) of us, when we want to do floating point math just put the Add function onto the block diagram. I would suggest you google for floating point gates or something similar. You can create subVIs that make up the basic functions such as a full adder and then link them together as needed.
    Attachments:
    Full Adder.JPG ‏9 KB

  • IEEE Floating point format converstion to ForteDouble

    Question:
    Given that I have 4 bytes of binary data which represents a number in
    IEEE floating point format,
    and I wish to convert it to a Forte DoubleData, will the following code
    give me the correct answer
    in Value?
    (Assume that file is correctly set up, etc...)
    Value : DoubleData = new;
    FPoint : point to float;
    F : float;
    LineText : BinaryData = new;
    File.ReadBinary(LineText,4);
    Fpoint = (pointer to Float)(LineText.Value);
    F = *Fpoint;
    Value.SetValue(F);
    Thanks
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Mark,
    you might try testing whether forte floats are IEEE in the following
    way using the following:
    pflt : pointer to float = (pointer to float) (res.value);
    flt = *pFlt;
    however, I believe you will have to wrapper a C function to do this.
    The C function takes a void * first argument and has a float
    void ConvIEEE(void * buffer, float * return)
    return = (float) (buffer);
    or
    void ConvIEEE(void buffer, float return)
    ieeefloat ie;
    ie = (ieeefloat) (*buffer);
    *return = IEEELibraryConvertToFloat(ie);
    depending upon whether C floats are IEEE or not on your
    platform/compiler. I think you'll have to investigate this yourself,
    or try the first approach and see if it works.
    Good luck!
    assuming, of course, that your C compiler's float is also IEEE format.
    Your forte wrapper would look like
    class floatWrapper inherits from framework.object
    has public method ConvIEEE(input buffer : pointer,
    output return : float)
    end class;
    with your binarydata you would
    res : binarydata = (get from somewhere)
    flt : float;
    fw : FloatWrapper = new;
    fw.ConvIEEE(res.value,flt);
    Mark Sundsten wrote:
    >
    Question:
    Given that I have 4 bytes of binary data which represents a number in
    IEEE floating point format,
    and I wish to convert it to a Forte DoubleData, will the following code
    give me the correct answer
    in Value?
    (Assume that file is correctly set up, etc...)
    Value : DoubleData = new;
    FPoint : point to float;
    F : float;
    LineText : BinaryData = new;
    File.ReadBinary(LineText,4);
    Fpoint = (pointer to Float)(LineText.Value);
    F = *Fpoint;
    Value.SetValue(F);
    Thanks
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>--
    John Jamison [email protected]
    Vice President and Chief Technology Officer
    Sage IT Partners, Inc.
    Voice: 415 392-7243 x 306
    Fax: 415 391-3899
    Internet Enabled Business Change
    http://www.sageit.com
    -----------------------------------------------------

  • IEEE floating point;

    This isn't really a Java question, but...
    Continuing fractions -- has anyone ever experimented with using implementing arithmetic operations on computers with continuing fractions? It would seem to provide a more way to represent most rationals quite compactly, and to represent irrationals fairly accurately. It wouldn't be as compact as IEEE floats, of course, but IEEE floats are extremely bad at representing many extremely simple rationals, like 1/3.
    I'm not much of a mathematician, nor much of an engineer, but would it be conceivable to implement an "FPU" using continuing fractions rather than mantissa-exponent floats?

    I am very rusty on this, and too lazy to walk across the room and look it up in my math library, but the cute algorithim that I remember for finding a rational approximation to a float goes like this: (by the way, cute means that it is easy to remember NOT that it is the fastest thing)
    First we define "bonehead" rational addition. This is not real addition it is a made up function that resembles how a bonehead would add two fractions. it is easy
    a/b + c/d = (a + b)/(c+d)
    so for example The bonehead sum of 1/3 and 1/2 is 2/5
    now observe the interesting fact that bonehead sum creates a fraction that lands between the two that you started with. This is always the case and not even too hard to prove. (Exercise for the reader)
    We can use that little fact to create a series of rationals that converge to a float. Think of it like this. Choose two rationals R1 and R2 that bound the float, F i.e.
    R1 < F < R2
    Do the bonehead sum to get R3. Well R3 must be in the interval, either greate than F or less than F, (or by some miracle equal to F in which case F was really a rational). Just so I can write it out, lets pretend that R3 ended up greater than F. We now have
    R1 < F < R3 < R2
    We can now throw out R2 because we have tighter bounds on F. One guess what we do next.
    That's right, we iterate. Do the bonehead sum of the two rational bounds, check where the new rational is in relation to the float, and replace one of the previous bounds with the new rational. This gets us a series of rationals that are converging to the Float. Are they optimal? Not quite but almost.
    You see, the top rational could have been very close to the float, and the bottom one way far away, and you do a whole lot of replacing the lower bound over and over until the lower bound is finally better than the upper bound, and then you will start moving the upper bound down. That point when the lower bound stops moving and the upper one starts to move is a good lower bound and symmetrically, when the upper bound stops moving and the lower one starts up again is a good upper bound, each one better than the previous.
    Those are good approximations.
    Now let me point out one other thing. You need to start out with a couple rationals that bound your float, how do you find those? How about starting with 0/1 as the lower bound, (zero is pretty much lower than any positive fraction) and for the upper number start with 1/0.
    eeekk! what's that? division by zero? nah, were talking rational numbers here, that the pair of integers 1 and 0, and yes, it represents infinity which is pretty much bigger than any positive fraction you could care to name. I mean, after all, if you're gonna do bonehead addition, you should have no problem with bonehead fractions too. I told ya this was cute!!
    Now, if you start with those numbers (0,1) and (1,0) and you follow that process SHO 'NUFF you are banging out the same optimal convergents that you get if were using continued fractions.
    So go nuts, whip out yer compiler and have at it!
    Yes the beauty of continued fractions lets you feel that you get something for nothing. i.e. using only 32 bits of accuracy for the denominator gives you in general about 64 bits of accuracy in the fraction itself. This is a false win. You use a 32 bit numerator and a 32 bit denominator together to get yourself the equivalent of 64 bits of accuracy. Its a wash. Furthermore, you do not get exponential notation, but hey, you can't have everything when yer having fun.
    Is this efficient? Not particularly, consider how long it takes to converge to 1/10000. Lets see first it adds 0/1 to 1/0 to get 1/1, then it adds 0/1 to 1/1 to get 1/2, then 1/3 ... Yep, 10000 steps counting by one all the way. It is not partucilarly efficient by Computer Algorithm standards, but as I pointed out at the beginning, the beauty of this algorithm is that it is so cute that I can remember it nearly 20 years after I first learned it, It is so simple that I can code it up with virtually no chance of making a mistake and best of all, that means I do not have to get out of my chair, walk across the room, find the right book, look up the right way to do continued fractions, etc.
    In terms of my personal efficiency, This baby kicks butt! Furthermore, do I really care if the computer has to grind through a few thousand or even a few million extra operations any more. Not really.
    So go ahead and slam in pi and watch this baby grind out 22/7 and the good old 355/113
    Enjoy!!

  • Reading IEEE Floating-Point 32bit number

    I have a program written in C++ that works with single precision float (IEEE) in Windows. When I try to read data from that program in LabView they seem different. Labview also use IEEE single float representation. The numbers in the files are sine wave with amplitude 1 and 30 samples/cycle.
    The first numbers are
    0
    0.207912
    0.406737 etc.
    Reading in LV the second number is 3E 54 E6 E2 where the left 3 bytes are mantissa and the right exponent and sign. Reading in LV the second number from the program1 I have CE E6 54 3E which is the mantissa on the right as little endian, but the exponent and sign are CE?! Any hint how to read it correctly in LV?
    Attachments:
    Prgm1.bin ‏1 KB
    SGLLvtest.bin ‏1 KB

    Hi,
    This works for the second file.
    Regards,
    Wiebe.
    "markstab" wrote in message
    news:[email protected]..
    > I have a program written in C++ that works with single precision float
    > (IEEE) in Windows. When I try to read data from that program in
    > LabView they seem different. Labview also use IEEE single float
    > representation. The numbers in the files are sine wave with amplitude
    > 1 and 30 samples/cycle.
    > The first numbers are
    > 0
    > 0.207912
    > 0.406737 etc.
    > Reading in LV the second number is 3E 54 E6 E2 where the left 3 bytes
    > are mantissa and the right exponent and sign. Reading in LV the second
    > number from the program1 I have CE E6 54 3E which is the mantissa on
    > the right as little endian
    , but the exponent and sign are CE?! Any
    > hint how to read it correctly in LV?
    [Attachment Decode.vi, see below]
    Attachments:
    Decode.vi ‏21 KB

  • Dtrace Floating Point gives error on x86

    When I try to create a floating point constant in dtrace x86:
    BEGIN
    printf ("%f", 1.0);
    exit (1);
    I get the error:
    dtrace: failed to compile script special.d: line 3: floating-point constants are not permitted
    Am I using the floating point constant incorrectly, or are floating point constants not permitted in the x86 platform.
    Thanks,
    Chip

    Then what is meant at the bottom of page 48 of the
    Solaris Dynamic Tracing Guide where it talks about
    floating-point constants?
    ChipSorry for not making that sufficiently clear. We are reserving that syntax for possible future use, but you cannot specify floating-point constants at present, and you cannot perform floating-point arithmetic in D. The only legal use of floating-point is that you can trace one or more data objects or structures that contain floating-point values and format the results using printf() and the various %f, %g formats.
    -Mike

  • F suffix for floating point.

    Okay, I'm a proficient c++ programmer and have been learning Java for only a few weeks now.
    I have a question about the f suffix for floating point varibles such as float f = 3.14f;
    The f suffix casts this as float right? which is the same as float f = (float) 3.14; Correct?
    Why do we have to add the f suffix in the first place? Doesn't the compiler know that we want a float and not a double? (single-precision 32-bit instead of double precision 64 bit) I really do not understand the concept here or why they need the f suffix.
    Can someone explain?

    ThePHPGuy wrote:
    The f suffix denotes that the literal is of a floating-point type.Yes. The d suffix does the same.
    Java has two different types of floating-point numbers.Right.
    The type double is the default type.Right.
    The float type can have a double and a float literal. Is this true or false?No. At least not in any way I understand it.
    I think you're confusing two things:
    "floating point number" is any number in the IEEE floating point format.
    "float" is a datatype holding a 32bit floating point number.
    "double" is a datatype holding a 64bit floating point number.
    floating point number literals can be either double literals (without suffix or if the "d" suffix is used) or float literals (when the "f" suffix is used).

  • Converting binary to floating point?

    ok, i am programming a little java program at the consulter
    the main idea of the program is to convert a decimal number to IEEE (floating point)
    i am almost done except the exponent part
    i dont understand the logic behind it
    so, for example:
    -6.625 = 110.101 (binary)
    after normalization it will be -1.10101 * 2^2
    so the IEEE will be
    1 10000001 10101000000000000000000
    i understand the sign part and the fraction part
    but i have no idea how the exponent part came like this
    the book say that 129-127=+2 so the exponent is 10000001
    da, where it came from ???
    i will appreciate it if someone explain this part for me step by step
    thank you,
    Edited by: abdoh2010 on Jan 26, 2008 2:37 AM

    got it
    thank you for viewing my question

  • Can I implement advanced control algorithm with floating-point computations in Ni 7831R ?

    Hi,
    I plan to use a Ni 7831R to control a MIMO nano-positioning stage with servo rate above 20kHz. The control algorithm is based on robust control design and it is much more complex than PID. it also includes floating-point caculations. Can I implement such algorithm with Ni 7831R?
    By the way, is there any way to expand the FPGA gates number for Ni 7831R? Suppose I run out of the FPGA gates (1M), can I add more FPGA gates by buying some different hardware?
    Thanks
    Jingyan
    Message Edited by Jingyan on 08-22-2006 01:45 PM

    Jingyan,
    as long as there is no GPU core implemented on the FPGA these devices only support integer arithmetic. NI's FPGA targets currently don't contain a GPU core so there is no native floating point arithmetic available.
    Still there are several options to implement floating point arithmetic on your own or to work around this target specific limitation. Here are some links that might help:
    Floating-Point Addition in LabVIEW FPGA
    Multiplying, Dividing and Scaling in LabVIEW FPGA
    The NI 7831R uses an 1M FPGA. If your application requires more gates the NI 7833R (3M) is a good solution.
    I hope that helps,
    Jochen Klier
    National Instruments Germany

  • IEEE 754 standards for representing floating point numbers

    HI All..
    Most of us are not awared how the actually Floating point numbers are represented . IEEE have set standards as how should we represent floating point numbers.
    I am giving u the link with which u can know how actually these are represented.
    http://en.wikipedia.org/wiki/IEEE_754
    If u have any doubts u can always reach me.
    Bye
    Happy learning
    [email protected]

    A noble but misguided attempt at dispelling the recurring problems the programmers have over and over again. There have been repeated posts to links about the IEEE standard, to little or no avail. The newbies who run into the problems will continue to do so, without regard to yet another post about it here.

  • Floating point arithmetic

    Hi everybody,
    This line:
    System.out.println((0.1+0.7)*10);outputs 7.999999999999999
    This is due to how floating point numbers are stored. When writing
    a code, sometimes it behaves in an intended way, sometimes it doesn't
    (like the one above). Is there a way to "predict" when the code is ok and
    when isn't ? Are there any tips to be aware of to get around that kind
    of problems ?
    Cheers,
    Adrian

    No. Using BigDecimal just because you don't understand how floating-point numbers work would be... um... short-sighted. And it wouldn't help, either. As soon as you divide 1 by 3 then you have to know how decimal numbers work, which is essentially the same problem.
    Edit: I forgot the forum hasn't been automated to provide the mandatory link for people who ask this question. We still have to do it by hand.
    http://docs.sun.com/source/806-3568/ncg_goldberg.html
    Edited by: DrClap on Oct 11, 2007 3:02 PM

  • Floating Point Representations on SPARC (64-bit architecture)

    Hi Reader,
    I got hold of "Numerical Computation Guide -2005" by Sun while looking for Floating Point representations on 64 bit Architectures. It gives me nice illustrations of Single and Double formats and the solution for endianness with
    two 32-bit words. But it doesn't tell me how it is for 64-bit SPARC or 64-bit x86.
    I might be wrong here, but having all integers and pointers of 64-bit length, do we still need to break the floating point numbers and store them in lower / higher order addresses ??
    or is it as simple as having a Double Format consistent in the bit-pattern across all the architectures (Intel, SPARC, IBMpowerPC, AMD) with 1 + 11 + 52 bit pattern.
    I have tried hard to get hold of a documentation that explains a 64-bit architecture representation of a Floating Point Number. Any suggestion should be very helpful.
    Thanks for reading. Hope you have something useful to write back.
    Regards,
    Regmee

    The representation of floating-point numbers is specified by IEEE standard 754. This standard contains the specifications for single-precision (32-bit), and double-precision (64-bit) floating-point numbers (There is also a quad-precision (128-bit) format as well). OpenSPARC T1 supports both single and double precision numbers, and can support quad-precision numbers through emulation (not in hardware). The fact that this is a 64-bit machine does not affect how the numbers are stored in memory.
    The only thing that affects how the numbers are stored in memory is endianness. SPARC architecture is big-endian, while x86 is little-endian. But a double-precision floating-point numer in a SPARC register looks the same as a double-precision floating-point number in an x86 register.
    formalGuy

  • Floating point formats: Java/C/C++, PPC and Intel platforms

    Hi everyone
    Where can I find out about the various bit formats used for 32 bit floating numbers in Java and C/C++ for both Mac hardware platforms?
    I'm developing a Java audio application which needs to convert vast quantities of variable width integer audio samples to canonical float audio format. I've discovered that a floating point divide by the maximum integer value gives the correct answer but takes too much processor time, so I'm trying out bit-twiddling in C via JNI to carve out my own floating point bit patterns. This is very fast, however, I need to take into account the various float formats used on the different platforms so my app can be universal. Can anyone point me to the information?
    Thanks in advance.
    Bob

    I am not sure that Rosetta floating point works the same as PPC floating point. I was using RealBasic (a PPC basic compiler) and moved one of the my compiled applications to a MacBook Pro and floating point comparisons that had been exact on the PPC stopped working under Rosetta. I changed the code to do an approximate comparison (i.e. abs(a -b) < tolerance) and this fixed things.
    I reported the problem to the RealBasic people and thought nothing more of it until I fired up Adobe's InDesign and not being used to working with picas, changed the units of measurement to inches. The default letter paper size was suddenly 8.5000500050005 inches instead of the more usual 8.5! This was not a big problem, but it appears that all of InDesign's page math is running into some kind of rounding errors.
    The floating point format is almost certainly IEEE, and I cannot imagine Rosetta doing anything other than using native hardware Intel floating point. On the other hand, there is a subtle difference in behavior.
    I am posting this here as a follow up, but I am also going to post this as a proper question in the forum. If you have to delete one or the other of these duplicate posts, please zap the reply, not the question.

  • Serial Communicat​ion(CAN) of Floating Point Numbers

    Hi,
    I have ran into a situation were I need to use floating point numbers(IEEE Floating Standard) when communicating.   How can I send and recieve floating point numbers?  What converstions need to be made?  Is there a good resource on this?
    Thanks,
    Ken

    Hi K.,
    in automotive a lot of fractional values are exchanged via CAN communication, but still the CAN protocol is based on using integer numbers (of variable bit size)…
    We are thinking we need to use single SGL floats ... that require a higher resoultion and precision
    What is the needed resolution and "precision"? SGL transports 23 bits of mantissa: you can easily pack them into an I32 value!
    Lets make an example:
    I have a signal with a value range of 100…1000 and a resolution of 0.125. To send this over CAN I need to use 13 bits and scale the value with a gain of 0.125 and an offset of 100. Values will be send in an integer representation:
    msgdata value
    0 100
    500 162.5
    501 162.625
    1000 225
    5000 725
    7200 1000
     The formula to translate msgdata to value is easy: value := msgdata*gain+offset.
    Another example: the car I test at the moment sends it's current speed as 16 bit integer value with a range of 0…65532. The gain is 0.01 so speed translates to 0.00…655.32 km/h. The values 65533-65535 have special meanings to indicate errors…
    So again: What is your needed resolution and data range?
    Another option: send the SGL as it is: just 4 bytes. Receive those 4 bytes on your PC as I32/U32 and typecast them to SGL…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How does Java store floating point numbers?

    Hello
    I'm writing a paper about floating point numbers in which I compare an IEEE-754 compatible language [c] with Java. I read that Java can do a conversion decimal->binary->decimal and retain the same value whereas c can't. I found several documents discussing the pros and cons of that but I can't find any information about how it is implemented.
    I hope someone can explain it to me, or post a link to a site explaining it.
    Cheers
    Huttu

    So it is a myth.
    I still ask because I observed a oddity: When I store 1.4 in c and printf( %2.20f\n",a); it I get 1.39999999999999991118. If I do the same in Java with System.out.printf( %2.20f\n",a); I get 1.4. If I multiply the variable with itself I get 1.95999999999999970000:
    double a=1.4;
    a=a*a;
    System.out.printf( %2.20f\n",a);
    {code}
    Does this happen because of the rounding in Java?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for