-
Content Count
3710 -
Joined
-
Last visited
-
Days Won
185
Everything posted by David Heffernan
-
Algorithms. Irrational numer storage.Playing with 6 axis robot.
David Heffernan replied to skyzoframe[hun]'s topic in Algorithms, Data Structures and Class Design
Yes but it's hard to see the relevance. Representable numbers have the form k*2^n. Perhaps you don't actually need exact representability. We don't know what your requirements are. -
Algorithms. Irrational numer storage.Playing with 6 axis robot.
David Heffernan replied to skyzoframe[hun]'s topic in Algorithms, Data Structures and Class Design
I don't know what this means -
Of course the other problem with packing a record that should be aligned is that gives it alignment of 1 so they can be misaligned. These days that doesn't usually matter for x86/x64 but it can be a issue for some SSE2 instructions and for arm processors.
-
Algorithms. Irrational numer storage.Playing with 6 axis robot.
David Heffernan replied to skyzoframe[hun]'s topic in Algorithms, Data Structures and Class Design
Even rational numbers aren't exactly representable. Examples include 1/3 and 1/10. -
Algorithms. Irrational numer storage.Playing with 6 axis robot.
David Heffernan replied to skyzoframe[hun]'s topic in Algorithms, Data Structures and Class Design
You mean the request to store pi exactly in a float ? -
Hard to comment on this without seeing you actual code. This is all about the detail and we have none of it. For all I know you are using packed records and manually inserting padding. In which case, if that's what you've decided to do then you know how to fix it.
-
It would have been useful to say something like this, like you may need manual alignment if you need to use ancient compilers like Delphi 6. But even then, in most cases, aligned records work as expected. It's only in some very rare cases that this is not the case. Perhaps you have an example for us. Or has that knowledge been lost in the passage of time. For people that don't need to support 20 year old compilers, feel free to use the compiler to do the alignment.
-
Show us an example, with modern Delphi. For sure some ancient versions didn't get alignment correct. That's no longer the case. Compiler alignment always works for me, and I do a lot of it. And converting to 64 bit was trivial when I had to do that.
-
In your Delphi code you should be using {$MINENUMSIZE 4} at the point where you define the enums. An example from my own codebase: //Dragon4 {$MINENUMSIZE 4} type TDragon4DigitMode = (DigitMode_Unique, DigitMode_Exact); TDragon4CutoffMode = (CutoffMode_TotalLength, CutoffMode_FractionLength); {$MINENUMSIZE 1} I would however say that using offset methods to compare offsets is very good advice. But I definitely do not advise manual alignment. The compiler can do it perfectly well. You may as well get it to do that. Then, come the day you move to 64 bit, you won't have to change a thing.
-
This is bad advice. If you are using aligned records in Delphi, then the compiler uses the same alignment rules as for aligned C++ structs, and for aligned C# structs.
-
Algorithms. Irrational numer storage.Playing with 6 axis robot.
David Heffernan replied to skyzoframe[hun]'s topic in Algorithms, Data Structures and Class Design
The things you are discussing now seem unrelated to storing pi in a float. I don't feel as though we understand the problem domain yet. -
Algorithms. Irrational numer storage.Playing with 6 axis robot.
David Heffernan replied to skyzoframe[hun]'s topic in Algorithms, Data Structures and Class Design
You can't store pi exactly in a float. What is the motivation for the question? -
A dfm file is a source file
-
Definitely not impossible to find the error. Search for TDBLookupComboBox in all the .dfm and .pas files that are compiled.
-
Class function vs constructor for object creation
David Heffernan replied to Michael Taylor's topic in Algorithms, Data Structures and Class Design
This isn't true. Your class function calls the default constructor and that performs memory allocation. Free must be called. Instances of classes are heap allocated. -
Please need help for some java lines program to Delphi
David Heffernan replied to Ranja AZ's topic in FMX
What have you tried so far? -
Please need help for some java lines program to Delphi
David Heffernan replied to Ranja AZ's topic in FMX
What specifically do you mean by "help me translate" -
6 month contract and you have to jump through all these hoops. It's a seller's market right now.
-
Staggering that an employer could post something as demeaning as this.
-
Unable to run 2 TPythonEngine per VCL application
David Heffernan replied to Dmitry72's topic in Python4Delphi
Next release of Python supports per interpreter GIL which sounds exciting. -
Well, there will be an error code. You have to retrieve it.
-
When you tried this, what happened? What error was reported. Or was there no error reported?
-
-
New Code Signing Certificate Recommendations
David Heffernan replied to James Steel's topic in General Help
This is precisely what I am doing. My Python build code to perform signing starts like this: def Sign(filename, sdk=None): # see https://medium.com/@joshualipson/ev-code-certificates-automated-builds-for-windows-6100fb8e8be6 -
It doesn't look like that to me. It looks like a file read for a file named by UNC. I don't think I'd be wanting to use FileOpen anywhere ever. Shouldn't you be using streams these days? Having said that of course, FileOpen still works. You didn't tell us what happened when you used the old code. If you have a problem that you want some help with, then you should say what the problem is. People can't offer solutions to problems that aren't described. Do you understand what \\IP_address\FolderName\Filename is? I trust you do, and that the file specified by this UNC path is available on your current target device. Is it?