deg to rad

JaiJai
edited December 2015 in Programming Questions

why can i convert this neg deg into a rad

float deg = −3.5;

i get this when i try to run this deg as a float ,whats the issue? i have calculated float deg = -144.3; but i cant do −3.5?

processing.app.SketchException: unexpected char: '\'
    at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:386)
    at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:192)
    at processing.mode.java.JavaBuild.build(JavaBuild.java:151)
    at processing.mode.java.JavaBuild.build(JavaBuild.java:130)
    at processing.mode.java.JavaMode.handleRun(JavaMode.java:120)
    at processing.mode.java.JavaEditor$23.run(JavaEditor.java:697)
    at java.lang.Thread.run(Unknown Source)

in a forum i visited looking to learn more about the subject i seen this

π=3.141592653...π=3.141592653... is a constant (it's just a number).

Type this into a calculator and you're done.

To convert radians to degrees: multiply by 180π180π.

To convert degrees to radians: multiply by π180π180.

So −3.5×180π=−200.535228296...−3.5×180π=−200.535228296..., which is
−200.54 ∘
−200.54 ∘
to two decimal places.

which translate into -3.5 \times \frac{180}{\pi}= -200.535228296...

Answers

  • You can just use the functions degrees() and radians() to convert between degrees and radians.

  • this is what im using and im getting this error

  • edited December 2015 Answer ✓

    wild guess :

    in −3.5?

    the minus is not a real minus but a word textprocessor minus (dash / hyphen)

    since this a special character, p5 says unexpected char: '\' although there is no char '\'

    just re-type the -3.5 manually in p5 without copying it from somewhere else

  • BS!!!!! like WTF serious now? SMH ok so yes Chrisir that def was the issue thanks man i was like whyyyyyyy?!?!?!? &^%$#!!! lol

  • Answer ✓

    great!

Sign In or Register to comment.