Calculation problem

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Torkas
Newbie
Posts: 10
Joined: Wed Sep 30, 2015 5:41 pm

Calculation problem

Post by Torkas » Tue Oct 01, 2019 8:10 pm

Hi, I am trying use a simple script for apply a subtract with decimals but with MS the result is this:

Let>a=8.98
Let>b=8.1
Let>c=%a%-%b%
MessageModal>%c%

[0.880000000000001]

In this case the result is exact and I don't understand why the result is this ?¿? With a normal calculator or "Windows calculator" the result is: [0.88]. I don't want to use the FORMAT command if is possible.

Any idea about this ? Thank you so much in advance !!! :)
Last edited by Torkas on Thu Oct 03, 2019 2:06 pm, edited 1 time in total.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1354
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Calculation problem

Post by Dorian (MJT support) » Wed Oct 02, 2019 1:35 pm

That isn't what I'd have expected either. I'll ask Marcus about this, but in the meantime I would use the format command.

Code: Select all

Let>a=8.98
Let>b=8.1
Let>c=%a%-%b%
Format>%.2n,c,c

MessageModal>%c%
Yes, we have a Custom Scripting Service. Message me or go here

Torkas
Newbie
Posts: 10
Joined: Wed Sep 30, 2015 5:41 pm

Re: Calculation problem

Post by Torkas » Thu Oct 03, 2019 1:48 pm

This problem only occurs when you use some combinations of subtracts with decimals. Maybe It could be a litte bug of MS ... In any case, using after the FORMAT command the result is OK.

Thank you so much equally for the response ! :)

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1354
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Calculation problem

Post by Dorian (MJT support) » Fri Oct 04, 2019 8:59 am

I asked Marcus about this and his response it's because the numbers are floating point numbers internally.
Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts