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 !!!
Calculation problem
Moderators: Dorian (MJT support), JRL
Calculation problem
Last edited by Torkas on Thu Oct 03, 2019 2:06 pm, edited 1 time in total.
- Dorian (MJT support)
- Automation Wizard
- Posts: 1354
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: Calculation problem
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
Re: Calculation problem
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 !
Thank you so much equally for the response !
- Dorian (MJT support)
- Automation Wizard
- Posts: 1354
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: Calculation problem
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