? 235.1234/100 == 2.35

? 235.1234/100 == 2.35

Postby ShumingWang » Thu Jun 03, 2021 11:47 am

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
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Re: ? 235.1234/100 == 2.35

Postby Rick Lipkin » Thu Jun 03, 2021 1:23 pm

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
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: ? 235.1234/100 == 2.35

Postby karinha » Thu Jun 03, 2021 1:32 pm

// \SAMPLES\SHUMING2.PRG

Code: Select all  Expand view

#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
User avatar
karinha
 
Posts: 7804
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: ? 235.1234/100 == 2.35

Postby ShumingWang » Thu Jun 03, 2021 10:49 pm

Thanks !
Shuming Wang
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 110 guests