Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rounding problem?
Message
De
22/03/2000 06:07:24
Paul Frost
Instem Computer Systems Ltd
Stone, Royaume Uni
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00348122
Message ID:
00348772
Vues:
28
Dumb question coming up here, I've looked through the docs & can't find an obvious answer, where are the leading spaces coming from (or more to the point why).

? 1
aligns left
? 1 * 2
has 2 (?) leading spaces
? 1 * 2 * 3
has 4 (?) leading spaces
? 1 + 2
has 1 (?) leading spaces
? 1 + 2 + 3
has 2 (?) leading spaces

a = 1
? a
a = 1 * 2
? a
a = 1
? a * 2
First 2 are right aligned at same position, 3rd has 2 extra spaces.

Why do numeric literals left align & numeric variables right align ?

It's not important & not a problem, I'm just intrigued to know where/why (or maybe just a reference to the correct section of documentation).
Thanks
Paul

>>>
>>>Try:
>>>
>>>round( a * b * c, 2 )=round( 0.3500000000 * 943 * .100, 2 )
>>>
>>>You'll get false. There's some sort of problem connected with the number of decimal places.
>>
>>You correct (naturally!)
>>maybe the fact that one has leading spaces and the other does not hat something to do with it
>>try ?val(trans( 0.3500000000 * 943 * .100))==val(trans(a*b*c))
>>it returns true
>
>I know. Go and read my previous posts on this thread. It appears that it has something to do with the number of decimal places involved in the constants. I've speculated that (for some reason) the interal data type can't correctly process it. In fact, try this:
? TRANSFORM(.35000000 * 943.0 * .100, '###.############')
>? TRANSFORM(.35000000 * 943.0 * .100, '###.###########')
and see what you get.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform