Comments (2)
This is how floating point unit operates on a CPU, not programming language issue.
Your example redacted below, to help you understand, that floating point numbers are not exact numbers.
LOCAL a1, a2, a3, a4, sub1, sub2
a1 = 850.01
a2 = 6.29
a3 = 11.00
a4 = 60.29
sub1 = a1 + a2 + a3 + a4
sub2 = 927.59
? Str( sub1, 29, 19 ), Str( sub2, 29, 19 )
IF Round( sub1, 2 ) = Round( sub2, 2 )
? Str( sub1 ) + Str( sub2 )
? "They are the same."
ELSE
? Str( sub1 ) + Str( sub2 )
? "THEY ARE NOT THE SAME !!!"
ENDIF
result:
927.5899999999999000000 927.5900000000000000000
927.59 927.59
They are the same.
from core.
Many thanks for your explanation it all makes sence now.
from core.
Related Issues (20)
- GT driver for GLFW
- hb_gt_wvt_gfx_Text()
- GFX acquire / release gtwvt
- can't recompile harbour after msys2 clang64 openssl version upgrade HOT 5
- can't compile harbour anymore (msys2 clang64) HOT 1
- harbour instalation forgot contrib/hbhpdf/tests/files folder
- error adding symbols: Malformed archive HOT 5
- Static compilation - BASE/1302 Argument error: HOT 3
- TBROWSEDB() ERROR AFTER LAST HARBOUR UPDATE HOT 1
- HBMK2: unrecoverable error 6005: Exception error HOT 6
- GPF when accesing member of NIL using @ operator HOT 2
- memory and array HOT 9
- GTGLFW
- Official Docker image?
- OpenSSL HOT 3
- no error -w3 when use function
- harbour becomes UNUSABLE to me HOT 1
- Information returned for HB_VERSION_HARBOUR HOT 2
- Compiling Harbour under Debian 12 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.