Timeline for How long is my number?
Current License: CC BY-SA 3.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 17, 2017 at 11:47 | comment | added | Jörg Hülsermann |
@user63956 Yes it works now I have understand what you mean. Thank You And we can remove the ternary operator cause log10(0) is interpreted as false
|
|
May 17, 2017 at 11:46 | history | edited | Jörg Hülsermann | CC BY-SA 3.0 |
added 132 characters in body
|
May 17, 2017 at 11:29 | history | edited | Jörg Hülsermann | CC BY-SA 3.0 |
deleted 1 character in body
|
May 17, 2017 at 11:24 | comment | added | user63956 |
@JörgHülsermann -~$x is equivalent to ((int)$x)+1 . <?=-~log10(abs($argn?:1)); seems to work.
|
|
May 17, 2017 at 11:23 | history | edited | Jörg Hülsermann | CC BY-SA 3.0 |
deleted 20 characters in body
|
May 17, 2017 at 11:15 | comment | added | Jörg Hülsermann | @user63956 I was a little confused through your first post. I am not sure if you forget to add 1 or cast to int. I count 28 Bytes | |
May 17, 2017 at 11:13 | history | edited | Jörg Hülsermann | CC BY-SA 3.0 |
deleted 93 characters in body
|
May 17, 2017 at 10:51 | comment | added | user63956 |
@JörgHülsermann Why not just $argn?:1 ? It would be 26 bytes with log10() and abs() .
|
|
May 17, 2017 at 10:32 | history | edited | Jörg Hülsermann | CC BY-SA 3.0 |
added 886 characters in body
|
May 17, 2017 at 10:04 | comment | added | Jörg Hülsermann |
@roberto06 if i use abs for higher numbers the string will be interpreted as 1.0E+64 for example gives back 7 and not 64
|
|
May 17, 2017 at 10:01 | comment | added | Jörg Hülsermann | @user63956 The version with log10 can't work in cases of input zero so I delete it. | |
May 17, 2017 at 9:56 | history | rollback | Jörg Hülsermann |
Rollback to Revision 1
|
|
May 17, 2017 at 8:38 | comment | added | roberto06 |
Why not simply <?=strlen(abs($argn)); ?
|
|
May 17, 2017 at 5:36 | comment | added | user63956 |
The first one doesn't work, for example, for 10 , because ^ has lower priority. You can fix it with -~ .
|
|
May 16, 2017 at 20:13 | history | edited | Jörg Hülsermann | CC BY-SA 3.0 |
added 244 characters in body
|
May 16, 2017 at 19:55 | history | answered | Jörg Hülsermann | CC BY-SA 3.0 |