Post Reply 
mini challenge: find the smallest cosine of an integer
10-19-2021, 11:58 AM
Post: #3
RE: mini challenge: find the smallest cosine of an integer
Brute force, HP 41

Code:

LBL 'SC'
STO 01...... that is the delta to a multiple of pi/2 or 3pi/2
pi
2
/
STO 02...... current value to check
LBL 00
  pi
  ST+ 02
  RCL 02
  FRC
  CHS
  1
  +
  ABS
  RCL 01
  X<Y? ...... is the current test value further away from an integer than the chosen delta
GTO 00
  BEEP
  VIEW 02
  STOP

0.01 XEQ 'SC' yields 10.994 hence the integer 11
0.001 XEQ 'SC' yields 15,253.9997 hence the integer 15,254
0.0001 XEQ 'SC' yields 24,461.99999 hence the integer 24,462

Upon which the accuracy limit of the HP 41 is reached.

Cheers

PeterP

Cheers,

PeterP
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: mini challenge: find the smallest cosine of an integer - PeterP - 10-19-2021 11:58 AM



User(s) browsing this thread: 2 Guest(s)