Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change to DECIMALS ?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01165727
Message ID:
01165735
Views:
11
>>Something odd has happened on my system. Code which worked previously has suddenly changed behaviour.
>>
>>I had a line of code which equates to this:
>>
>>? VAL('1.8985')
>>returning 1.8985
>>
>>now it returns 1.90
>>
>>I've tracked it down to the SET DECIMALS being 2. My regional settings are set to use system settings, which are British. The settings dialogue shows 2 in the decimals.
>>
>>SET FIXED OFF makes no difference.
>>
>>I am mystified as to how this has altered unless there is some connection with the UK end of daylight savings change that took place 2 days ago. I find it hard to believe.
>>
>>This is on VFP8, SP1.
>>
>>Are there any other UK users having a similar problem or have I done something really stupid? (or both...)
>>
>>TIA,
>>Simon
>How about:
>
>? ROUND(1.8985,2)

Hi Boris.

But ? ROUND( VAL( "1.8985",2)) will still yield 1.90 (we need ? ROUND( VAL( "1.8985",4))

Simon, besides what Boris says it's worth noting, from Help, that:

"SET DECIMALS is scoped to the current data session."

This is true of many of these SET commands (incl. SET DATE) and may bite you in future.

Have you a SET DECI in the procedure you're reporting on?

Terry
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform