moneyphp / money

PHP implementation of Fowler's Money pattern.
http://moneyphp.org
MIT License
4.56k stars 439 forks source link

ISK convert gives wrong amount (x100) #787

Closed SteveMave closed 2 months ago

SteveMave commented 3 months ago

The conversion of ISK goes wrong somewhere in the convertAgainstCurrencyPair()

$ratio = Number::fromString($ratio) ->base10($subunitDifference) ->__toString()

the ratio always goes through the base10() here and comes out 100 times bigger than expected

this is the only currency (found so far) where this is the case

ratio goes from "0.006724" to "0.6724",

I might be missing something

frederikbosch commented 2 months ago

This is probably not a bug. ISK uses a minorUnit of 0.. That has to be taken into account when converting to a currency with subunit 2, e.g. EUR or USD.