? 235.1234/100 == 2.35

Post Reply
ShumingWang
Posts: 467
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China
Contact:

? 235.1234/100 == 2.35

Post by ShumingWang »

Hi,
Harbour/Clipper:
? 235.1234/100
2.35 not 2.351234
Any express return 2 decimals .

Mysql : select 235.1234/100
2.35123400

Regards!
Shuming Wang
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
User avatar
Rick Lipkin
Posts: 2675
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: ? 235.1234/100 == 2.35

Post by Rick Lipkin »

ShumingWang

Try the SET DECIMALS command .. see below for syntax ..

Rick Lipkin


SET DECIMALS
Defines the number of decimal places for displaying numeric values on the screen.
Syntax
SET DECIMALS TO [<nDecimals>]

Arguments
<nDecimals>
This is a numeric value specifying the number of decimal places for screen output of numbers. The default value is 2. If <nDecimals> is omitted, the number of decimal places is set to zero. Description
SET DECIMALS defines the number of decimal places for the display of numbers in text-mode applications. Note that the command affects only the display and not the accuracy of calculations with numeric values. If a number has more decimal places than <nDecimal>, the number is rounded for display.
Note: to activate a fixed number of decimal places for screen display, SET FIXED must be set to ON.
User avatar
karinha
Posts: 7951
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 3 times
Contact:

Re: ? 235.1234/100 == 2.35

Post by karinha »

// \SAMPLES\SHUMING2.PRG

Code: Select all | Expand


#Include "FiveWin.ch"

FUNCTION Main()

   LOCAL nRetDec := 0

   SET FIXED ON

   ? 25141251 / 362

   SET DECIMALS TO 10

   ? 214514.214 / 6325

   SET DECIMALS TO 4

   ? 235.1234 / 100

   SET DECIMALS TO 2

   ? 235.1234 / 100

   SET DECIMALS TO 2

   nRetDec := 235.1234

   ? ROUND( nRetDec, 2 ) / 100

RETURN NIL
 


Regards.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
ShumingWang
Posts: 467
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China
Contact:

Re: ? 235.1234/100 == 2.35

Post by ShumingWang »

Thanks !
Shuming Wang
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
Post Reply