SET FIXED
Moderador: Moderadores
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
SET FIXED
Descobri uma nova mas.... parece que não funciona.
SET FIXED ON
? 1 / 3
0.33
SET FIXED OFF
? 1 / 3
0.33
SET FIXED ON
? 1 / 3
0.33
SET FIXED OFF
? 1 / 3
0.33
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
SET FIXED
Alguém que tenha Clipper pode testar aonde isso causa diferença?
No momento só máquina com W10 64 bits.
No momento só máquina com W10 64 bits.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
SET FIXED
Só acrésimo:
Porque considero isso importante?
Porque se pego um valor do MySQL como 1.33333333, vém 1.33
Quero ver se SET FIXED OFF resolveria meu problema.
Se no Clipper funcionar.... então o Harbour deveria fazer igual.
Por enquanto, me parece que SET FIXED não serve pra nada, o que seria estranho existir uma função pra nada.
Porque considero isso importante?
Porque se pego um valor do MySQL como 1.33333333, vém 1.33
Quero ver se SET FIXED OFF resolveria meu problema.
Se no Clipper funcionar.... então o Harbour deveria fazer igual.
Por enquanto, me parece que SET FIXED não serve pra nada, o que seria estranho existir uma função pra nada.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- Itamar M. Lins Jr.
- Administrador

- Mensagens: 7928
- Registrado em: 30 Mai 2007 11:31
- Localização: Ilheus Bahia
- Curtiu: 1 vez
SET FIXED
Ola!
Elementar meu caro!
Esqueceu do "Set Decimals to 8" ?
Saudações,
Itamar M. Lins Jr.
Elementar meu caro!
Esqueceu do "Set Decimals to 8" ?
Código: Selecionar todos
function main
set fixed off
set decimals to 8
cls
? 1/3 //0.33333333Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
Itamar M. Lins Jr.
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
SET FIXED
Então... SET FIXED não serve pra m. nenhuma.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
SET FIXED
no harbour-users mostraram uma alternativa boa hb_NToC()
? hb_NToC( 1 / 3 )
0.3333333333333333
? hb_NToC( 1.00000000000 )
1
? hb_NToC( 1 / 3 )
0.3333333333333333
? hb_NToC( 1.00000000000 )
1
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
SET FIXED
SET DECIMALS TO 2
SET FIXED ON
? Val( hb_NTOC( 1 / 3 ) )
? Val( hb_NTOC( 1.000000000000000 ) )
SET FIXED OFF
? Val( hb_NTOC( 1 / 3 ) )
? Val( hb_NTOC( 1.000000000000000 ) )
Mesmo resultado anterior, tanto faz o SET FIXED ou SET DECIMALS.
Vai entender pra que serve o SET FIXED...
SET FIXED ON
? Val( hb_NTOC( 1 / 3 ) )
? Val( hb_NTOC( 1.000000000000000 ) )
SET FIXED OFF
? Val( hb_NTOC( 1 / 3 ) )
? Val( hb_NTOC( 1.000000000000000 ) )
Mesmo resultado anterior, tanto faz o SET FIXED ou SET DECIMALS.
Vai entender pra que serve o SET FIXED...
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
SET FIXED
Infelizmente a mesma bost.....
Se colocar variável Harbour no meio, tudo retorna 0.33x := 1 / 3
? x
? hb_NTos( x )
? Val( hb_NTos( x ) )
? Val( hb_NTos( x ) ) / 1.0000000000000000000
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- Itamar M. Lins Jr.
- Administrador

- Mensagens: 7928
- Registrado em: 30 Mai 2007 11:31
- Localização: Ilheus Bahia
- Curtiu: 1 vez
SET FIXED
Ola!
Cê viu lá que a precisão do harbour é de 15 decimais!
Se o campo é float, flutuante, o set fixed não faz nada, só mostra o que set decimals mandou, não faz nada mesmo.
Faltou o set deci to 15
Saudações,
Itamar M. Lins Jr.
Cê viu lá que a precisão do harbour é de 15 decimais!
Se o campo é float, flutuante, o set fixed não faz nada, só mostra o que set decimals mandou, não faz nada mesmo.
Faltou o set deci to 15
Código: Selecionar todos
function Main()
set deci to 15
x := 1 / 3
? x
? hb_NTos( x )
? Val( hb_NTos( x ) )
? hb_NTos( x / 1.0000000000000000000)
Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
Itamar M. Lins Jr.
-
alxsts
- Colaborador

- Mensagens: 3092
- Registrado em: 12 Ago 2008 15:50
- Localização: São Paulo-SP-Brasil
SET FIXED
Olá!
O efeito é apenas na forma de exibição dos valores:
O efeito é apenas na forma de exibição dos valores:
SET FIXED
Toggle fixing of the number of decimal digits displayed
------------------------------------------------------------------------------
Syntax
SET FIXED on | OFF | <xlToggle>
Arguments
ON fixes the decimal places display at the number of digits
specified by SET DECIMALS.
OFF allows the operation or function to determine the number of
decimal places to display.
<xlToggle> is a logical expression that must be enclosed in
parentheses. A value of true (.T.) is the same as ON, and a value of
false (.F.) is the same as OFF.
Description
SET FIXED toggles control of the display of decimal digits by the
current DECIMALS setting. When FIXED is ON, display of all numeric
output is fixed at the DECIMALS setting (two places if the SET DECIMALS
default value is in effect). When FIXED is OFF, numeric output displays
according to the default rules for numeric display. These are described
in the "Basic Concepts" chapter of the Programming and Utilities Guide.
Note that SET FIXED and SET DECIMALS affect only the display format of
numeric values and not the actual numeric precision of calculations.
Files Library is CLIPPER.LIB.
[]´s
Alexandre Santos (AlxSts)
Alexandre Santos (AlxSts)
SET FIXED
SET DECIMALS TO 15, funciona retorna 0.333333333333333
►Harbour 3.x | Minigui xx-x | HwGui◄
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)