Git Product home page Git Product logo

Comments (5)

LeventErkok avatar LeventErkok commented on May 2, 2024 1

In that case I'd suggest do a separate program for bulk converts and use crackNum for when you want finer level of detail. It'll be as simple as putting the function I posted above in a file and compiling. (You can add a version that does the double-precision as well.) It's best to keep the two separate I think, and you can pick whichever you want.

from cracknum.

LeventErkok avatar LeventErkok commented on May 2, 2024

CrackNum isn't really designed for speed; or for such bulk conversions. This is because it supports all sorts of floating-point formats (i.e., with varying exponent and significand bits) and thus the conversion is done via a complicated process to support all these formats. Turning of verbosity wouldn't really save anything, as the bulk of the time is spent elsewhere.

But if all you're trying to do is to convert a float to its hex-layout, then you should simply use a much simpler program to do so, instead of going through CrackNum. It could be as simple as this:

import Data.Char
import Data.ReinterpretCast
import Numeric

floatToHex :: Float -> String
floatToHex f = chunk $ map toUpper $ showHex (floatToWord f) ""
 where chunk "" = ""
       chunk xs = let (f, s) = splitAt 4 xs in f ++ ' ' : chunk s

An example use:

*Main> putStrLn $ floatToHex 123456789
4CEB 79A3

I'd expect this to run significantly faster than crackNum, allowing you to do bulk processing.

from cracknum.

twobombs avatar twobombs commented on May 2, 2024

Thank you for the feedback, will look into it ! :)

from cracknum.

LeventErkok avatar LeventErkok commented on May 2, 2024

I can potentially add a bulk-convert option to CrackNum for single and double-precision only, which bypasses the heavy part. Though I still think a separate program is best for this purpose. Let me know if that's not possible for you for whatever reason.

from cracknum.

twobombs avatar twobombs commented on May 2, 2024

I can potentially add a bulk-convert option to CrackNum for single and double-precision only, which bypasses the heavy part. Though I still think a separate program is best for this purpose. Let me know if that's not possible for you for whatever reason.

A separate program or high-level language, for me, would not be my first choice as the special sauce that is crackNum sets it apart from those two other options. In that line of thought a bulk integration would IMHO be a fine addition for crackNum, less verbose but integrated even at the costs of being less speedily then a separate stand alone program but with less overhead then a high level language solution such as Python.

from cracknum.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.