Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Number of decimal places
Message
From
04/10/2010 13:38:14
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01483618
Message ID:
01483872
Views:
51
>>>You can see my solution in the thread I mentioned to Tore - I also first need to convert to decimal and make a pick on the precision. I chose 11 digits as using higher precision changes the original number (as it was float 0.99 it will become 0.98000089, something like that).
>>
>>Find the number of decimal of a float is a waste of time,
>>because a solution does not exist.
>>Some floats have an infinite number of decimal places,
>>so we must first convert them into decimals.
>>At this point the problem becomes to find the number of decimal places of a decimal ...
>
>I agree. So, how do you find a number of decimal places of a decimal?

1. you design the db then you known
2. COLUMNPROPERTY(..,'SCALE')
3.
-- this work with 1 or more decimals
select	CHARINDEX('.',REVERSE(NULLIF(CAST(Value % 1 as varchar(40)))))-1
-- with 0 decimals, CASE WHEN Value % 1=0 THEN 0 ...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform