Giter Site home page Giter Site logo

soarlab / fptaylor Goto Github PK

View Code? Open in Web Editor NEW
25.0 11.0 9.0 1.55 MB

Tool for Rigorous Estimation of Round-Off Floating-Point Errors

License: MIT License

OCaml 50.81% C 6.98% HTML 17.81% CSS 0.66% Makefile 5.93% GAP 4.15% Scala 1.74% TeX 1.96% Python 6.44% SMT 1.85% Shell 0.45% JavaScript 1.12% Standard ML 0.11%
floating-point round-off-error estimation analysis floating-point-accuracy-problems

fptaylor's People

Contributors

ianbriggs avatar keram88 avatar monadius avatar skoobit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fptaylor's Issues

FPTaylor build failing on Ubuntu 17.10

This is a bug report filed against FPTuner:
soarlab/FPTuner#2

I have tried compiling FPTaylor on Ubuntu 17.10 using the provided OCaml, and OCaml versions 4.00 to 4.05 provided with opam.

The problem appears to be related to building linking non-pic objects:
/usr/bin/ld: chcw.o: relocation R_X86_64_32S against `.bss' can not be used when making a shared object; recompile with -fPIC

The main fptaylor target is also unable to build (after removing INTERVAL's ocamlfpu target) with a similar error.

Estimating Round-off Error Accumulated Over a Loop

I am experimenting with FPTaylor by trying to estimate the round-off error that accumulates over a loop. Consider the (Matlab) loop below:

x = single(0); % Initialize x to a single precision floating-point variable with value 0.
for i=1:10000
     x = x + 0.0001; % After 10,000 iteration, x should theoretically be equal to x = 1.
end

x % Display x, which shows that x = 1.0001

To generate the FPTaylor definitions I unrolled this loop.

Variables
    float32 x in [1.0, 2.0]
;
    
Definitions
    defx0 = x + 0.1,
    defx1 = defx0 + 0.1,
    defx2 = defx1 + 0.1,
    defx3 = defx2 + 0.1,
    defx4 = defx3 + 0.1,
    ...
    defx9999 = defx9998 + 0.1
;

Expressions
    defx9999
;

FPTaylor hangs on "Corresponding original subexpressions".

Has FPTaylor been tested on expressions as large as this?

Support for MacOSX?

I'm wondering if anyone has tried this on MacOSX? I would like to use FPTaylor with Gelapia on MacOSX.

Thoughts?

Exact evaluation of constants

When given a constant query on the edge of a function's valid range FPTaylor currently overapproximates the function input, thus leading to a range error. Treating constants as exact could alleviate this issue.

For example, the query "sqrt(0)" will lead to an error that the square root function cannot take in a negative value.

Commenting source code

@Thanhson89, who is a PhD student at Utah, has been investing a lot of time to understand the source code of FPTaylor. He is documenting his findings along the way, and I thought it would be a good idea for this effort not to go to waste and that he turns this into nice comments in the code.

@monadius what do you think? If this sounds like it would be a potential improvement of FPTaylor for future users, please let us know and we'll create pull requests to add these comments in. Thanks!

FPTaylor building fails on Ubuntu 18.04

This is the output I get:

cd INTERVAL; make
make[1]: Entering directory '/home/vagrant/FPTaylor/INTERVAL'
File "fpu.ml", line 24, characters 0-52:
Warning 3: deprecated: [@@noalloc] should be used instead of "noalloc"
File "fpu.ml", line 25, characters 0-54:
Warning 3: deprecated: [@@noalloc] should be used instead of "noalloc"
File "fpu.ml", line 26, characters 0-60:
Warning 3: deprecated: [@@noalloc] should be used instead of "noalloc"
File "fpu.ml", line 24, characters 0-52:
Warning 3: deprecated: [@@noalloc] should be used instead of "noalloc"
File "fpu.ml", line 25, characters 0-54:
Warning 3: deprecated: [@@noalloc] should be used instead of "noalloc"
File "fpu.ml", line 26, characters 0-60:
Warning 3: deprecated: [@@noalloc] should be used instead of "noalloc"
/usr/bin/ld: chcw.o: relocation R_X86_64_32S against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
File "_none_", line 1:
Error: Error while building custom runtime system
Makefile:23: recipe for target 'ocamlfpu' failed
make[1]: *** [ocamlfpu] Error 2
make[1]: Leaving directory '/home/vagrant/FPTaylor/INTERVAL'
Makefile:128: recipe for target 'compile-interval' failed
make: *** [compile-interval] Error 2

Inverse Taylor expansion

Hi Alexey,

this might be just a question rather than an issue. I'm debugging FPTaylor (to double-check the results from my probabilistic tool).

In the case of the inverse operator, the coefficient for the first-order error terms is -1/f(x)*f(x)

Thus, should be the line 422 (link below)
let mk_v1 v0 e = mk_neg (mk_div const_1 (mk_mul v0 v0)) in
rather than
let mk_v1 v0 e = mk_neg (mk_div e (mk_mul v0 v0)) in

Thank you and sorry again for this very debugging question.

let mk_v1 v0 e = mk_neg (mk_div e (mk_mul v0 v0)) in

Add support for custom floating-point bit-widths

Several people asked me about this, given the recent trend in ML (and other areas) to use low, custom bit-widths for floating-points.
I suspect this would not be that hard to add as long as they are still IEEE compliant and it would amount to setting up machine epsilons appropriately. But maybe I am wrong here.

Does not build with ocamlc >= 4.06

If you compile with e.g. ocamlc 4.06 you get a bunch of warnings like this:

If you need to stay compatible with OCaml < 4.07, you can use the 
stdlib-shims library: https://github.com/ocaml/stdlib-shims

Then an error:

ocamlc -c -I b_and_b -I INTERVAL more_num.mli
File "more_num.mli", line 13, characters 16-23:
13 | val numerator : Num.num -> Big_int.big_int
                     ^^^^^^^
Error: Unbound module Num
make: *** [Makefile:183: more_num.cmi] Error 2

I got around this by doing ocaml switch create 4.05.0, which then built successfully. You may want to update the README.md. This was on Ubuntu 20.04.

error bounding norm: num_of_float: inf

I'm trying to bound this program, which crosses two vectors and then crosses those results to get the sin of the angle between them:

Variables
  real x0 in [0,1.0000000000000004];
  real y0 in [0,1.0000000000000004];
  real z0 in [0,1.0000000000000004];

  real x1 in [0,1.0000000000000004];
  real y1 in [0,1.0000000000000004];
  real z1 in [0,1.0000000000000004];

  real x2 in [0,1.0000000000000004];
  real y2 in [0,1.0000000000000004];
  real z2 in [0,1.0000000000000004];

  real x3 in [0,1.0000000000000004];
  real y3 in [0,1.0000000000000004];
  real z3 in [0,1.0000000000000004];  

Expressions
  c00 rnd64= +(y0*z1-z0*y1);                      // |i j  k |  
  c01 rnd64= -(x0*z1-z0*x1);                      // |x0 y0 z0|
  c02 rnd64= +(x0*y1-y0*x1);                      // |x1 y1 z1|

  c10 rnd64= +(y2*z3-z2*y3);                      // |i  j  k |  
  c11 rnd64= -(x2*z3-z2*x3);                      // |x2 y2 z2|
  c12 rnd64= +(x2*y3-y2*x3);                      // |x3 y3 z3|

  c0 rnd64 = +(c01*c12-c02*c11);                  // |i   j   k  |
  c1 rnd64 = -(c00*c12-c02*c10);                  // |c00 c01 c02|
  c2 rnd64 = +(c00*c11-c01*c10);                  // |c10 c11 c12|
  
  norm2 = c0*c0+c1*c1+c2*c2;
  norm  = sqrt(c0*c0+c1*c1+c2*c2);

It seems to do fine until it gets to norm() and then it errors out with:

**ERROR**: num_of_float: inf

But I don't think those terms should ever be infinite, so I'm wondering if I'm doing something obviously wrong.

Unable to compile INTERVAL

/usr/bin/ld: INTERVAL/chcw.o: relocation R_X86_64_32S against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output

I have tried adding -fPIC to the makefile without success. Also tried crosscompiling to 32 bit (using gcc -m32) which didn't work.

Can not build the FPTaylor on ubuntu 16.04

`
ubuntu@test-1:~/FPTaylor⟫ make

cd INTERVAL; make
make[1]: Entering directory '/home/ubuntu/FPTaylor/INTERVAL'
make[1]: Leaving directory '/home/ubuntu/FPTaylor/INTERVAL'
ocamlc -c -I INTERVAL version.mli
ocamlc -c -I INTERVAL version.ml
ocamlc -c -I INTERVAL lib.mli
ocamlc -c -I INTERVAL lib.ml
File "lib.ml", line 198, characters 2-27:
Error: Unbound value Format.pp_flush_formatter
Makefile:148: recipe for target 'lib.cmo' failed
make: *** [lib.cmo] Error 2
2 ubuntu@test-1:~/FPTaylor⟫
`

Could you help me?
Thank you very much!

arcsine(X) when X=[-1, 1]

I have been playing with the arcsine operator in FPTaylor. FPTaylor does not like when the argument of arcsine is a fresh variable bounded in [-1, 1].

Program causing the error:

Variables
	real X in [-1, 1];

Expressions
	latitude rnd64 = asin(X);

I suspect the reason is X=[-1, 1] implies Round(X)=[-1-err, +1+err] thus the domain of the arcsine is violated thus the error message: Potential exception detected: Arcsine of an invalid argument at: asin(rnd64(angle)).
On the other hand, this is a very specific scenario where also Round(X) is bounded between [-1 ,1]. So the error might be because of the over-approx. introduced by FPTaylor.

--Rocco

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.