1
$\begingroup$

Bug introduced in v12.2.0 or earlier, persisting through v13.2.1. Case number: 4973722


As I was helping an OP with a question involving Vietnamese currency, I didn't realize at the time that the currency amount was not being interpreted accurately (or so I think now). Apparently, the decimal point is used as a thousands separator for VND. There are three possibilities:

  • The interpretation is correct and I don't understand how their currency works.
  • I am using the function incorrectly or at least missing some options.
  • Or the interpreter is not working correctly for this particular currency.

For completeness sake, here is a screenshot.

enter image description here

----------------------------

Mma interprets Euros from a website text correctly; i.e., recognizes currency format:

astr = "MATHEMATICA kompakt: Mathematische Problemlösungen für \
Ingenieure, Mathematiker und Naturwissenschaftler

von Hans Benker | 15. Oktober 2016

4,6 von 5 Sternen 3

Kindle
29,99 € 29,99 €

Sofort lieferbar

Taschenbuch
39,99 € 39,99 €
KOSTENLOSE Lieferung";

tcases = TextCases[astr, "CurrencyAmount" -> "Interpretation"]

{Quantity[29.99, "Euros"], Quantity[29.99, "Euros"], "99 € 39,99 €"}

I hope that this post reaches its correct destination.

$\endgroup$
4
  • $\begingroup$ I have flagged this as a bug, would you mind editing the post on the topline: Bug introduced in X.X or earlier and persisting through X.X.X or later ? $\endgroup$ Oct 5, 2022 at 8:34
  • $\begingroup$ I will let senior members of the community do it. Have you heard back from WRI yet? The reason I say this is because community members run different versions and I cannot include this info as I am running v12.2.0-Win7-x64 only. Thanks for reviving this post and for your time and effort. $\endgroup$
    – Syed
    Oct 5, 2022 at 8:37
  • $\begingroup$ Sure thing, not too sure of the workflow :) Yes Wolfram have confirmed it is a bug, case number :4973722. I have included on the bottom of my post. $\endgroup$ Oct 5, 2022 at 8:40
  • $\begingroup$ My bad, I failed to see your edit, it seems. $\endgroup$
    – Syed
    Oct 5, 2022 at 8:45

1 Answer 1

2
$\begingroup$

I think your third option is correct

the interpreter is not working correctly for this particular currency.

and I have submitted this to Wolfram.

In general, it seems that the number separator is biased towards treating DecimalComma as a DecimalPoint, regardless of the currency (compare USD and EUR).

One would expect that JPY and VND get treated similarly as neither of those currencies have any decimal places

VND inconsistent

Code and other examples:

(* VND inconsistent*)
TextCases["$1.000.000","CurrencyAmount"->"Interpretation"]
TextCases["€1.000.000","CurrencyAmount"->"Interpretation"]
TextCases["¥1.000.000","CurrencyAmount"->"Interpretation"]
TextCases["₫1.000.000","CurrencyAmount"->"Interpretation"]

(* VND inconsistent*)
TextCases["$1,000,000","CurrencyAmount"->"Interpretation"]
TextCases["€1,000,000","CurrencyAmount"->"Interpretation"]
TextCases["¥1,000,000","CurrencyAmount"->"Interpretation"]
TextCases["₫1,000,000","CurrencyAmount"->"Interpretation"]

(* number separator is biased towards treating DecimalComma as a DecimalPoint *)
TextCases["$29,99","CurrencyAmount"->"Interpretation"]
TextCases["€29,99","CurrencyAmount"->"Interpretation"]
TextCases["¥29,99","CurrencyAmount"->"Interpretation"]
TextCases["₫29,99","CurrencyAmount"->"Interpretation"]

TextCases["$29.99","CurrencyAmount"->"Interpretation"]
TextCases["€29.99","CurrencyAmount"->"Interpretation"]
TextCases["¥29.99","CurrencyAmount"->"Interpretation"]
TextCases["₫29.99","CurrencyAmount"->"Interpretation"]

TextCases["$29,999","CurrencyAmount"->"Interpretation"]
TextCases["€29,999","CurrencyAmount"->"Interpretation"]
TextCases["¥29,999","CurrencyAmount"->"Interpretation"]
TextCases["₫29,999","CurrencyAmount"->"Interpretation"]

TextCases["$29.999","CurrencyAmount"->"Interpretation"]
TextCases["€29.999","CurrencyAmount"->"Interpretation"]
TextCases["¥29.999","CurrencyAmount"->"Interpretation"]
TextCases["₫29.999","CurrencyAmount"->"Interpretation"]

TextCases["$1.000","CurrencyAmount"->"Interpretation"]
TextCases["€1.000","CurrencyAmount"->"Interpretation"]
TextCases["¥1.000","CurrencyAmount"->"Interpretation"]
TextCases["₫1.000","CurrencyAmount"->"Interpretation"]

TextCases["$1,000","CurrencyAmount"->"Interpretation"]
TextCases["€1,000","CurrencyAmount"->"Interpretation"]
TextCases["¥1,000","CurrencyAmount"->"Interpretation"]
TextCases["₫1,000","CurrencyAmount"->"Interpretation"]

$Version (*"13.1.0 for Microsoft Windows (64-bit) (June 16, 2022)"*)
$Language (* English*)

Edit: Wolfram have confirmed it is a bug, case number :4973722

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.