Name:

implementconstant implements a constant in arbitrary precision

Library names:

void sollya_lib_implementconstant(sollya_obj_t, ...); void sollya_lib_v_implementconstant(sollya_obj_t, va_list);

Usage:

implementconstant(expr) : constant -> void implementconstant(expr,filename) : (constant, string) -> void implementconstant(expr,filename,functionname) : (constant, string, string) -> void

Description:

Example 1:

   > implementconstant(exp(1)+log(2)/sqrt(1/10));
   /*
       This code was generated using non-trivial code generation commands of
       the Sollya software program.
       
       Before using, modifying and/or integrating this code into other
       software, review the copyright and license status of this generated
       code. In particular, see the exception below.
       
       Sollya is
       
       Copyright 2006-2013 by
       
       Laboratoire de l'Informatique du Parallelisme, UMR CNRS - ENS Lyon -
       UCB Lyon 1 - INRIA 5668,
       
       Laboratoire d'Informatique de Paris 6, equipe PEQUAN, UPMC Universite
       Paris 06 - CNRS - UMR 7606 - LIP6, Paris, France
       
       and by
       
       Centre de recherche INRIA Sophia-Antipolis Mediterranee, equipe APICS,
       Sophia Antipolis, France.
       
       Contributors Ch. Lauter, S. Chevillard, M. Joldes
       
       christoph.lauter@ens-lyon.org
       sylvain.chevillard@ens-lyon.org
       joldes@lass.fr
       
       The Sollya software is a computer program whose purpose is to provide
       an environment for safe floating-point code development. It is
       particularily targeted to the automatized implementation of
       mathematical floating-point libraries (libm). Amongst other features,
       it offers a certified infinity norm, an automatic polynomial
       implementer and a fast Remez algorithm.
       
       The Sollya software is governed by the CeCILL-C license under French
       law and abiding by the rules of distribution of free software.  You
       can use, modify and/ or redistribute the software under the terms of
       the CeCILL-C license as circulated by CEA, CNRS and INRIA at the
       following URL "http://www.cecill.info".
       
       As a counterpart to the access to the source code and rights to copy,
       modify and redistribute granted by the license, users are provided
       only with a limited warranty and the software's author, the holder of
       the economic rights, and the successive licensors have only limited
       liability.
       
       In this respect, the user's attention is drawn to the risks associated
       with loading, using, modifying and/or developing or reproducing the
       software by the user in light of its specific status of free software,
       that may mean that it is complicated to manipulate, and that also
       therefore means that it is reserved for developers and experienced
       professionals having in-depth computer knowledge. Users are therefore
       encouraged to load and test the software's suitability as regards
       their requirements in conditions enabling the security of their
       systems and/or data to be ensured and, more generally, to use and
       operate it in the same conditions as regards security.
       
       The fact that you are presently reading this means that you have had
       knowledge of the CeCILL-C license and that you accept its terms.
       
       The Sollya program is distributed WITHOUT ANY WARRANTY; without even
       the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
       PURPOSE.
       
       This generated program is distributed WITHOUT ANY WARRANTY; without
       even the implied warranty of MERCHANTABILITY or FITNESS FOR A
       PARTICULAR PURPOSE.
       
       As a special exception, you may create a larger work that contains
       part or all of this software generated using Sollya and distribute
       that work under terms of your choice, so long as that work isn't
       itself a numerical code generator using the skeleton of this code or a
       modified version thereof as a code skeleton.  Alternatively, if you
       modify or redistribute this generated code itself, or its skeleton,
       you may (at your option) remove this special exception, which will
       cause this generated code and its skeleton and the resulting Sollya
       output files to be licensed under the CeCILL-C licence without this
       special exception.
       
       This special exception was added by the Sollya copyright holders in
       version 4.1 of Sollya.
       
   */
   
   
   #include <mpfr.h>
   
   void
   const_something (mpfr_ptr y, mp_prec_t prec)
   {
     /* Declarations */
     mpfr_t tmp1;
     mpfr_t tmp2;
     mpfr_t tmp3;
     mpfr_t tmp4;
     mpfr_t tmp5;
     mpfr_t tmp6;
     mpfr_t tmp7;
   
     /* Initializations */
     mpfr_init2 (tmp2, prec+5);
     mpfr_init2 (tmp1, prec+3);
     mpfr_init2 (tmp4, prec+8);
     mpfr_init2 (tmp3, prec+7);
     mpfr_init2 (tmp6, prec+11);
     mpfr_init2 (tmp7, prec+11);
     mpfr_init2 (tmp5, prec+11);
   
     /* Core */
     mpfr_set_prec (tmp2, prec+4);
     mpfr_set_ui (tmp2, 1, MPFR_RNDN);
     mpfr_set_prec (tmp1, prec+3);
     mpfr_exp (tmp1, tmp2, MPFR_RNDN);
     mpfr_set_prec (tmp4, prec+8);
     mpfr_set_ui (tmp4, 2, MPFR_RNDN);
     mpfr_set_prec (tmp3, prec+7);
     mpfr_log (tmp3, tmp4, MPFR_RNDN);
     mpfr_set_prec (tmp6, prec+11);
     mpfr_set_ui (tmp6, 1, MPFR_RNDN);
     mpfr_set_prec (tmp7, prec+11);
     mpfr_set_ui (tmp7, 10, MPFR_RNDN);
     mpfr_set_prec (tmp5, prec+11);
     mpfr_div (tmp5, tmp6, tmp7, MPFR_RNDN);
     mpfr_set_prec (tmp4, prec+7);
     mpfr_sqrt (tmp4, tmp5, MPFR_RNDN);
     mpfr_set_prec (tmp2, prec+5);
     mpfr_div (tmp2, tmp3, tmp4, MPFR_RNDN);
     mpfr_set_prec (y, prec+3);
     mpfr_add (y, tmp1, tmp2, MPFR_RNDN);
   
     /* Cleaning stuff */
     mpfr_clear(tmp1);
     mpfr_clear(tmp2);
     mpfr_clear(tmp3);
     mpfr_clear(tmp4);
     mpfr_clear(tmp5);
     mpfr_clear(tmp6);
     mpfr_clear(tmp7);
   }

Example 2:

   > implementconstant(sin(13/17),"sine_of_thirteen_seventeenth.c");
   > readfile("sine_of_thirteen_seventeenth.c");
   /*
       This code was generated using non-trivial code generation commands of
       the Sollya software program.
       
       Before using, modifying and/or integrating this code into other
       software, review the copyright and license status of this generated
       code. In particular, see the exception below.
       
       Sollya is
       
       Copyright 2006-2013 by
       
       Laboratoire de l'Informatique du Parallelisme, UMR CNRS - ENS Lyon -
       UCB Lyon 1 - INRIA 5668,
       
       Laboratoire d'Informatique de Paris 6, equipe PEQUAN, UPMC Universite
       Paris 06 - CNRS - UMR 7606 - LIP6, Paris, France
       
       and by
       
       Centre de recherche INRIA Sophia-Antipolis Mediterranee, equipe APICS,
       Sophia Antipolis, France.
       
       Contributors Ch. Lauter, S. Chevillard, M. Joldes
       
       christoph.lauter@ens-lyon.org
       sylvain.chevillard@ens-lyon.org
       joldes@lass.fr
       
       The Sollya software is a computer program whose purpose is to provide
       an environment for safe floating-point code development. It is
       particularily targeted to the automatized implementation of
       mathematical floating-point libraries (libm). Amongst other features,
       it offers a certified infinity norm, an automatic polynomial
       implementer and a fast Remez algorithm.
       
       The Sollya software is governed by the CeCILL-C license under French
       law and abiding by the rules of distribution of free software.  You
       can use, modify and/ or redistribute the software under the terms of
       the CeCILL-C license as circulated by CEA, CNRS and INRIA at the
       following URL "http://www.cecill.info".
       
       As a counterpart to the access to the source code and rights to copy,
       modify and redistribute granted by the license, users are provided
       only with a limited warranty and the software's author, the holder of
       the economic rights, and the successive licensors have only limited
       liability.
       
       In this respect, the user's attention is drawn to the risks associated
       with loading, using, modifying and/or developing or reproducing the
       software by the user in light of its specific status of free software,
       that may mean that it is complicated to manipulate, and that also
       therefore means that it is reserved for developers and experienced
       professionals having in-depth computer knowledge. Users are therefore
       encouraged to load and test the software's suitability as regards
       their requirements in conditions enabling the security of their
       systems and/or data to be ensured and, more generally, to use and
       operate it in the same conditions as regards security.
       
       The fact that you are presently reading this means that you have had
       knowledge of the CeCILL-C license and that you accept its terms.
       
       The Sollya program is distributed WITHOUT ANY WARRANTY; without even
       the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
       PURPOSE.
       
       This generated program is distributed WITHOUT ANY WARRANTY; without
       even the implied warranty of MERCHANTABILITY or FITNESS FOR A
       PARTICULAR PURPOSE.
       
       As a special exception, you may create a larger work that contains
       part or all of this software generated using Sollya and distribute
       that work under terms of your choice, so long as that work isn't
       itself a numerical code generator using the skeleton of this code or a
       modified version thereof as a code skeleton.  Alternatively, if you
       modify or redistribute this generated code itself, or its skeleton,
       you may (at your option) remove this special exception, which will
       cause this generated code and its skeleton and the resulting Sollya
       output files to be licensed under the CeCILL-C licence without this
       special exception.
       
       This special exception was added by the Sollya copyright holders in
       version 4.1 of Sollya.
       
   */
   
   
   #include <mpfr.h>
   
   void
   const_something (mpfr_ptr y, mp_prec_t prec)
   {
     /* Declarations */
     mpfr_t tmp1;
     mpfr_t tmp2;
     mpfr_t tmp3;
   
     /* Initializations */
     mpfr_init2 (tmp2, prec+6);
     mpfr_init2 (tmp3, prec+6);
     mpfr_init2 (tmp1, prec+6);
   
     /* Core */
     mpfr_set_prec (tmp2, prec+6);
     mpfr_set_ui (tmp2, 13, MPFR_RNDN);
     mpfr_set_prec (tmp3, prec+6);
     mpfr_set_ui (tmp3, 17, MPFR_RNDN);
     mpfr_set_prec (tmp1, prec+6);
     mpfr_div (tmp1, tmp2, tmp3, MPFR_RNDN);
     mpfr_set_prec (y, prec+2);
     mpfr_sin (y, tmp1, MPFR_RNDN);
   
     /* Cleaning stuff */
     mpfr_clear(tmp1);
     mpfr_clear(tmp2);
     mpfr_clear(tmp3);
   }
   

Example 3:

   > implementconstant(asin(1/3 * pi),default,"arcsin_of_one_third_pi");
   /*
       This code was generated using non-trivial code generation commands of
       the Sollya software program.
       
       Before using, modifying and/or integrating this code into other
       software, review the copyright and license status of this generated
       code. In particular, see the exception below.
       
       Sollya is
       
       Copyright 2006-2013 by
       
       Laboratoire de l'Informatique du Parallelisme, UMR CNRS - ENS Lyon -
       UCB Lyon 1 - INRIA 5668,
       
       Laboratoire d'Informatique de Paris 6, equipe PEQUAN, UPMC Universite
       Paris 06 - CNRS - UMR 7606 - LIP6, Paris, France
       
       and by
       
       Centre de recherche INRIA Sophia-Antipolis Mediterranee, equipe APICS,
       Sophia Antipolis, France.
       
       Contributors Ch. Lauter, S. Chevillard, M. Joldes
       
       christoph.lauter@ens-lyon.org
       sylvain.chevillard@ens-lyon.org
       joldes@lass.fr
       
       The Sollya software is a computer program whose purpose is to provide
       an environment for safe floating-point code development. It is
       particularily targeted to the automatized implementation of
       mathematical floating-point libraries (libm). Amongst other features,
       it offers a certified infinity norm, an automatic polynomial
       implementer and a fast Remez algorithm.
       
       The Sollya software is governed by the CeCILL-C license under French
       law and abiding by the rules of distribution of free software.  You
       can use, modify and/ or redistribute the software under the terms of
       the CeCILL-C license as circulated by CEA, CNRS and INRIA at the
       following URL "http://www.cecill.info".
       
       As a counterpart to the access to the source code and rights to copy,
       modify and redistribute granted by the license, users are provided
       only with a limited warranty and the software's author, the holder of
       the economic rights, and the successive licensors have only limited
       liability.
       
       In this respect, the user's attention is drawn to the risks associated
       with loading, using, modifying and/or developing or reproducing the
       software by the user in light of its specific status of free software,
       that may mean that it is complicated to manipulate, and that also
       therefore means that it is reserved for developers and experienced
       professionals having in-depth computer knowledge. Users are therefore
       encouraged to load and test the software's suitability as regards
       their requirements in conditions enabling the security of their
       systems and/or data to be ensured and, more generally, to use and
       operate it in the same conditions as regards security.
       
       The fact that you are presently reading this means that you have had
       knowledge of the CeCILL-C license and that you accept its terms.
       
       The Sollya program is distributed WITHOUT ANY WARRANTY; without even
       the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
       PURPOSE.
       
       This generated program is distributed WITHOUT ANY WARRANTY; without
       even the implied warranty of MERCHANTABILITY or FITNESS FOR A
       PARTICULAR PURPOSE.
       
       As a special exception, you may create a larger work that contains
       part or all of this software generated using Sollya and distribute
       that work under terms of your choice, so long as that work isn't
       itself a numerical code generator using the skeleton of this code or a
       modified version thereof as a code skeleton.  Alternatively, if you
       modify or redistribute this generated code itself, or its skeleton,
       you may (at your option) remove this special exception, which will
       cause this generated code and its skeleton and the resulting Sollya
       output files to be licensed under the CeCILL-C licence without this
       special exception.
       
       This special exception was added by the Sollya copyright holders in
       version 4.1 of Sollya.
       
   */
   
   
   #include <mpfr.h>
   
   void
   arcsin_of_one_third_pi (mpfr_ptr y, mp_prec_t prec)
   {
     /* Declarations */
     mpfr_t tmp1;
     mpfr_t tmp2;
     mpfr_t tmp3;
   
     /* Initializations */
     mpfr_init2 (tmp2, prec+8);
     mpfr_init2 (tmp3, prec+8);
     mpfr_init2 (tmp1, prec+8);
   
     /* Core */
     mpfr_set_prec (tmp2, prec+8);
     mpfr_const_pi (tmp2, MPFR_RNDN);
     mpfr_set_prec (tmp3, prec+8);
     mpfr_set_ui (tmp3, 3, MPFR_RNDN);
     mpfr_set_prec (tmp1, prec+8);
     mpfr_div (tmp1, tmp2, tmp3, MPFR_RNDN);
     mpfr_set_prec (y, prec+2);
     mpfr_asin (y, tmp1, MPFR_RNDN);
   
     /* Cleaning stuff */
     mpfr_clear(tmp1);
     mpfr_clear(tmp2);
     mpfr_clear(tmp3);
   }

Example 4:

   > implementconstant(ceil(log(19 + 1/3)),"constant_code.c","magic_constant");
   > readfile("constant_code.c");
   /*
       This code was generated using non-trivial code generation commands of
       the Sollya software program.
       
       Before using, modifying and/or integrating this code into other
       software, review the copyright and license status of this generated
       code. In particular, see the exception below.
       
       Sollya is
       
       Copyright 2006-2013 by
       
       Laboratoire de l'Informatique du Parallelisme, UMR CNRS - ENS Lyon -
       UCB Lyon 1 - INRIA 5668,
       
       Laboratoire d'Informatique de Paris 6, equipe PEQUAN, UPMC Universite
       Paris 06 - CNRS - UMR 7606 - LIP6, Paris, France
       
       and by
       
       Centre de recherche INRIA Sophia-Antipolis Mediterranee, equipe APICS,
       Sophia Antipolis, France.
       
       Contributors Ch. Lauter, S. Chevillard, M. Joldes
       
       christoph.lauter@ens-lyon.org
       sylvain.chevillard@ens-lyon.org
       joldes@lass.fr
       
       The Sollya software is a computer program whose purpose is to provide
       an environment for safe floating-point code development. It is
       particularily targeted to the automatized implementation of
       mathematical floating-point libraries (libm). Amongst other features,
       it offers a certified infinity norm, an automatic polynomial
       implementer and a fast Remez algorithm.
       
       The Sollya software is governed by the CeCILL-C license under French
       law and abiding by the rules of distribution of free software.  You
       can use, modify and/ or redistribute the software under the terms of
       the CeCILL-C license as circulated by CEA, CNRS and INRIA at the
       following URL "http://www.cecill.info".
       
       As a counterpart to the access to the source code and rights to copy,
       modify and redistribute granted by the license, users are provided
       only with a limited warranty and the software's author, the holder of
       the economic rights, and the successive licensors have only limited
       liability.
       
       In this respect, the user's attention is drawn to the risks associated
       with loading, using, modifying and/or developing or reproducing the
       software by the user in light of its specific status of free software,
       that may mean that it is complicated to manipulate, and that also
       therefore means that it is reserved for developers and experienced
       professionals having in-depth computer knowledge. Users are therefore
       encouraged to load and test the software's suitability as regards
       their requirements in conditions enabling the security of their
       systems and/or data to be ensured and, more generally, to use and
       operate it in the same conditions as regards security.
       
       The fact that you are presently reading this means that you have had
       knowledge of the CeCILL-C license and that you accept its terms.
       
       The Sollya program is distributed WITHOUT ANY WARRANTY; without even
       the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
       PURPOSE.
       
       This generated program is distributed WITHOUT ANY WARRANTY; without
       even the implied warranty of MERCHANTABILITY or FITNESS FOR A
       PARTICULAR PURPOSE.
       
       As a special exception, you may create a larger work that contains
       part or all of this software generated using Sollya and distribute
       that work under terms of your choice, so long as that work isn't
       itself a numerical code generator using the skeleton of this code or a
       modified version thereof as a code skeleton.  Alternatively, if you
       modify or redistribute this generated code itself, or its skeleton,
       you may (at your option) remove this special exception, which will
       cause this generated code and its skeleton and the resulting Sollya
       output files to be licensed under the CeCILL-C licence without this
       special exception.
       
       This special exception was added by the Sollya copyright holders in
       version 4.1 of Sollya.
       
   */
   
   
   #include <mpfr.h>
   
   void
   magic_constant (mpfr_ptr y, mp_prec_t prec)
   {
     /* Initializations */
   
     /* Core */
     mpfr_set_prec (y, prec);
     mpfr_set_ui (y, 3, MPFR_RNDN);
   }
   

Example 5:

   > bashexecute("gcc -fPIC -Wall -c libraryconstantexample.c -I$HOME/.local/include");
   > bashexecute("gcc -shared -o libraryconstantexample libraryconstantexample.o -lgmp -lmpfr");
   > euler_gamma = libraryconstant("./libraryconstantexample");
   > implementconstant(euler_gamma^(1/3));
   /*
       This code was generated using non-trivial code generation commands of
       the Sollya software program.
       
       Before using, modifying and/or integrating this code into other
       software, review the copyright and license status of this generated
       code. In particular, see the exception below.
       
       Sollya is
       
       Copyright 2006-2013 by
       
       Laboratoire de l'Informatique du Parallelisme, UMR CNRS - ENS Lyon -
       UCB Lyon 1 - INRIA 5668,
       
       Laboratoire d'Informatique de Paris 6, equipe PEQUAN, UPMC Universite
       Paris 06 - CNRS - UMR 7606 - LIP6, Paris, France
       
       and by
       
       Centre de recherche INRIA Sophia-Antipolis Mediterranee, equipe APICS,
       Sophia Antipolis, France.
       
       Contributors Ch. Lauter, S. Chevillard, M. Joldes
       
       christoph.lauter@ens-lyon.org
       sylvain.chevillard@ens-lyon.org
       joldes@lass.fr
       
       The Sollya software is a computer program whose purpose is to provide
       an environment for safe floating-point code development. It is
       particularily targeted to the automatized implementation of
       mathematical floating-point libraries (libm). Amongst other features,
       it offers a certified infinity norm, an automatic polynomial
       implementer and a fast Remez algorithm.
       
       The Sollya software is governed by the CeCILL-C license under French
       law and abiding by the rules of distribution of free software.  You
       can use, modify and/ or redistribute the software under the terms of
       the CeCILL-C license as circulated by CEA, CNRS and INRIA at the
       following URL "http://www.cecill.info".
       
       As a counterpart to the access to the source code and rights to copy,
       modify and redistribute granted by the license, users are provided
       only with a limited warranty and the software's author, the holder of
       the economic rights, and the successive licensors have only limited
       liability.
       
       In this respect, the user's attention is drawn to the risks associated
       with loading, using, modifying and/or developing or reproducing the
       software by the user in light of its specific status of free software,
       that may mean that it is complicated to manipulate, and that also
       therefore means that it is reserved for developers and experienced
       professionals having in-depth computer knowledge. Users are therefore
       encouraged to load and test the software's suitability as regards
       their requirements in conditions enabling the security of their
       systems and/or data to be ensured and, more generally, to use and
       operate it in the same conditions as regards security.
       
       The fact that you are presently reading this means that you have had
       knowledge of the CeCILL-C license and that you accept its terms.
       
       The Sollya program is distributed WITHOUT ANY WARRANTY; without even
       the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
       PURPOSE.
       
       This generated program is distributed WITHOUT ANY WARRANTY; without
       even the implied warranty of MERCHANTABILITY or FITNESS FOR A
       PARTICULAR PURPOSE.
       
       As a special exception, you may create a larger work that contains
       part or all of this software generated using Sollya and distribute
       that work under terms of your choice, so long as that work isn't
       itself a numerical code generator using the skeleton of this code or a
       modified version thereof as a code skeleton.  Alternatively, if you
       modify or redistribute this generated code itself, or its skeleton,
       you may (at your option) remove this special exception, which will
       cause this generated code and its skeleton and the resulting Sollya
       output files to be licensed under the CeCILL-C licence without this
       special exception.
       
       This special exception was added by the Sollya copyright holders in
       version 4.1 of Sollya.
       
   */
   
   
   #include <mpfr.h>
   
   void
   const_something (mpfr_ptr y, mp_prec_t prec)
   {
     /* Declarations */
     mpfr_t tmp1;
   
     /* Initializations */
     mpfr_init2 (tmp1, prec+1);
   
     /* Core */
     euler_gamma (tmp1, prec+1);
     mpfr_set_prec (y, prec+2);
     mpfr_root (y, tmp1, 3, MPFR_RNDN);
   
     /* Cleaning stuff */
     mpfr_clear(tmp1);
   }
See also: implementpoly, libraryconstant, library, function
Go back to the list of commands