1 (edited by thhui 06/03/2010 07:01:25 am)

Topic: Exchange Rate Setting Bugs

When I manually enter the exchange rate,

For example.

I enter the current date rate of HKD ex rate as 0.12820513 (exchange rate at 8 decomail places) with respect to USD.

FA then display it as 0.12820613,
there is a difference of 0.00000100 difference.

When I search the phpmyadmin mysql table, the 0.12820513 is entered in rate-buy and rate-sell of the 0_exchange_rates table.

There must be somewhere wrong.

I search the code and find that
this function manipulate the display result in the homepage

function number_format2($number, $decimals=0)
{
    global $thoseps, $decseps;
    $tsep = $thoseps[$_SESSION["wa_current_user"]->prefs->tho_sep()];
    $dsep = $decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()];
    //return number_format($number, $decimals, $dsep,    $tsep);
    $delta = ($number < 0 ? -.000001 : .000001);
    return number_format($number+$delta, $decimals, $dsep,    $tsep);
}

Why use this number_format2 instead of normal number_format?

Why use $delta which is the cause of error?

Pls help!!!

Re: Exchange Rate Setting Bugs

There are 2 reasons for using our own decimal format.
1. to eliminate de declaration of the global variables.
2. a rounding bug in Windows IIS detected a couple of years ago.

I will try to increase the decimals from 6 to 10 for this operation. Hopefully this will help.

The CS Main trunk has been updated. You can download the new file here:



/Joe