floating-point

Convert Between Floating Point Standards

I am trying to convert an IEEE based floating point number to a MIL-STD 1750A floating point number. I have attached the specification for both: I understand how to decompose the floating point 12.375 in IEEE format as per the example on wikipedia. However, I'm not sure if my interpretation of the MIL-STD is correct. 12.375 = (12)b...

Emulating IBM floating point multiplication/addition in VBA

I am attempting to emulate a (no longer existing) mainframe report generator in an Access 2003 or Access 2010 environment. The data it generates must match exactly with paper reports from the early 70s. Unfortunately, the earliest years data were run on hardware that used IBM floating point representation instead of IEEE. With the help o...

C compiler bug (floating point arithmetic)?

#include<stdio.h> int main() { double fract=0; int tmp; //scanf("%lf",&fract); fract=0.312; printf("%lf",fract); printf("\n\n"); while(fract>0){ fract*=(double)10; printf("%d ",(int)fract); fract-=(int)fract; } getch(); return 0; } this code shoud have an output of: 312 ...

Rounding problem with double type

Possible Duplicate: Why don't operations on double-precision values give expected results? I am experiencing a peculiar problem in C++. I created a variable of type Double. Then I did some calculations with some values assigned to other variables and assigned the result to the double variable I declared. It gave me a result wi...

Floating point exception while running ./configure

Hello hackers, I have minipc eBox 3300 with Vortex86 processor, it can run program only with up to i486 instructions. I putted TinyCore Linux distro on it and it works. But I have a problem, every time I try to compile some large program (I have tried it with gnu smalltalk and gloox) and run a configure script, it starts printing "Floati...

Floating point equality in python

Is there a function to test floating point approximate equality in python? Something like, def approx_equal(a, b, tol): return abs(a - b) < tol My use case is similar to how Google's C++ testing library, gtest.h, defines EXPECT_NEAR. Here is an example: def bernoulli_fraction_to_angle(fraction): return math.asin(sqrt(frac...

Is there a solution for Floating point Arithmetic problems in C++ ?

I am doing some floating point arithmetic and having precision problems. The resulting value is different on two machines for the same input. I read the post @ http://stackoverflow.com/questions/3031143/why-cant-i-multiply-a-float and also read other material on the web & understood that it is got to do with binary representation of floa...

ruby floating point errors

Can somebody explain why multiplying by 100 here gives a less accurate result but multiplying by 10 twice gives a more accurate result? ± % sc Loading development environment (Rails 3.0.1) >> 129.95 * 100 12994.999999999998 >> 129.95*10 1299.5 >> 129.95*10*10 12995.0 ...

Single precision float emulation in Javascript (float32)

Is it possible to somehow emulate single precision float in Javascript? According to Doug Crockford's blog "Number is 64-bit floating point", but I have to use single one for porting C++ algorithm which calculates single precision float's error. ...

calculate midpoint

Why in the bisection method it is better to compute the midpoint c between a and b with c = a + (b - a) / 2. instead of the simpler: c = (a + b) / 2. all variables are floating points. ...