Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: hexadecimal division (string to number casting only for decimal! numbers! )

by LanX (Archbishop)
on Dec 16, 2017 at 14:30 UTC ( #1205679=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      DB<17> p 0x05/0x10
    0.3125
    
      DB<18> p int(0x05/0x10)
    0
    
  2. or download this
      DB<25> p int(0x05/"\x10")
    Illegal division by zero at (eval 33)[C:/Perl_64/lib/perl5db.pl:646] l
    +ine 2.
    
  3. or download this
      DB<31> p "05"/"16" # strings with decimal(!) numbers
    0.3125
    
  4. or download this
      DB<27> p ord("\x10")
    16
    
      DB<28> p "\x10"
    &#9658;                           # not a number, hence 0
    
  5. or download this
      DB<1> p ord("1")
    49
    ...
    
      DB<4> p 5 / "\x31\x36"      # string = "16" looks like number
     0.3125
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1205679]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2019-10-17 05:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?