Click here to Skip to main content
15,914,225 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to replace every different char with another given char Pin
BillWoodruff27-May-19 2:39
professionalBillWoodruff27-May-19 2:39 
GeneralRe: How to replace every different char with another given char Pin
Member 1379031628-May-19 8:29
Member 1379031628-May-19 8:29 
GeneralRe: How to replace every different char with another given char Pin
Member 1379031628-May-19 20:19
Member 1379031628-May-19 20:19 
GeneralRe: How to replace every different char with another given char Pin
kalberts29-May-19 4:49
kalberts29-May-19 4:49 
GeneralRe: How to replace every different char with another given char Pin
OriginalGriff26-May-19 1:33
mveOriginalGriff26-May-19 1:33 
GeneralRe: How to replace every different char with another given char Pin
Member 1379031626-May-19 1:51
Member 1379031626-May-19 1:51 
GeneralRe: How to replace every different char with another given char Pin
OriginalGriff26-May-19 5:13
mveOriginalGriff26-May-19 5:13 
GeneralRe: How to replace every different char with another given char Pin
BillWoodruff26-May-19 1:51
professionalBillWoodruff26-May-19 1:51 
GeneralRe: How to replace every different char with another given char Pin
OriginalGriff26-May-19 3:09
mveOriginalGriff26-May-19 3:09 
GeneralRe: How to replace every different char with another given char Pin
BillWoodruff26-May-19 22:08
professionalBillWoodruff26-May-19 22:08 
GeneralRe: How to replace every different char with another given char Pin
OriginalGriff26-May-19 22:22
mveOriginalGriff26-May-19 22:22 
GeneralRe: How to replace every different char with another given char Pin
BillWoodruff26-May-19 22:55
professionalBillWoodruff26-May-19 22:55 
GeneralRe: How to replace every different char with another given char Pin
kalberts29-May-19 4:52
kalberts29-May-19 4:52 
GeneralRe: How to replace every different char with another given char Pin
OriginalGriff29-May-19 5:08
mveOriginalGriff29-May-19 5:08 
GeneralRe: How to replace every different char with another given char Pin
lmoelleb26-May-19 8:40
lmoelleb26-May-19 8:40 
AnswerRe: How to replace every different char with another given char Pin
Luc Pattyn25-May-19 19:16
sitebuilderLuc Pattyn25-May-19 19:16 
AnswerRe: How to replace every different char with another given char Pin
kalberts29-May-19 5:01
kalberts29-May-19 5:01 
QuestionFloating Point Calculations - c# vs. c++ Pin
User 1106097922-May-19 6:50
User 1106097922-May-19 6:50 
Dear experts
I'm migrating some stuff from c++ (Borland Builder) to c#.

While comparing the calculations between the two implementations I found among others
a.) c++: pow(0.1, 3.0) results in 0.001
b.) c#: Math.Pow(0.1, 3.0) results in 0.0010000000000000002

Ok so far so good. "power" is not an fpu instruction and therefore I can imagine that the two results are slightly different, because of maybe different implementation of the "power" function.

Nevertheless I made the following experiment
c++: double test= 0.1 * 0.1 * 0.1 which results in 0.001
c#: double test= 0.1 * 0.1 * 0.1 which results again in 0.0010000000000000002

Surprising for me
The latter now is something surprising -at least for me- because I'm assuming that both (c++ and c#) will use the fpu for multiplications.

I googled a lot for this, but I'm not able to find an explanation. Do you have an idea?

Thank you very much in advance for your comments on this.
Regards


[edit]
Btw: I also tried _clearfp and _fpreset for c#, but results remain the same.
It does not solve my Problem, but it answers my question


modified 19-Jan-21 21:04pm.

GeneralRe: Floating Point Calculations - c# vs. c++ PinPopular
harold aptroot22-May-19 7:00
harold aptroot22-May-19 7:00 
GeneralRe: Floating Point Calculations - c# vs. c++ Pin
User 1106097922-May-19 7:24
User 1106097922-May-19 7:24 
GeneralRe: Floating Point Calculations - c# vs. c++ Pin
CPallini22-May-19 23:01
mveCPallini22-May-19 23:01 
GeneralRe: Floating Point Calculations - c# vs. c++ Pin
User 1106097923-May-19 8:38
User 1106097923-May-19 8:38 
GeneralRe: Floating Point Calculations - c# vs. c++ Pin
kalberts29-May-19 5:21
kalberts29-May-19 5:21 
GeneralRe: Floating Point Calculations - c# vs. c++ Pin
User 1106097929-May-19 5:42
User 1106097929-May-19 5:42 
AnswerRe: Floating Point Calculations - c# vs. c++ Pin
#realJSOP24-May-19 0:07
professional#realJSOP24-May-19 0:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.