My contract .Cpp part
void mainloan::adduwr(name acc_name, double interest, uint64_t loan_amount )
{
print("Adding underwriter", acc_name);
// require_auth( _self );
uwr_table.emplace(get_self(), [&](auto &u) {
u.acc_name = acc_name;
u.interest_rate =interest;
// u.loan_amount=loan_amount;
u.giving_loan_amunt = loan_amount;
});
}
.hpp part
struct [[eosio::table]] underwriter_info
{
name acc_name;
// std::vector<uint64_t> interest_rate;
// std::vector<uint64_t> loan_amount;
double interest_rate;
uint64_t giving_loan_amunt;
auto primary_key() const
{
return acc_name.value;
}
};
typedef eosio::multi_index<"underwriter"_n, underwriter_info> underwriter;
underwriter uwr_table;
[[eosio::action]]
void adduwr(name acc_name,double interest, uint64_t loan_amount);
Cleos call
guru@ubuntu:~/contracts/mainloan$ cleos --url http://jungle2.cryptolions.io:80 push action microfinanc1 adduwr ['lender',8.6,10000] -p microfinanc1
executed transaction: 26b8218bbcd623430b440efecfcbb395cc5430f25d16900497e96c006c78977f 120 bytes 210 us
# microfinanc1 <= microfinanc1::adduwr {"acc_name":"lender","interest":"8.59999999999999964","loan_amount":10000}
>> Adding underwriterlender
warning: transaction executed locally, but may not be confirmed by the network yet ]
so the problem happens when i called the action
cleos --url http://jungle2.cryptolions.io:80 push action microfinanc1 adduwr ['lender',8.6,10000] -p microfinanc1
output from cleos
{"acc_name":"lender","interest":"8.59999999999999964","loan_amount":10000}
so 8.6 is chnaged to 8.59999999999999964 why this is happening? if anyone have any suggestion to give,please say it.