Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) ApfloatExample1

 

STL

 

Apfloat example 1 is an apfloat example.

Technical facts

 

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: ./CppApfloatExample1/CppApfloatExample1.pro

 

include(../../ConsoleApplication.pri)
include(../../Libraries/Apfloat.pri)
include(../../Libraries/Boost.pri)

SOURCES += main.cpp

 

 

 

 

 

./CppApfloatExample1/main.cpp

 

#include <iostream>
#include "apfloat.h"

using namespace std;

int main()
{
  double x = 1.0;
  apfloat y = 1.0;
  for (int i=0; i!=20; ++i)
  {
    x /= 1.0e50;
    y /= 1.0e50;
    std::cout << x << " " << y << '\n';
  }
}

/* Screen output

1e-050 0.000009999999999999998550000e-45
1e-100 0.099999999999999971e-99
1e-150 0.000000999999999999999565000e-144
1e-200 0.009999999999999994200000000e-198
1e-250 0.000000099999999999999927500e-243
1e-300 0.000999999999999999130000000e-297
0 0.000000009999999999999989850e-342
0 0.000099999999999999884000000e-396
0 0.999999999999998695e-450
0 0.000009999999999999985500000e-495
0 0.099999999999999840500000000e-549
0 0.000000999999999999998260000e-594
0 0.009999999999999981150000000e-648
0 0.000000099999999999999797000e-693
0 0.000999999999999997825000000e-747
0 0.000000009999999999999976800e-792
0 0.000099999999999999753500000e-846
0 0.999999999999997390e-900
0 0.000009999999999999972450000e-945
0 0.099999999999999710e-999
Press <RETURN> to close this window...

*/

 

 

 

 

 

./CppApfloatExample1/crosscompile.sh

 

#!/bin/sh
#From http://richelbilderbeek.nl/CppMxe.htm

#Don't put the full path here. It has to be found in the
# In /home/yourusername/.bashrc add the following line add the end instead:
# export PATH=$PATH:/home/richel/GitHubs/ProjectRichelBilderbeek/Libraries/mxe/usr/bin/
#myqmake="i686-pc-mingw32.static-qmake-qt4"
myqmake="i686-w64-mingw32.static-qmake-qt5"

echo "Displaying cross compiler version (if it is not found, set the path to YourFolder/mxe/usr/bin"
$myqmake -v

for myprofile in `ls | egrep ".pro\>"`
do
  #echo $myprofile
  mybasename=`echo $myprofile | sed "s/\.pro//"`

  #echo "mybasename: "$mybasename

  # echo "Cleaning up"
  # rm Makefile
  # rm Makefile.*
  # rm -r release
  # rm -r debug
  # rm ui_*.h
  # rm qrc_*.cpp
  # rm moc_*.cpp
  # rm object_script*.*
  # rm *.o
  # rm *_plugin_import.cpp
  # rm *.exe #Also clean up the executable

  echo "Creating makefile"

  $myqmake $myprofile

  if [ ! -e Makefile ]
  then
    echo "FAIL:"$myqmake", "$myprofile": FAIL (Makefile not found)"
    continue
  fi

  echo "Start make"

  make


  if [ -e ./release/$mybasename".exe" ]
  then
    echo $myprofile", : SUCCESS"
    if [ -e ./release/$mybasename".exe" ]
    then
      cp ./release/$mybasename".exe" .
    fi
  else
    echo $myprofile", "$mytypestr": FAIL (executable not found)"
  fi

  #Cleaning up
  # rm Makefile
  # rm Makefile.*
  # rm -r release
  # rm -r debug
  # rm ui_*.h
  # rm qrc_*.cpp
  # rm moc_*.cpp
  # rm object_script*.*
  # rm *.o
  # rm *_plugin_import.cpp

done #next myprofile

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict

This page has been created by the tool CodeToHtml