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:
01165736
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

I look but not see :-(

I think Simon WANTS 1.90 as a result,
Sorry Simon.
LOCAL oldDec
oldDec = SET([DECIMALS])
SET DECIMALS TO 4
? VAL([1.8891])
SET DECIMALS TO oldDec
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform