LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-15-2017, 04:46 AM   #1
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 142Reputation: 142
Apple has seemed to find new ways to obfuscate code


Code:
    for (NSDecimalNumber *myNumber = [NSDecimalNumber decimalNumberWithMantissa:0 exponent:1 isNegative:NO]; myNumber.doubleValue < 32; myNumber = [myNumber decimalNumberByAdding:[NSDecimalNumber decimalNumberWithMantissa: 1 exponent: 0 isNegative:NO]]) {
        
        NSLog(@"%@", [myNumber decimalNumberByRaisingToPower: 3]);
    }
This prints 0 to 31 each to the 3rd power.

Last edited by Laserbeak; 06-15-2017 at 04:55 AM.
 
Old 06-15-2017, 08:30 AM   #2
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 2,379

Rep: Reputation: 961Reputation: 961Reputation: 961Reputation: 961Reputation: 961Reputation: 961Reputation: 961Reputation: 961
Was there some question or new observation in that?
 
1 members found this post helpful.
Old 06-15-2017, 11:15 AM   #3
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,227

Rep: Reputation: 402Reputation: 402Reputation: 402Reputation: 402Reputation: 402
obfuscated? that doesn't look obfuscated to me

Code:
<?php
$code='Zm9yICh4ID0gMSB0byAxMCkgew0KCXByaW50KHgpDQp9';
eval(base64_decode($code));
?>
is obfuscated code (php)
 
Old 06-15-2017, 11:41 AM   #4
GazL
Senior Member
 
Registered: May 2008
Posts: 4,482
Blog Entries: 7

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
Quote:
Originally Posted by Laserbeak View Post
Code:
    for (NSDecimalNumber *myNumber = [NSDecimalNumber decimalNumberWithMantissa:0 exponent:1 isNegative:NO]; myNumber.doubleValue < 32; myNumber = [myNumber decimalNumberByAdding:[NSDecimalNumber decimalNumberWithMantissa: 1 exponent: 0 isNegative:NO]]) {
        
        NSLog(@"%@", [myNumber decimalNumberByRaisingToPower: 3]);
    }
This prints 0 to 31 each to the 3rd power.
And people complained that COBOL was long-winded.
 
Old 06-15-2017, 11:46 AM   #5
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 2,379

Rep: Reputation: 961Reputation: 961Reputation: 961Reputation: 961Reputation: 961Reputation: 961Reputation: 961Reputation: 961
Quote:
Originally Posted by GazL View Post
And people complained that COBOL was long-winded.
Only by convention. But then, it was created by the Navy, for the Navy, so it had to be.

Ever LISP?
 
Old 06-15-2017, 11:54 AM   #6
GazL
Senior Member
 
Registered: May 2008
Posts: 4,482
Blog Entries: 7

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
Quote:
Originally Posted by wpeckham View Post
Ever LISP?
Not in anger. I toyed with emacs lisp just enough to get a feel for it, but little more than that.
 
Old 06-15-2017, 01:43 PM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,614
Blog Entries: 4

Rep: Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998
Code:
identification division.
program-id. the-navy.
[...]
procedure division.
sail-the-seven-seas.
       perform government-contract
          varying budget 1000000000 by 1000000000 until hell-freezes-over.
       go to sail-the-seven-seas.
Seriously, Apple's "objective-C" code is quite incomprehensible. I think that their new "Swift" language will supersede it.

Last edited by sundialsvcs; 06-16-2017 at 07:52 AM.
 
1 members found this post helpful.
Old 06-15-2017, 05:51 PM   #8
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Original Poster
Rep: Reputation: 142Reputation: 142
Of course you can do it much easier, but by using NSDecimalNumber, you have a theoretically unbounded variable, so you don't have to worry about overflows, no matter how big your number gets.

But in reality, everything is eventually bounded, the max number given is 3.402823669209387e+165.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: There are ways the FBI can crack the iPhone PIN without Apple doing it for them LXer Syndicated Linux News 0 03-11-2016 05:50 AM
LXer: 10 ways The Nature of Code is open LXer Syndicated Linux News 0 09-16-2014 10:20 AM
LXer: Apple and Google move computing forward in identical-yet-incompatible ways LXer Syndicated Linux News 1 07-07-2014 10:42 AM
LXer: 15 Ways Nokia’s N900 Is Better Than Apple’s iPhone (and 5 ways it’s not) LXer Syndicated Linux News 0 11-14-2009 09:20 AM
LXer: Six Ways to Keep Code from Destroying You LXer Syndicated Linux News 0 05-30-2007 04:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration