fbpx
Welcome, Guest
Username: Password: Remember me
Welcome to the XSharp forum!

Tell us and our members who you are, what you like and why you became a member of this site.
We welcome all new members and hope to see you around a lot!
  • Page:
  • 1

TOPIC:

Still number 25 Mar 2019 16:54 #7982

  • softdevo@tiscali.it's Avatar


  • Topic Author


  • Posts: 106
  • Taking a cue from what we said in the previous discussion on numbers "If someone can explain it to me?" I did a test.
    I don't think it is possible in an application to replace the numerical initialization from System.Double to System.Decimal because the behavior is not identical, see image and a Xide test application.
    Danilo
    Attachments:

    Please Log in or Create an account to join the conversation.

    Still number 25 Mar 2019 17:07 #7985

  • Chris's Avatar

  • Chris


  • Posts: 2039
  • Hi Danilo,

    Yeah, when you print a Decimal, you need to specify how many decimal places to include, because it does not contain the extra formatting information that FLOAT has:

    LOCAL d AS Decimal
    d := 123.1234567
    ? d:ToString("N2")
    d := 12
    ? d:ToString("N2")
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    Still number 25 Mar 2019 18:32 #7990

  • Karl-Heinz's Avatar

  • Karl-Heinz


  • Posts: 585
  • Hi Chris,

    i think there must have been a problem in the origin 2.0.0.9 build. When i switch back to that version i can confirm what Danilo is seeing. But with the newer dlls i have, the decimal and double output is as expected "8,70" and "870,00". When i change the decimal setting with the origin build to e.g. setdecimal (3), the decimals output is still "9" and "870" , while the doubles are "8,700" and "870,000". With the newer Dlls the output is in both cases "8,700" and "870,000".

    regards
    Karl-Heinz

    Please Log in or Create an account to join the conversation.

    Still number 25 Mar 2019 18:41 #7991

  • Chris's Avatar

  • Chris


  • Posts: 2039
  • Ah, right, thanks Karl-Heinz, Robert made some changes in this area indeed. Can't send new runtime dlls now, as they are in an intermediate state, but we will soon have a new build ready, Danilo please test again when it gets released.
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    Still number 25 Mar 2019 18:55 #7992

  • softdevo@tiscali.it's Avatar


  • Topic Author


  • Posts: 106
  • OK thanks
    Danilo

    Please Log in or Create an account to join the conversation.

    Still number 25 Mar 2019 19:21 #7993

  • wriedmann's Avatar

  • wriedmann


  • Posts: 2300
  • Ciao Danilo,

    if you replace the NTrim() function call with the ToString() method call, as follows:
    local cVal as string
    local nVal,nVal1 as System.Decimal
    
    cVal := "8.70"
    
    nVal := Val(cVal)
    self:oLabel2:Text := nVal:ToString()  // NTrim(nVal)
    nVal1 := (nVal*100)
    self:oLabel1:Text := nVal1:ToString()	// NTrim(nVal1)
    it works as expected:

    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it
    Attachments:

    Please Log in or Create an account to join the conversation.

    Last edit: by wriedmann.

    Still number 25 Mar 2019 19:24 #7994

  • softdevo@tiscali.it's Avatar


  • Topic Author


  • Posts: 106
  • Yes thank you, but I would have to change thousands of lines of code with the risk of making mistakes that come out only at runtime.
    Danilo

    Please Log in or Create an account to join the conversation.

    Still number 25 Mar 2019 19:29 #7995

  • wriedmann's Avatar

  • wriedmann


  • Posts: 2300
  • Hi Danilo,
    of course, if you have it used that much!
    But when you change all these places to the system.decimal datatype, you have to check it nevertheless, because things that worked previously could give unexpected results (more precise).
    Wolfgang
    P.S. I'm waiting for the DBFCDX RDD so I can finally move my accounting program (il mio programma di contabilità) and get rid of all the problems that are facing up from time to time.
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1