Coder Social home page Coder Social logo

thrunduil / gsli Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 234 KB

C++ implementation of (generalized) Symmetric Level-Index Arithmetic representation of floating-point numbers

License: GNU General Public License v3.0

C++ 99.33% C 0.67%
floating-point sli overflow accuracy arithmetic-operators

gsli's Introduction

GSLI

C++ implementation of (generalized) Symmetric Level-Index Arithmetic representation of floating point numbers, that essentially prevents overflow and underflow in computing. Represented numbers can be as large as Ω = 10ˆ(10ˆ(10ˆ(10ˆ2.8e+17))), and as small as 1/Ω.

GSLI library implements basic operations including arithmetic operators (+, -, *, /), comparison operators, basic functions (e.g. exp, log, pow). These functions are optimized for speed and accuracy.

The SLI representation of double precision floating point number is encoded directly in double type. Most of double precision numbers (numbers in range: 2.45e-237 - 4.07e+236) are represented exactly, leading to very small performance penalty and maximum possible accuracy, when working with numbers in this range.

All implemented operations for small or moderately large numbers are at most 2 - 3 times slower than corresponding operations for double type. Operations for large numbers are also reasonably fast, only one order of magnitude slower than corresponding operations for double type.

Code example

Simple arithmetic operations:

        gsli_double a   = sli::exp(1.0e23);
        gsli_double b   = sli::exp(1.3e23);
        gsli_double c   = a*b;
        gsli_double d   = log_abs(c);

        std::cout << c << "\n";
        std::cout << c.get_value() << "\n";
        std::cout << d << "\n";

        output:
        {2, 14.5898}
        inf
        2.3e+23

Status

GSLI library is in release candidate stage. However tests were only performed on Windows using Visual Studio 2015 compiler.

Licence

This library is published under GPL licence.

gsli's People

Contributors

thrunduil avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

gsli's Issues

I cannot run the code.

Hi,

To compile, I made some minor changes on the repo. However, I am taking this error when I am linking the executables.

g++ -std=c++14 -Wall -I"C:/Users/Asus/Desktop/Thesis/GSLI-C/GSLI/src/gsli/include/" -I"C:/Users/Asus/Desktop/Thesis/GSLI-C/GSLI/src/gsli/include/details/" -I"C:/Program Files/Boost/boost_1_80_0/" -o gsli obj/gsli_compare.o obj/gsli_constants.o obj/gsli_double.o obj/gsli_error.o obj/gsli_error_functions.o obj/gsli_exp_log_pow.o obj/gsli_functions.o obj/gsli_functions_basic.o obj/gsli_mult_div.o obj/gsli_plus_minus.o obj/gsli_rep.o obj/main.o obj/rand.o obj/test_gsli.o obj/timer.o
obj/gsli_error_functions.o:gsli_error_functions.cpp:(.text+0xd0a): undefined reference to sli::config<double, 4>::max_index_0' obj/gsli_error_functions.o:gsli_error_functions.cpp:(.text+0xd11): undefined reference to sli::config<double, 4>::min_index_0'
obj/gsli_error_functions.o:gsli_error_functions.cpp:(.text+0xd64): undefined reference to sli::config<double, 4>::max_index_1' obj/gsli_error_functions.o:gsli_error_functions.cpp:(.text+0xd6b): undefined reference to sli::config<double, 4>::min_index_1r'
obj/gsli_error_functions.o:gsli_error_functions.cpp:(.text+0xfdd): undefined reference to sli::config<double, 4>::min_index_0' obj/gsli_error_functions.o:gsli_error_functions.cpp:(.text+0x1044): undefined reference to sli::config<double, 4>::max_index_0'
obj/gsli_error_functions.o:gsli_error_functions.cpp:(.text+0x1108): undefined reference to sli::config<double, 4>::min_index_1r' obj/gsli_error_functions.o:gsli_error_functions.cpp:(.text+0x1137): undefined reference to sli::config<double, 4>::max_index_1'
obj/gsli_error_functions.o:gsli_error_functions.cpp:(.text+0x1172): undefined reference to sli::config<double, 4>::max_index_1' obj/gsli_error_functions.o:gsli_error_functions.cpp:(.text+0x11b0): undefined reference to sli::config<double, 4>::min_index_1r'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:39: gsli] Error 1

Do you have any idea about that?
How did you compile, what are the flags etc. If you have a makefile, could you share?

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.