Ejemplo n.º 1
0
/**
 * Retourne le gdouble formaté comme dans la fonction source.
 * Le symbole de la monnaie est présent par défaut.
 *
 * \param number		Number to format.
 * \param account_number
 *
 * \return		A newly allocated string of the number
 * */
gchar *utils_real_get_string_with_currency_from_double ( gdouble number,
                        gint currency_number )
{
    gsb_real real;

    real = gsb_real_double_to_real ( number );

    return utils_real_get_string_with_currency ( real, currency_number, TRUE );
}
Ejemplo n.º 2
0
/**
 * Parse a gnucash value representation and construct a numeric
 * representation of it.  Gnucash values are always of the form:
 * "integer/number".  Integer value is to be divided by another
 * integer, which eliminates float approximations.
 *
 * \param value		Number textual representation to parse.
 *
 * \return		Numeric value of argument 'value'.
 */
GsbReal gnucash_value ( gchar * value )
{
  gchar **tab_value;
  gdouble number, mantisse;

  tab_value = g_strsplit ( value, "/", 2 );

  number = utils_str_atoi ( tab_value[0] );
  mantisse = utils_str_atoi ( tab_value[1] );

  return gsb_real_double_to_real (number / mantisse);
}