Skip to main content
artchrome
Inspiring
June 8, 2010
Answered

Float to Hexadecimal

  • June 8, 2010
  • 1 reply
  • 2051 views

Hi all,

I need to convert a simple float include between 0 and 1 (only positive) like as 0,1234567 to hexadecimal (0x00000000).

Anyone who have an idea (like as function), please lets me know

Ciao, art.chrome

This topic has been closed for replies.
Correct answer chris_gebab

Muppet Mark , Harbs,

Thanks, it's better way/solution for this post and  also i don't try to reply it, though my title post seems similar

make "saveSwatches" function for Illustrator is probably useless and probably you're right. But this is an exemple / illustration of that i mean by convert Float to hexa. "saveSwatches" for illustrator is more a reason / pretext to approach :

ASE file format

read/write with none ASCII (so.. hexa / binary)

learn more on float / hexa / decimal

..than other things

So.. you seems suggest that is too heavy / fastidious / re-inventing the wheel.. and not accurate (on this point, i don't work with high degree of accuracy).. fine

So make a table of precalculated values should be better ? another suggestion ?

Regards, art.chrome

a little man who makes laugh experts!


art, i do not understand anything here.

likewise this:

http://jsfromhell.com/classes/binary-parser

so, maybe this is useful for you

Chris

1 reply

Harbs.
Legend
June 8, 2010

parseInt(number,16)

Harbs

artchrome
artchromeAuthor
Inspiring
June 8, 2010

Hi,

var n=0.5;
alert (parseInt(n,16));

return 0

i'm waiting 0x3F000000

Sorry, art.chrome

artchrome
artchromeAuthor
Inspiring
June 22, 2010

art, i do not understand anything here.

likewise this:

http://jsfromhell.com/classes/binary-parser

so, maybe this is useful for you

Chris


Hi Chris,

Many thanks

Great !

art.chrome