Go to Post there is no such thing as too many parts or useless parts, only parts you dont need yet. - Cuog [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Spotlight this post!  
Unread 01-02-2013, 18:16
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,089
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: remainder function

Quote:
Originally Posted by 1075guy View Post
If you have a function that works, then use it?
I do use it. But I don't want to be telling other people to use my custom function if there's already a perfectly good remainder function provided with FRC C++. I don't have access to a working C++ installation, otherwise I would test it myself. I am seeking help from knowledgeable C++ users on this forum.

Quote:
I don't understand your qualm?
Honestly, that's because I don't have a qualm. I am perfectly calm.

Quote:
I have not ever encountered a programming scenario where modulus division didn't solve my desire for a remainder, so I'm a bit lost.
I have encounted at least one such scenario, and that's why I posted this thread.

For example, the IEC60559 remainder function can take any angle and normalize it to the range -180..+180 with a single C instruction:

normalizedAngle = remainder(angle,360);

I'd like to know if the remainder function is supported in FRC C++ so I can recommend it to students who are trying to do this type of conversion.

Neither the fmod() function nor the % operator can replicate the functionality of the remainder() function without using a bunch of conditional logic

If there are any Java programmers following this thread, Java appears to have the IEC 60559 remainder function; in Java it is called IEEERemainder. See attachments. If someone would be willing to test that (compare it to the implementation I posted ealier in this thread) I'd be grateful.



qualm
/kwä(l)m/
Noun

1) An uneasy feeling of doubt, worry, or fear; a misgiving.
2) A momentary faint or sick feeling.

Synonyms
nausea - queasiness
Attached Thumbnails
Click image for larger version

Name:	Java_IEEEremainder.png
Views:	19
Size:	6.2 KB
ID:	13749  Click image for larger version

Name:	20.11.14.png
Views:	19
Size:	9.8 KB
ID:	13750  
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 14:22.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi