FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ? 235.1234/100 == 2.35
Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM
? 235.1234/100 == 2.35
Posted: 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
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: ? 235.1234/100 == 2.35
Posted: Thu Jun 03, 2021 01: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.

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: ? 235.1234/100 == 2.35
Posted: Thu Jun 03, 2021 01:32 PM
// \SAMPLES\SHUMING2.PRG

Code (fw): Select all Collapse
#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
Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM
Re: ? 235.1234/100 == 2.35
Posted: 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

Continue the discussion