AdamWhiteHat / BigDecimal

An arbitrary-precision decimal (base 10) floating-point number class. Over 2.5 million downloads on NuGet!
MIT License
53 stars 15 forks source link

Question: Is there a technical reason that the platform is restricted to x64? #11

Closed NickStrupat closed 1 year ago

NickStrupat commented 1 year ago

I notice it is restricted to x64 in BigRational as well.

AdamWhiteHat commented 1 year ago

No reason in particular. Just that the vast majority of computers these days are 64 bit, I don't even think they make 32 bit processors any more. I didn't expect anyone would need to compile to 32 bit. Did you need a 32 bit compilation option? It can be a little tricky to set up, so I can set it up for you if you have a need.

AdamWhiteHat commented 1 year ago

So I can update the project to have an x86 compilation option, that's no problem. Getting both the x86 and x64 bit compilation to exist in the same nuget package is an altogether different matter. Presumably its possible, but it requires making your own .targets file and there is no guidance from Microsoft on how to do it; its currently undocumented from what I gather. So a pre-compiled x86 assembly via nuget isn't in the cards. You'll have to pull the latest from the master branch and build your own. Cool?

NickStrupat commented 1 year ago

So I use an M1 mac which is 64 bit but ARM architecture. Would the project still work without an explicit platform ID at all? Just general .NET?

AdamWhiteHat commented 1 year ago

It should. There is a "Any CPU" option. Select that and rebuild all, and then at runtime the JIT compiler should choose the correct machine word size.

AdamWhiteHat commented 1 year ago

I looked into it, and indeed it is a 64bit architecture, despite being ARM and ARM is typically thought of as 32 bit. So the nuget package which is 64 bit should work just fine for you.

Do you need anything else? Can I close this ticket now? You can close it too if you're satisfied. Otherwise if I don't hear anything from you for a week or two I will probably close it at that point.

AdamWhiteHat commented 1 year ago

Closing issue now. Feel free to open another ticket if unresolved or you need anything else. Thanks for taking an interest in my project.

AdamWhiteHat commented 1 year ago

@NickStrupat Ayo--I was working on this library today and I noticed that this and the BigRational library were both targeting the framework "net6.0-windows", which is wrong; there is nothing in either library that is windows-specific, and using the OS-specific target framework moniker makes the library necessarily not cross-platform.

When I saw this today, I thought of you; If you were trying to build a project on a mac and were including this library as a dependency, I'm pretty sure it would not have built for you, complaining about compatibility and frameworks.

Part of my changes today included getting rid of the x86/x64 specific versions,going back to an AnyCPU platform, and making the target frameworks target the cross-platform frameworks only.

I have pushed a new nuget package that included these changes to nuget.org today, version 2023.121.1953 (and 2023.121.2026 for BigRational). So if you were still having issues getting your project to compile with this library, try getting the latest version from nuget, I bet that'll work for you now.